AI Economics and Strategy
Training cost by scale, build vs fine-tune vs API, model roadmap, required competencies. Updated April 2026.
Overview
Building your own LLM is an economic decision before it is a technical one. The total cost varies by orders of magnitude depending on scale, and the right strategy depends on the use case.
This document answers:
- How much does it cost to train at each scale?
- When is it worth building from scratch vs fine-tune vs using an API?
- What is the ideal roadmap to evolve your own model?
- What team and competencies are needed?
Training Cost by Scale
Pretraining from scratch
| Scale | Parameters | Training tokens | A100 GPU-hours | Cost USD | Cost BRL* |
|---|---|---|---|---|---|
| Nano | 100M | 10B | ~500 | $1.5K | R$ 8K |
| Small | 1B | 100B | ~5,000 | $15K | R$ 85K |
| Medium | 7B | 1T | ~50,000 | $150K | R$ 850K |
| Large | 30B | 3T | ~200,000 | $600K | R$ 3.4M |
| Frontier | 70B | 6T | ~500,000 | $1.5M | R$ 8.5M |
| State-of-art | 175B+ | 10T+ | ~2M+ | $5M+ | R$ 28M+ |
* Rate of R$ 5.70/USD, approximate cloud values (Lambda Labs, CoreWeave). On-premise can be 30–50% cheaper in 3-year TCO.
GPU cost breakdown
| Provider | A100 80GB/hour | H100/hour | RTX 4090/hour |
|---|---|---|---|
| Lambda Labs | $2.80 | $4.50 | $0.80 |
| CoreWeave | $2.50 | $4.20 | — |
| AWS (p4d) | $32.77 | — | — |
| GCP (A2) | $3.67 | — | — |
| Azure (ND96) | $33.00 | — | — |
| On-premise | $0.50–1.00 | $1.50–2.50 | $0.10–0.20 |
Note: AWSGCPAzure are 10–15× more expensive than GPU-specialized providers. For LLM training, always use LambdaCoreWeaveRunPod or on-premise.
Fine-tuning (QLoRA/LoRA)
| Base model | Fine-tune on | A100 GPU-hours | Cost USD |
|---|---|---|---|
| Llama-3.1-8B | 10K SFT examples | ~20 | $50 |
| Llama-3.1-8B | 100K SFT examples | ~100 | $280 |
| Qwen2.5-Coder-32B | 50K SFT examples | ~200 | $560 |
| Qwen2.5-Coder-32B | 500K SFT examples + DPO | ~1,000 | $2,800 |
| DeepSeek-R1-70B | 1M RLVR examples | ~5,000 | $14,000 |
Fine-tuning is 100–1000× cheaper than pretraining.
Build vs Fine-Tune vs API
Decision matrix
| Factor | API (OpenAI/Anthropic) | Fine-Tune (open-source) | Build from scratch |
|---|---|---|---|
| Upfront cost | $0 | \(500–\)15K | \(150K–\)5M+ |
| Cost per use | High ($/token) | Low (self-hosted) | Very low |
| Customization | None | High | Total |
| Privacy | Data goes to the provider | Self-hosted | Self-hosted |
| Latency | 200–1000ms | 50–300ms (local) | 50–300ms (local) |
| Vendor lock-in | High | Low | None |
| Time to production | 1 day | 1–4 weeks | 3–12 months |
| Maintenance | Zero | Low | High |
When to use each approach
API (GPT-4o, Claude, Gemini)
Worth it when:
- Prototyping a product (validate demand before investing)
- The use case is not core to the business
- There is no sensitive data
- Usage volume is low (< 1M tokens/day)
Not worth it when:
- The product IS the AI (lock-in is an existential risk)
- Sensitive data (health, legal, financial)
- High volume (monthly cost explodes)
- Critical latency (< 100ms)
Fine-Tune (open-source model)
Worth it when:
- The use case is core but does not justify pretraining
- You need domain customization (code, legal, medical)
- You want privacy without pretraining cost
- You have quality proprietary data
Not worth it when:
- The base model already solves 95% of cases
- You lack quality data to fine-tune
- You need capabilities the base model does not have (e.g., advanced math reasoning)
Build from scratch
Worth it when:
- AI is the company's main product
- You need capabilities no existing model has
- You have budget and team for 6–12 months of development
- You want sustainable competitive differentiation
Not worth it when:
- It is the first time building AI (start with fine-tune)
- The market is evolving too fast (model becomes obsolete)
- You do not have enough proprietary data
Recommendation for Koder
Phase 1 (0–3 months): API + Fine-tune
- Use API to prototype products
- Fine-tune Qwen2.5-Coder-32B for Kode (coding assistant)
- Cost: \(500–\)3K
Phase 2 (3–9 months): Advanced fine-tune
- Fine-tune with RLVR (reinforcement learning from verifier rewards)
- Build a proprietary Koder code dataset
- Train your own reward model
- Cost: \(5K–\)30K
Phase 3 (9–18 months): Own model
- Pretrain a 7–30B model focused on code + natural language
- Dataset of 1–3T tokens (The Stack + curated CommonCrawl + Koder data)
- Cost: \(150K–\)600K
Model Roadmap
Maturity model
Level 0: External API
→ GPT-4o, Claude, Gemini
→ Zero control, maximum vendor lock-in
Level 1: Fine-tune an open model
→ Llama-3.1-8B or Qwen2.5-Coder-32B fine-tuned
→ Domain customization, self-hosted
→ 1–4 weeks to produce
Level 2: Advanced fine-tune + RLVR
→ SFT + DPO + RLVR with your own reward model
→ Aligned with Koder user preference
→ 1–3 months
Level 3: Pretrain a niche model
→ 7–13B model pretrained on code + technical docs
→ Differentiation in coding tasks
→ 3–6 months
Level 4: Full-stack own model
→ 30B+ model pretrained from scratch
→ Own architecture (e.g., MoE, hybrid)
→ Sustainable differentiation
→ 6–18 monthsWhen to scale
| Signal | Action |
|---|---|
| API costs > $5K/month | Migrate to self-hosted fine-tune |
| Fine-tune fails to solve 20% of cases | Add RLVR or increase base model |
| Fine-tune costs > $20K/month in GPU | Consider pretraining a smaller model |
| Competitors launch their own model | Accelerate roadmap |
| Proprietary data > 100B tokens | Pretraining justified |
Team and Competencies
Minimum team for each level
| Level | Role | Count | Seniority |
|---|---|---|---|
| 0 (API) | ML Engineer | 1 | Mid |
| 1 (Fine-tune) | ML Engineer | 1–2 | Mid–Senior |
| 2 (Fine-tune + RLVR) | ML Engineer | 2 | Senior |
| Data Engineer | 1 | Mid | |
| 3 (Niche pretraining) | ML Engineer | 3–4 | Senior |
| Data Engineer | 2 | Mid–Senior | |
| MLOps Engineer | 1 | Senior | |
| Research Scientist | 1 | Senior/Staff | |
| 4 (Full model) | ML Engineer | 5–8 | Senior–Staff |
| Data Engineer | 3–4 | Senior | |
| MLOps Engineer | 2–3 | Senior | |
| Research Scientist | 2–3 | Staff–Principal | |
| Infrastructure Engineer | 2 | Senior |
Required technical competencies
| Area | Competency | Priority |
|---|---|---|
| Distributed training | PyTorch FSDP, DeepSpeed ZeRO, Megatron-LM | Critical |
| Fine-tuning | LoRA, QLoRA, TRL, Axolotl | Critical |
| Data pipeline | Deduplication, filtering, tokenization | Critical |
| RLHF/RLVR | PPO, DPO, GRPO, reward modeling | High (Level 2+) |
| Inference | vLLM, SGLang, quantization | High |
| MLOps | W&B, MLflow, model versioning | High (Level 3+) |
| Infra | Kubernetes, GPU scheduling, networking | Medium (Level 3+) |
| Security | PII scrubbing, red teaming, alignment | Medium |
Hiring profile
Senior ML Engineer (distributed training):
- 3+ years with PyTorch at scale
- Experience with FSDPDeepSpeedMegatron
- Has trained or fine-tuned a 7B+ model
- Understands parallelism (data, tensor, pipeline)
Data Engineer (data pipeline):
- Experience with SparkRayDask
- Data pipeline at TB+ scale
- Deduplication, filtering, data quality
MLOps Engineer:
- Model versioning, experiment tracking
- Deploy models to production
- Monitoring, A/B testing, canary
Total Cost of Ownership (TCO)
3-year comparison
| Approach | Year 1 | Year 2 | Year 3 | 3-year total |
|---|---|---|---|---|
| API (GPT-4o, 10M tokens/day) | $365K | $365K | $365K | $1.1M |
| Self-hosted fine-tune | \(50K (training) + \)100K (GPU) | $100K | $100K | $350K |
| 7B pretraining | \(150K (training) + \)100K (GPU) | $100K | $100K | $450K |
| 30B pretraining | \(600K (training) + \)200K (GPU) | $200K | $200K | $1.2M |
| On-premise GPU cluster | \(500K (hardware) + \)50K (training) | $50K (electricity) | $50K | $600K |
Conclusion: Self-hosted fine-tune is the sweet spot for most companies. Pretraining only pays off for companies where AI is the core of the business.
On-premise vs Cloud
| Factor | Cloud GPU | On-premise |
|---|---|---|
| CapEx | $0 | \(200K–\)2M (cluster) |
| Monthly OpEx | \(5K–\)50K | \(2K–\)10K (electricity + cooling) |
| Flexibility | High (scale up/down) | Low (fixed hardware) |
| Lead time | Minutes | 2–6 months (order + delivery) |
| Depreciation | N/A | 3–5 years |
| Break-even | — | 12–24 months vs cloud |
Rule of thumb: If you will use GPUs for > 2 consecutive years, on-premise is cheaper. If it is intermittent or uncertain, cloud.
For Kode
Strategy recommendation
Short term (0–6 months):
- Fine-tune Qwen2.5-Coder-32B with Koder code data
- RLVR with a reward model based on unit tests
- Self-hosted with 2× RTX 4090
- Cost: \(3K–\)10K
Medium term (6–12 months):
- Pretrain a 7B model focused on code + documentation
- Dataset: The Stack + curated CommonCrawl + Koder data
- Infra: 4× A100 80GB (cloud or on-premise)
- Cost: \(150K–\)300K
Long term (12–24 months):
- 30B+ model with own architecture (MoE?)
- Multimodal (code + diagrams + docs)
- Cost: \(500K–\)1.5M
Suggested budget
| Item | Year 1 | Year 2 | Year 3 |
|---|---|---|---|
| Fine-tune + RLVR | $10K | $15K | $20K |
| Cloud GPUs (training) | $50K | $100K | $150K |
| Dataset + data pipeline | $10K | $20K | $30K |
| Team (2 ML engineers) | $300K | $360K | $420K |
| Total | $370K | $495K | $620K |
References
| Resource | Description |
|---|---|
| SemiAnalysis — AI Infrastructure | GPU cost reports, provider comparison |
| Epoch AI — Training compute trends | Historical compute data by model |
| Lambda Labs pricing | On-demand GPU prices |
| CoreWeave pricing | Alternative GPU prices |
| HuggingFace — Open LLM cost calculator | Training cost estimate |