Skip to content
mentoor

Topic 6 of 6 · 4 min read

From toy GPT to production models

Goal: List the steps missing between a tiny GPT and a usable chat assistant and say which of them dominate cost and effort.

Your tiny GPT has the same architecture idea as a frontier model; what separates them is data, compute, a better tokenizer and a long post-training stage that turns a text predictor into an assistant.

Check yourself · 1 of 3

What does post-training add to a pretrained language model?

Choose one answer

Why it matters

After building one, it is tempting to think the rest is just "make it bigger". It is not. Knowing which gaps are about scale and which are about different work tells you where real products spend money and where their quirks come from.

The steps between toy and assistant

  1. Tokenizer. Real models use byte-pair encoding (BPE) with vocabularies in the tens of thousands or more. Common words become single tokens, so the same text takes fewer positions than characters would. This is cheap to build and changes quality and cost directly.
  2. Architecture details. Production models replace learned position tables with rotary embeddings, use RMSNorm, grouped-query attention and other changes that cut memory and improve long-context use. Each is a small code change on top of what you wrote.
  3. Pretraining data. A model trained on one book learns that book. A large model trains on web pages, books and code, after heavy filtering and deduplication. Collecting and cleaning this data is a large share of the work and mostly invisible.
  4. Compute. Pretraining a large model needs many accelerators running for weeks, with sharded training across machines. The same loop you wrote, plus checkpointing, failure recovery and careful numerics.
  5. Post-training. The pretrained model completes text; it does not answer questions. Supervised fine-tuning on example conversations teaches the chat format, and preference training or reinforcement learning shapes helpfulness, refusals and tool use.
  6. Evaluation and safety. Benchmarks, red-teaming and regression suites decide whether a checkpoint ships.

Before and after

A weak plan: "scale our tiny GPT to 7 billion parameters and ship a chatbot." It skips the tokenizer, the data pipeline, the chat-format fine-tuning and evaluation. The result is a model that continues any prompt with plausible text and ignores the question.

A better plan names the missing stages, owns the data first, and starts from an open-weight base model when the budget does not cover pretraining.

Where to learn more

Karpathy's nanoGPT is a compact, readable GPT training script. His nanochat project shows a full pipeline, from tokenizer to pretraining, fine-tuning and a chat interface, in a small codebase. Reading either after your own version shows exactly what grows.

What goes wrong

  • Treating size as the whole story. A large model on poor data stays poor.
  • Skipping post-training. A base model is not an assistant.
  • Assuming a pretrained model can swap tokenizers. Its embeddings are tied to the original vocabulary.

Examples

Gap list for a tiny-GPT team

A team has a working 0.8-million-parameter character GPT and wants a support assistant. Their gap table:

Step Have Missing
Tokenizer 65 characters BPE vocabulary
Data one text file large cleaned corpus
Compute one GPU, minutes multi-GPU, long runs
Post-training none chat fine-tuning, preference tuning
Evaluation validation loss task benchmarks, human review

Because data and post-training dominate, the team starts from an open-weight base model and spends its effort on its own support data and evaluation.

Key points

  • Architecture is the smallest gap: the loop and blocks you wrote are the core of production models, with refinements such as rotary embeddings.
  • BPE tokenizers replace characters so the same text fits in fewer positions.
  • Data collection, filtering and scale usually dominate the effort of pretraining.
  • A pretrained model only continues text; post-training with example conversations and preference signals turns it into an assistant.
  • nanoGPT and nanochat are readable open projects for seeing each stage in code.

Common mistakes

  • Assuming that scaling the toy model alone produces an assistant.
  • Forgetting that data cleaning and post-training are separate, costly stages.
  • Swapping the tokenizer of a pretrained model without retraining its embeddings.
  • Reading validation loss as a measure of usefulness; it does not test instruction following.

Check yourself · 2 of 3

Why do production models use BPE instead of one id per character?

Choose one answer

Check yourself · 3 of 3

A team scales its tiny character GPT to a billion parameters trained on one novel. What is the likely result?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic