Course / 08

Natural Language Processing

This course is being revised. The available retrieval lesson uses an original fictional corpus and a reproducible Python example.

For the retrieval example, basic Python and an understanding of averages are enough. Other topics will return after their source review and revision.

  1. Text
  2. Classical NLP
  3. Representations
  4. Sequences
  5. Transformers
  6. Pretraining
  7. Scaling
  8. Modern architectures
  9. Adaptation
  10. Tasks
  11. Post-training
  12. Inference
  13. LLM Systems
  14. Beyond left to right
  1. 01

    Text Foundations

    How text becomes model input, and how a result is measured.

    After this section: Turn text into tokens and splits that keep Unicode, labels and evaluation intact, and say in what unit a loss or perplexity is measured.

    4 of 4 notes published
  2. 02

    Classical NLP

    Counting words is a strong baseline; counting sequences gives the first language model.

    After this section: Build a TF-IDF classifier and a smoothed n-gram model: two strong baselines for two different questions.

    2 of 2 notes published
  3. 03

    Distributed Representations

    From one-hot vectors to dense vectors that carry meaning.

    After this section: Explain which contexts and subwords update which vectors, and what a static vector cannot express.

    4 of 4 notes published
  4. 04

    Neural Sequence Models

    Models that read a sequence, and the bottleneck that attention removes.

    After this section: Separate local patterns, recurrent state and alignment, and teacher-forced training from decoding.

    5 of 5 notes published
  5. 05

    Transformers

    Attention as the only mixing operation, and what it takes to make that work.

    After this section: Compute one attention row by hand and trace masks, shapes and the shifted target through a Transformer.

    4 of 4 notes published
  6. 06

    Pretrained Language Models

    Training objectives that turn unlabeled text into reusable models, and what their successors changed.

    After this section: Tell an architecture from a pretraining objective, a training procedure and the data: masked, causal, replaced-token detection.

    4 of 4 notes published
  7. 07

    Scaling and LLM Pretraining

    How large to make a model, how long to train it, and on what text.

    After this section: Split a compute budget between parameters and tokens, and explain how cleaning, deduplication, decontamination and the data mixture shape what a model learns.

    2 of 2 notes published
  8. 08

    Modern Transformer Architectures

    Attention that moves less memory, and models that hold more parameters than each token uses.

    After this section: Explain what FlashAttention changes (memory traffic, not the result) and count total against active parameters in a mixture of experts.

    1 of 1 note published
  9. 09

    Adapting Pretrained Models

    One pretrained backbone, many tasks: what to train and what to freeze.

    After this section: Choose between frozen features, full fine-tuning and parameter-efficient methods by what each trains and what it costs.

    1 of 4 notes published
  10. 10

    NLP Tasks

    Shared pretrained representations with a task-specific output: a classifier, tagger or span head, or a decoder that generates the answer.

    After this section: Pick the output structure each task needs, and compare models only on a shared protocol.

    0 of 6 notes published
  11. 11

    LLM Post-training

    From a base model to an assistant: supervised fine-tuning and preference optimization.

    After this section: Name the data and objective of each training stage, and trace the RLHF pipeline and what DPO removes from it.

    0 of 4 notes published
    • Instruction tuning and alignmentPlanned
    • The stages of LLM trainingPlanned
    • RLHFPlanned
    • DPOPlanned
  12. 12

    Efficient Inference

    Running a trained model with less memory and time.

    After this section: Estimate the memory of the weights and the KV cache, and what quantization saves in latency and throughput.

    0 of 3 notes published
    • QuantizationPlanned
    • GPTQPlanned
    • Memory, latency and throughputPlanned
  13. 13

    Modern LLM Systems

    Systems built around a language model, and how to evaluate the whole system.

    After this section: Evaluate retrieval, generation and tool use separately, and then the whole system.

    1 of 5 notes published
  14. 14

    Advanced Generation

    Generating text without a left-to-right order.

    After this section: A branch, not a remedy: generate text in an order other than left to right, and compare it with masked and causal models.

    0 of 1 note published
    • Non-autoregressive generation and text diffusionPlanned