本文へ移動
cccskills
無料GitHub で公開

model-economics

Cost modeling and ROI analysis for specialized LLM development. Use when deciding whether to train a custom model, estimating total cost, or calculating break-even vs frontier APIs. Covers training costs, inference costs, and time-to-ROI projections.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md8.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Model Economics: Cost Analysis for LLM Specialization

When to Use This Skill

Use this skill as the first step of any model-specialization assessment to determine:

  • Is it worth training a specialized model?
  • What will the total investment be?
  • When will the specialized model break even vs frontier APIs?
  • What's the ongoing cost comparison?

Frontier API Cost Model

Important: Use websearch to get current pricing — these change frequently. Reference tiers as of early 2026:

Premium Tier ($5-25/M output tokens)

ModelInput ($/M)Output ($/M)Notes
Claude Opus 4.6$5.00$25.00Highest capability
GPT-5.2 Pro$21.00$168.00Reasoning-heavy

Savings potential: Highest. A specialized 8B model costs ~$0.05-0.15/M tokens to serve = 100-500x cheaper.

Standard Tier ($1.75-14/M output tokens)

ModelInput ($/M)Output ($/M)Notes
GPT-5.2 Chat$1.75$14.00Most popular
Claude Sonnet 4.5$3.00$15.00Good balance
Qwen3 Max$1.20$6.00Cost-effective

Savings potential: Strong at volume. Break-even is achievable with moderate traffic.

Budget Tier ($0.10-3/M output tokens)

ModelInput ($/M)Output ($/M)Notes
Gemini 3 Flash$0.50$3.00Fast, cheap
GLM 4.7$0.40$1.50Very cost-effective
Mistral Small$0.10$0.30Cheapest commercial

Savings potential: Harder to beat on cost alone. Specialize for quality, not cost.

Free / Near-Free

Many open-weight models available on OpenRouter at $0. If you only need basic capability, self-hosting these is essentially free beyond GPU cost.

Training Cost Estimation

Tinker (Managed LoRA)

Cheapest option for supported models. No GPU management.

Model SizeMethodCost/1K examplesDuration
8BLoRA~$2-515-30 min
14BLoRA~$5-1030-60 min
32BLoRA~$10-251-3 hours
70BLoRA~$25-603-8 hours

Load tinker-training-cost skill for exact per-token rates.

Modal (Serverless GPU)

GPUCost/HourBest For
A100-40GB~$1.107-14B LoRA, 7B full
A100-80GB~$1.6014-32B LoRA, 14B full
H100-80GB~$3.2532-70B LoRA, large batches

Typical training runs:

  • 8B LoRA, 5K examples, 3 epochs: ~1-2 hours on A100 = $1-3
  • 14B LoRA, 10K examples, 3 epochs: ~3-5 hours on A100-80GB = $5-8
  • 70B LoRA, 10K examples, 2 epochs: ~8-12 hours on H100 = $26-39

TensorPool (Dedicated GPU)

GPUCost/HourBest For
A100-80GB~$1.50Standard training
H200-141GB~$3.00Large models, fast training
B200-192GB~$4.50Cutting-edge, maximum throughput

Best for: Multi-day training, large-scale RL, dedicated inference.

Inference Cost Comparison

The key calculation: what does it cost to serve the specialized model vs the frontier API?

Self-Hosted Inference Cost

def inference_cost_per_million_tokens(gpu_cost_per_hour, tokens_per_second):
    """Calculate cost per million tokens for self-hosted inference.

    Args:
        gpu_cost_per_hour: GPU rental cost (e.g., $3.25 for H100)
        tokens_per_second: Model throughput (varies by model size and batch)
    """
    tokens_per_hour = tokens_per_second * 3600
    cost_per_token = gpu_cost_per_hour / tokens_per_hour
    cost_per_million = cost_per_token * 1_000_000
    return cost_per_million

Reference Throughput (vLLM, single GPU)

Model SizeGPUTokens/sec (batch)Cost/M tokens
8BA100-80GB~3,000-5,000$0.09-0.15
8BH100-80GB~5,000-8,000$0.11-0.18
14BA100-80GB~1,500-3,000$0.15-0.30
14BH100-80GB~3,000-5,000$0.18-0.30
32BH100-80GB~800-1,500$0.60-1.10
70B2xH100~500-1,000$1.80-3.60

Key insight: A specialized 8B model on Modal/TensorPool costs $0.05-0.15/M tokens vs $5-25/M for premium frontier = 50-500x cheaper per request.

Break-Even Calculator

def break_even_analysis(
    monthly_api_spend: float,
    training_cost: float,
    monthly_inference_cost: float,
    setup_hours: float = 40,
    hourly_rate: float = 100,
):
    """Calculate break-even timeline for model specialization.

    Args:
        monthly_api_spend: Current monthly frontier API cost
        training_cost: One-time training cost (GPU + data prep)
        monthly_inference_cost: Monthly cost to serve specialized model
        setup_hours: Engineering time to set up pipeline
        hourly_rate: Engineering cost per hour
    """
    engineering_cost = setup_hours * hourly_rate
    total_upfront = training_cost + engineering_cost
    monthly_savings = monthly_api_spend - monthly_inference_cost

    if monthly_savings <= 0:
        return {
            "viable": False,
            "reason": "Specialized model costs more to serve than frontier API",
            "monthly_savings": monthly_savings,
        }

    months_to_break_even = total_upfront / monthly_savings

    return {
        "viable": True,
        "total_upfront_cost": total_upfront,
        "training_cost": training_cost,
        "engineering_cost": engineering_cost,
        "monthly_api_spend": monthly_api_spend,
        "monthly_inference_cost": monthly_inference_cost,
        "monthly_savings": monthly_savings,
        "months_to_break_even": round(months_to_break_even, 1),
        "annual_savings": monthly_savings * 12 - total_upfront,
        "year_2_savings": monthly_savings * 12,  # Fully amortized
    }


# Example: Replace GPT-4o for a specific task
result = break_even_analysis(
    monthly_api_spend=5000,       # $5K/month on GPT-4o
    training_cost=500,            # $500 for LoRA fine-tune + data prep
    monthly_inference_cost=200,   # $200/month on Modal (8B model)
    setup_hours=40,               # 1 week of engineering
    hourly_rate=100,              # $100/hr engineer
)
# Result: Break-even in ~1.1 months, $52K annual savings after year 1

ROI Timeline Template

MonthFrontier CostSpecialized CostCumulative SavingsNotes
0—$4,500 upfront-$4,500Training + engineering
1$5,000$200$300First month live
2$5,000$200$5,100Break-even
3$5,000$200$9,900
6$5,000$200$24,300
12$5,000$300$52,200Includes retrain cost

Decision Framework

Strong Case for Specialization

  • Monthly API spend > $1,000
  • Constrained task (classification, extraction, formatting, domain Q&A)
  • Production data available (logs, corrections, accept/reject signals)
  • Quality requirements are well-defined and measurable
  • Task doesn't change frequently

Weak Case for Specialization

  • Monthly API spend < $500
  • Diverse, open-ended tasks (general assistant)
  • No production data to train on
  • Rapid model improvement expected (new frontier models releasing soon)
  • Task requires reasoning at the frontier level
  • Small team with no ML engineering capacity

Hybrid Approach

Route easy requests to specialized model, hard ones to frontier:

  • 90% of requests → Specialized 8B (cheap, fast)
  • 10% of requests → Frontier fallback (complex, novel)
  • Result: 80-90% cost reduction while maintaining quality on hard cases

Quick Assessment Questions

Ask the user these to determine viability:

  1. What's your monthly frontier API spend?

    • < $500: Probably not worth it (low ROI)
    • $500-2K: Worth investigating
    • $2K+: Strong candidate
    • $10K+: Almost certainly worth it
  2. How constrained is the task?

    • Single task (classification, extraction): Great fit
    • Few related tasks: Good fit
    • Many diverse tasks: Harder to specialize
  3. What production data do you have?

    • API logs with user feedback: Excellent
    • API logs without feedback: Good (can distill)
    • No production data: Need synthetic bootstrap
  4. What's your quality bar?

    • Must match frontier exactly: Harder, may need bigger model
    • 90% of frontier quality is fine: 8B LoRA likely sufficient
    • Task-specific metrics (accuracy, format): Easiest to optimize

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Simplest distributed training API. 4 lines to add distributed support to any PyTorch script. Unified API for DeepSpeed/FSDP/Megatron/DDP. Automatic device placement, mixed precision (FP16/BF16/FP8). Interactive config, single launch command. HuggingFace ecosystem standard.

日本語の概要は準備中です。原文の説明を表示しています。

huang-sh/DeepScience42026年7月15日 更新

ADMET property prediction for drug candidates. Full pharmacokinetic panel (Caco-2, PPB, clearance, CYP), toxicity (hERG, AMES, DILI), drug-likeness (Lipinski, QED), using RDKit descriptors and TDC models.

日本語の概要は準備中です。原文の説明を表示しています。

huang-sh/DeepScience42026年7月15日 更新

Interpretable ADMET analysis with mechanistic reasoning. Maps liabilities to structural causes and biological pathways. Based on CoTox (Park 2025) and DrugR (Liu 2026).

日本語の概要は準備中です。原文の説明を表示しています。

huang-sh/DeepScience42026年7月15日 更新

aeon

無料

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

日本語の概要は準備中です。原文の説明を表示しています。

huang-sh/DeepScience42026年7月15日 更新

arboreto

無料

Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.

日本語の概要は準備中です。原文の説明を表示しています。

huang-sh/DeepScience42026年7月15日 更新

astropy

無料

Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.

日本語の概要は準備中です。原文の説明を表示しています。

huang-sh/DeepScience42026年7月15日 更新

huang-sh のスキルをすべて見る

このスキルの問題を報告する