AI-ENGINEERING
    intermediate

    Understanding Foundation Models

    AI Engineer path · lesson 55 of 124
    The idea
    Pretraining is reading the entire library and learning to finish any sentence. SFT is being taught that when someone asks a question you answer it. Preference tuning is learning which of two correct answers a person actually wanted. Same reader, three different kinds of schooling.
    How to use
    Drag the compute slider and watch the optimal model size and token count move together — then push the model bigger than optimal and see what the data budget has to give up.
    Pretraining corpora are dominated by whatever is abundant on the open web. That distribution is not a detail — it is the shape of everything the model is good and bad at.
    Language mix of a web-scale crawl (illustrative)
    English45.88%
    Russian5.97%
    German5.88%
    Chinese4.87%
    Japanese4.79%
    French4.73%
    Spanish4.47%
    Everything else (~100+ languages)23.41%
    ~46%
    English share
    100+
    languages in the tail
    ~23%
    share left for all of them
    What the distribution predicts
    A model is worst exactly where its training data was thinnest: low-resource languages, private domains (your internal wiki, your ticketing history), specialised professional corpora, and anything that happened after the data cutoff. Three of those four are fixed by retrieval, not by a better prompt — which is why "the model is not smart enough" is so often a misdiagnosis of "the model was never shown this."

    Key insight

    Curation is where the capability comes from. Two labs with identical architectures and identical compute produce noticeably different models, and the difference is almost entirely what they chose to train on and what they chose to throw away.

    How a chat model gets made

    Sequence

    Order the training stages.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    5 pieces left to place

    Test your knowledge

    20 questions
    Question 1 of 20
    Score: 0

    The pretraining objective for a foundation language model is:

    The short version

    Pretraining is reading the entire library and learning to finish any sentence. Supervised finetuning is being taught that when someone asks a question you answer it. Preference tuning is learning which of two correct answers a person actually wanted. Same reader, three different kinds of schooling.

    In more depth

    Understanding Foundation Models

    A foundation model is a next-token predictor trained on a very large corpus, then repaired by post-training into something usable.

    Training data determines the shape of capability

    Web-scale corpora are dominated by whatever is abundant online — English is roughly half, and 100+ languages share the tail. A model is worst exactly where its data was thinnest: low-resource languages, private domains, specialised corpora, and anything after the cutoff.

    Scaling laws

    Training compute is approximately C = 6ND (N parameters, D tokens). Compute-optimal training puts D ≈ 20N, so N = √(C / 120). A large model starved of data loses to a smaller one trained properly on the same budget.

    Production models are often over-trained past this point on purpose: training compute is paid once, inference compute is paid per call forever.

    Post-training

    1.Pretraining — trillions of unlabelled tokens. Produces a base model: fluent, knowledgeable, unhelpful.
    2.Supervised finetuning (SFT) — demonstrations of good answers. Produces an instruct model.
    3.Preference tuning (RLHF / DPO) — ranked response pairs. Produces an aligned model that is helpful, honest and willing to refuse.

    Reading a model size

    Parameters predict memory tightly, cost and latency loosely (MoE breaks the link), and capability badly. Data quality, token budget and post-training separate models at the same size.

    Interview Questions

    Google
    Meta
    OpenAI
    Anthropic
    OpenAI
    Anthropic
    Microsoft
    Google
    Meta
    Amazon
    Anthropic
    OpenAI
    Meta

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required