Logo Ai Scaling Laws

Ai Scaling Laws

Cộng đồng
vasilyu1983
ai-scaling-laws

Sizes models and token budgets using Kaplan/Chinchilla scaling laws. Use when reasoning about compute-optimal N and D, tokens-per-parameter ratios, or over-training tradeoffs.

Tổng quan

Nhà phát hànhvasilyu1983
Kho mãAI-Agents-public
Tên kỹ năngai-scaling-laws
Sao
87
Bản fork
19
Tệp đi kèm
6
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 6 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được vasilyu1983 công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Ai Scaling Laws trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/vasilyu1983/AI-Agents-public/tree/main/frameworks/shared-skills/skills/ai-scaling-laws
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vasilyu1983/AI-Agents-public.git /tmp/AI-Agents-public
mkdir -p .claude/skills
cp -r /tmp/AI-Agents-public/frameworks/shared-skills/skills/ai-scaling-laws .claude/skills/ai-scaling-laws
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Ai Scaling Laws trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Ai Scaling Laws ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Ai Scaling Laws với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

AI Scaling Laws — Compute-Optimal Sizing Skill

Functional reference for pre-training researchers and engineers who need to reason cold about compute, token, and parameter tradeoffs. Covers Kaplan et al. (2020), Chinchilla / Hoffmann et al. (2022), GPT-3 sizing, over-training for inference efficiency, and the mechanics of budget allocation for a from-scratch run.

This is a standard interview probe. Know the key ratios and be ready to work through a concrete sizing calculation without a lookup.

Quick Reference

ConceptFormula / HeuristicNotes
Compute budgetC ≈ 6 N DN = non-embedding params, D = training tokens; approximate, constant ≈6 accounts for forward + backward
Chinchilla-optimal ratioD ≈ 20 × NFrom Hoffmann et al. 2022; holds compute constant
Kaplan (2020) ratioD ≈ 1.7–2 × N (roughly)Pre-Chinchilla; model-heavy. Difference from Chinchilla is methodological (FLOP counting, warmup, optimizer tuning), not simply "wrong" — see post-Chinchilla ref
Optimal N given CN* ≈ (C / 120)^0.5Approximate; from Chinchilla Table A3
Optimal D given CD* ≈ (C / 0.3)^0.5Paired with above; verify against Hoffmann et al. Table A3 numbers
Over-training (Llama-style)D ≫ 20 × NTrades higher training loss for cheaper inference; standard for deployed open models. Llama 3 8B: 15T tokens ≈ 1,875 tok/param (dense example). Llama 4 (2025) is the current MoE example — apply the ratio to activated, not total, params
GPT-3 (175B) training tokens~300B tokens175B params × ~1.7 tok/param (Kaplan-era; undercooked by Chinchilla standard)
Chinchilla (70B) training tokens~1.4T tokens70B × 20; compute-matched to GPT-3 but smaller and more accurate
GPT-2 (124M) repro budget≈1–3 B tokens minimumSee worked example below
Published fit constantsα≈0.336, β≈0.283Corrected by Besiroglu et al. 2024 to α≈0.35, β≈0.37 — original fit had convergence/rounding errors

Key distinction: Chinchilla-optimal minimizes validation loss for a given compute budget. It is not inference-optimal. Over-training a smaller model to more tokens gives a model that is cheaper per inference call, even though it spent more of the compute budget on data than the loss-optimal split would dictate.

ASCII Flow

text
Fix compute budget C (e.g. GPU-hours × FLOPs/hour)
           |
           v
C ≈ 6 N D  →  Solve for Chinchilla-optimal pair
           N* ≈ sqrt(C / 120),  D* ≈ 20 × N*
           |
           v
Adjust for inference cost constraint
  If inference is expensive: shrink N, increase D (over-train)
  If training cost dominates: stay near Chinchilla-optimal
           |
           v
Set token budget D = training tokens
  Constrain by data availability — data quality shifts the curve
  Verify token count is achievable from your corpus
           |
           v
Choose batch size, LR schedule, warmup to fill D tokens

When to Use This Skill

  • Answering: "How many tokens should I train on for a model of size X?"
  • Answering: "Given a GPU budget of Y A100-hours, what model size and token count should I target?"
  • Evaluating whether a published training run is compute-optimal, over-trained, or under-trained
  • Sizing a GPT-2 reproduction or any from-scratch experiment
  • Interview preparation: compute/data/param tradeoff reasoning

Scope Boundaries

Depth on adjacent topics lives in these skills:

Sizing Workflow

  1. Fix compute budget C in FLOPs. Multiply GPU-hours by peak FLOPs/s and hardware utilization (MFU; typically 30–50% for realistic training).
  2. Apply C ≈ 6 N D to enumerate feasible (N, D) pairs along the iso-compute curve.
  3. Pick Chinchilla-optimal point: D* ≈ 20 × N (equivalently N* ≈ D / 20). For the exact coefficients use Hoffmann et al. Table A3.
  4. Check data availability: if your corpus yields fewer than D* tokens at acceptable quality, you are data-constrained; shrink N or accept suboptimal allocation.
  5. Adjust for inference regime: if you will serve the model at high QPS, favor a smaller N trained on more tokens (over-trained relative to Chinchilla). If training cost is the binding constraint, stay near Chinchilla-optimal.
  6. Set hyperparameters: peak LR typically scales as ~N^{-0.5} (rough heuristic); batch size scales with D; cosine decay or trapezoidal schedule over D tokens.

Worked Example: GPT-2 124M Reproduction on 8× A100s

Given:

  • 8 × A100 80GB, ~312 TFLOP/s each at BF16
  • Rough MFU: ~40% (realistic for a small well-tuned training script)
  • Available training time: ~8 GPU-hours (≈ 1 hour wall-clock on 8 GPUs)

Step 1 — Compute budget C:

C = 8 GPUs × 312e12 FLOP/s × 0.40 MFU × 8 × 3600 s
  ≈ 8 × 312e12 × 0.40 × 28800
  ≈ 2.9e19 FLOPs   (≈ 29 PetaFLOP)

Step 2 — N for GPT-2 124M: N ≈ 124e6 params (non-embedding; the embedding matrix ~38M is conventionally excluded from scaling law N; total is ~162M but N ≈ 124M is the standard usage)

Step 3 — Chinchilla-optimal D:

D* ≈ 20 × N = 20 × 124e6 ≈ 2.5B tokens

Step 4 — Sanity-check with C ≈ 6 N D:

C_needed = 6 × 124e6 × 2.5e9 ≈ 1.86e18 FLOPs

Our 8-GPU 8-hour budget of ~2.9e19 FLOPs comfortably covers this — we have ≈15× more compute than strictly needed for Chinchilla-optimal at 124M. This means we could:

  • Train for far fewer hours (≈ 30 min wall-clock), or
  • Over-train to 3–5B tokens to improve the model cheaply while we have the budget.

Conclusion: For a GPT-2 124M reproduction at this budget, target 2–3B tokens minimum; the budget supports over-training to 5–10B tokens if data is available, yielding a better model at no extra GPU cost.

Note: All figures above are approximate. MFU, batch size, and sequence length all affect realized throughput. Verify your actual tokens/second empirically before locking a training schedule.

Known Traps

  1. Using Kaplan (2020) ratios after Chinchilla corrected them. Kaplan suggested scaling models much faster than data (~D ∝ N^{0.74}). Chinchilla showed equal scaling. GPT-3 is a canonical example of a Kaplan-era undercooked model: 175B params but only ~300B tokens, whereas Chinchilla-optimal would require ~3.5T tokens.

  2. Conflating Chinchilla-optimal with inference-optimal. The Chinchilla optimum minimizes training loss for a fixed compute budget. Llama, Mistral, and most open-weight models deliberately over-train smaller models because inference cost matters more than training cost for deployed models.

  3. Conflating total parameters with non-embedding parameters. Scaling laws in Kaplan and Chinchilla use N = non-embedding parameters. For models with large vocabularies, the embedding table can be 20–30% of total parameters. Use the non-embedding count in the C ≈ 6ND formula.

  4. Ignoring that data is often the binding constraint. High-quality deduplicated text in a specific domain is finite. When the corpus cannot provide D* tokens at acceptable quality, the model is data-constrained regardless of the compute budget. Data quality shifts the effective loss curve — better data means lower loss at the same N and D.

  5. Treating the 20:1 heuristic as a universal law. The exact coefficient varies with model architecture, data quality, and what loss metric is being optimized. The 20:1 ratio is the central Chinchilla finding but empirical fits from Epoch AI and others show the true optimum is sensitive to these factors.

  6. Quoting Chinchilla's published fit constants as ground truth. Besiroglu et al. (2024) showed the Approach-3 fit (α≈0.336, β≈0.283) is biased by a pre-convergence optimizer and rounding; corrected exponents are α≈0.35, β≈0.37. Use the corrected values for projections.

  7. Saying "Kaplan was wrong." The Kaplan/Chinchilla split is methodological (FLOP counting, warmup, optimizer tuning); correcting those reproduces Chinchilla's C^0.50 from Kaplan's setup (Pearce & Song 2024; Porian et al. 2024).

  8. Ignoring inference cost when sizing a deployed model. Chinchilla optimizes training loss for training compute only. For anything served at scale, minimize total train+serve compute — which means smaller-and-longer than Chinchilla (Sardana & Frankle 2024).

  9. Assuming the param count is precision-independent. Low-precision training lowers the effective param count, and PTQ damage grows with training tokens (Kumar et al. 2024). Plan quantization headroom alongside the token budget.

Common Anti-Patterns

  • Choosing model size from a published architecture (e.g., "I want to do a GPT-2 run") without computing whether the training token budget is sufficient for that size.
  • Setting training tokens to a round number (e.g., "1B tokens") without reference to the model size.
  • Reporting parameter count without specifying whether embedding parameters are included.
  • Assuming the Chinchilla-optimal training run produces the best inference-time model.
  • Extrapolating scaling law curves beyond the range of the original data without acknowledging the extrapolation.

Core Principles

  1. Hold compute constant when comparing. Scaling law comparisons are only meaningful on an iso-compute curve. Comparing a bigger model trained for fewer steps to a smaller model trained for more steps conflates model size with compute.

  2. Tokens and parameters scale together. The Chinchilla result is not "more data is better." It is that the ratio D/N should be ~20 when compute is the constraint. Both must scale proportionally.

  3. The optimum is a ratio, not a number. There is no universal "correct" model size. Given a fixed compute budget, there is an optimal (N, D) pair. Given a fixed inference budget, the optimal N is smaller (more over-training).

  4. Data quality shifts the loss curve. Two training runs with the same N and D but different data quality will reach different loss values. Scaling laws are fit on specific corpora; the exact coefficients do not transfer directly to new domains without re-fitting or empirical validation.

Post-Chinchilla Developments (2023–2026)

Kaplan and Chinchilla are foundations, not the current frontier. A July-2026 answer is incomplete without these. Full detail in post-chinchilla-developments.md.

  1. Chinchilla's published fit was corrected (Besiroglu et al. 2024). The Approach-3 constants are biased (pre-convergence optimizer + rounding); corrected exponents are α≈0.35, β≈0.37. The ~20:1 heuristic survives as an order-of-magnitude rule; the exact constants do not.
  2. Repeating data is nearly free up to ~4 epochs (Muennighoff et al. 2023). When data-bound, train a smaller model for more epochs rather than under-feeding a Chinchilla-sized model. Marginal value of repeats decays to ~0 past ~16 epochs.
  3. Inference-aware scaling (Sardana & Frankle 2024). Account for serving cost: deployed models should be smaller and trained far longer than Chinchilla-optimal. Quality improves out to ~10,000 tok/param.
  4. Over-training is the deployed norm. Llama 3 8B used 15T tokens (~1,875 tok/param), ~75× Chinchilla-optimal, deliberately, for inference efficiency.
  5. Precision-aware scaling (Kumar et al. 2024). Low-precision training lowers effective param count; PTQ damage grows with training tokens, so over-training can hurt a heavily-quantized deployment. Use effective (precision-adjusted) params.
  6. MoE/sparsity scaling (Ludziejewski et al. 2024; Abnar et al. 2025). Apply 6ND with activated params; expert granularity and sparsity are first-class optimization knobs, not a footnote on a dense law.
  7. Test-time-compute scaling (Snell et al. 2024). Inference compute (sampling + verification, search over reasoning) is a third axis, substitutable with pretraining: few-query/low-volume favors a small model + heavy test-time compute (can beat a ~14× larger model); high-volume favors pretraining bigger. The scaling law under the o1/o3 reasoning paradigm.
  8. Distillation scaling (Busbridge et al. 2025). A law for distilled-student loss vs teacher/student compute split: distill when a teacher exists or you serve many students; train supervised when only one student is needed and the teacher must also be trained.
  9. RL post-training compute — a fourth axis, still unsettled (Meta et al. 2025; arXiv:2509.25300, 2025; CoScale-RL 2026). Reasoning-model RL compute (rollouts + verifier + policy updates) follows a sigmoidal, recipe-dependent curve, not a clean Chinchilla-style power law. Don't quote a fixed RL-compute coefficient as settled science — this is the least mature scaling regime as of mid-2026.

Navigation: Core References

  • Chinchilla Math — L(N,D) loss form, 20:1 derivation intuition, worked numbers from Hoffmann et al., the 2024 fit correction
  • Compute Budget Estimation — C = 6ND derivation, FLOPs-to-GPU-hours conversion, worked table
  • Post-Chinchilla Developments — 2023–2026 corrections and extensions: data-constrained, inference-aware, precision, MoE, Kaplan/Chinchilla reconciliation, test-time-compute and distillation scaling

External Sources

See data/sources.json for canonical papers and primary sources:

  • Kaplan et al. "Scaling Laws for Neural Language Models" (arXiv 2001.08361)
  • Hoffmann et al. "Training Compute-Optimal Large Language Models" / Chinchilla (arXiv 2203.15556)
  • Besiroglu et al. "Chinchilla Scaling: A replication attempt" (arXiv 2404.10102) — corrects the Chinchilla fit
  • Muennighoff et al. "Scaling Data-Constrained Language Models" (arXiv 2305.16264)
  • Sardana & Frankle "Beyond Chinchilla-Optimal: Accounting for Inference" (arXiv 2401.00448)
  • Kumar et al. "Scaling Laws for Precision" (arXiv 2411.04330)
  • Brown et al. GPT-3 (arXiv 2005.14165)

Fact-Checking Rule

  • Known bugs, regressions, framework/compiler/runtime footguns, and version-specific crash or workaround guidance must be verified against current primary web sources before being treated as current fact.
  • Verify volatile external facts before final answers.
  • Prefer official docs, standards, release notes, and pricing pages.
  • If you cannot verify, say so explicitly and present the guidance as a dated assumption instead of a fact.

Learnings Loop

Before applying this skill on a non-trivial task, read learnings.consolidated.md in this directory (and learnings.md if present).

After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Ai Scaling Laws làm được gì?

Sizes models and token budgets using Kaplan/Chinchilla scaling laws. Use when reasoning about compute-optimal N and D, tokens-per-parameter ratios, or over-training tradeoffs.

Vì sao nên dùng Ai Scaling Laws trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Ai Scaling Laws là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Ai Scaling Laws trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/vasilyu1983/AI-Agents-public/tree/main/frameworks/shared-skills/skills/ai-scaling-laws. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Ai Scaling Laws?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Ai Scaling Laws với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Ai Scaling Laws với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Ai Scaling Laws có miễn phí không?

Có. Kỹ năng này được vasilyu1983 phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇