Language Models and Adaptation
Explore how language models predict text, adapt to a task, and earn trust through testing.
A language model converts text into tokens, combines context and predicts the next token. Training, adaptation and runtime prompting change different parts of that process.
How can one token change the next prediction?
Context: “For our picnic, we packed”
→Score possible next token pieces
→Select one token and append it
→Recompute from the extended context; fluency does not verify facts
What you will be able to do
Compare adaptation with a baseline and report retained capabilities, failures and evaluation exposure.
Neural-network basics, probabilities and vectors. The tiny models are bounded teaching systems. You can open any lesson directly; preparation is guidance, not an access requirement.
Finding your saved place…
Your course
4 modules · 12 lesson placements. Shared lessons retain one saved-work identity.
Module 1: Tokens attention and architecture
- Starting information
Text split into token pieces
- Relationship or operation
Combine allowed context through attention
- Consequence
Scores for the next token
Tokens are model input units; attention combines information from positions. A decoder's causal mask excludes future text.
- Choose the pieces a model predicts
Compare tokenization tradeoffs, distinguish fitting from encoding, and calculate a smoothed next-token probability without confusing tokens with meanings.
- Compare normalize and combine
Compute a small attention example and explain why causal masking blocks future positions.
- Follow a token through a Transformer
Trace embeddings, two attention heads, normalization, residuals, feed-forward layers, logits, and decoding; explain the KV cache.
Module 2: Training and data
- Starting information
Partitioned text examples
- Relationship or operation
Train next-token predictions; select tokens at generation time
- Consequence
A generated sequence under a chosen sampling rule
Training changes parameters using corpus examples. Sampling chooses from the resulting distribution and does not verify its factual content.
- Predict the next token
Calculate target-token loss, identify future leakage, and explain why teacher-forced scores do not replace free-running task evaluation.
- Prepare a text corpus
Prepare a traceable document split, fit a vocabulary without development leakage and justify filtering and mixing choices with evidence.
- Train a tiny language model
Connect simultaneous gradient updates to sequence loss and generated behavior, while separating learned dependencies from failures on held-out combinations.
- Choose how to sample
Trace a sampled token through temperature and filtering, then compare validity, useful diversity, repetition and exact training overlap without changing model weights.
Module 3: Adapting and aligning behavior
- Starting information
A pretrained model plus task or preference examples
- Relationship or operation
Choose which parameters and objective to update
- Consequence
Adapted behavior with possible regressions
Post-training objectives are proxies for desired behavior. Compare improvements and retained capabilities under declared data conditions.
- Adapt a pretrained model
Distinguish context changes from parameter adaptation, explain a low-rank update and evaluate its effects without treating conflicting task targets as unrelated forgetting.
- Learn from preferences
Explain the optimized preference objective, separate predicted preference from factual correctness and identify missing evidence or features.
- Connect instruction tuning preference learning and verified rewards
Identify the supervision and objective behind three post-training methods, reproduce a small update and separate optimized reward from independently specified task success.
Module 4: Using and testing language models
- Starting information
A model response and a real task contract
- Relationship or operation
Check support, constraints and known evaluation exposure
- Consequence
A justified use, revision or abstention
A fluent response is not automatically useful or correct. Evaluation must reflect the requested task and its consequences.
- Use a pretrained model responsibly
Check model/tokenizer compatibility and input/output limits, then distinguish valid output shape from a supported answer.
- Evaluate language tasks with real evidence
Freeze a source-backed evaluation protocol, report per-case outcomes and rater disagreement, and retain known exposure when revising a candidate.
Language adaptation project
Compare adaptation with a baseline and report retained capabilities, failures and evaluation exposure. Use the project brief to check the required evidence, submission conditions and any separate assessment before you begin.
Open the project brief and evidence requirementsLesson completion records participation. A submitted report, a passed practice check and independently reviewed implementation are different outcomes. Course paths count required courses; optional branches remain separate.