← All courses ← Course home

Lesson 04 of 12 · Phase 2 Model Internals

Scaling laws, data, and synthetic data

Data is the silent bottleneck. Use scaling-law intuition and generate synthetic instructions without lying to yourself about quality.

Agent brief (llms.md)

Scaling-law talk is cheap when nobody logged tokens and compute. Scaling Laws for Neural Language Models is the well-known title for the idea that loss tracks scale in a regular way across model size, data, and compute. You will not reproduce the original plots. You will learn to stop treating data as an afterthought.

Synthetic data is a tool. It is not a substitute for a quality bar. If you generate instructions with a larger model, you inherit that model's failures. Type the rows. Filter them. Keep a human slice.

Coding: typed synthetic instructions


from pydantic import BaseModel, Field, ValidationError

class SyntheticInstruction(BaseModel):
    instruction: str = Field(min_length=8)
    input: str = ""
    output: str = Field(min_length=1)
    source: str = "synthetic"
    quality: float = Field(ge=0.0, le=1.0)

def accept_row(raw: dict, min_quality: float = 0.6) -> SyntheticInstruction | None:
    try:
        row = SyntheticInstruction.model_validate(raw)
    except ValidationError:
        return None
    if row.quality < min_quality:
        return None
    if row.output.strip() == row.instruction.strip():
        return None
    return row

Write a generator that emits JSONL. Reject empty outputs, copied instructions, and quality below your threshold. Store source so you can drop the synthetic slice later. That is intelligent use: typed, filtered, attributed.

Topics

Assignment

Opinion checkpoint

Write this down. Synthetic data without a schema and a reject rule is spam with extra steps. Scaling-law language without a token budget is tourism.

Next: Pretrain a small language model.

Key concepts

  • Loss tracks scale only if you count tokens and compute honestly.
  • Synthetic rows need a schema, a filter, and a source tag.
  • Packing and contamination change the story your curve tells.
  • A token budget is arithmetic you write before you launch.

Takeaways

  • Ship typed JSONL and a reject count.
  • Keep a human slice you are willing to read aloud.
  • Do not invent a scaling exponent. Log what you ran.