Tensorum

LLM Foundations

How large language models actually work, from tokens to next-token sampling.

AI EngineeringBeginner6 hrs4 key ideas · 5 topics
0%
your progress

Overview

How large language models actually work, from tokens to next-token sampling.

Key ideas

  • Text becomes tokens (BPE / SentencePiece); cost, latency and context limits are all counted in tokens.
  • Self-attention lets every token weigh every other token; cost grows quadratically with context length.
  • Pre-training learns language; instruction tuning and RLHF/RLAIF shape it into an assistant.
  • Decoding is sampling: temperature and top-p trade determinism for diversity.

Trade-offs

  • Bigger models reason better but cost more per token and respond slower.
  • Longer context is convenient but costlier and can dilute attention on what matters.

Topics

TokenizationSelf-attentionPre-training vs fine-tuningSamplingContext windows