Skip to main content

Language Model Quick Reference

Short definitions of the language model terms that come up when you define an agent evaluation.

Read time
4 min
Scope
0 sections
Level
Starter / 1 of 4 in track

Outcome: Understand common terms before you define an agent evaluation.

Share
XLinkedIn

Reference guide

Short definitions of the language model terms that come up when you define an agent evaluation, and what each one means for a comparison.

Tokens

A model does not read words. Text is split into tokens, and each token is mapped to an integer. A token is often a word fragment, so a sentence usually has more tokens than words.

Context limits and provider prices are counted in tokens. When you compare two runs, compare their token counts as well as their scores.

Embeddings

Each token is mapped to a vector, a list of numbers. Tokens used in similar contexts end up with similar vectors. Retrieval systems use the same idea to find text that is close in meaning to a query.

Positional encoding

Attention has no built-in sense of word order, so position is added to the input.

  • Learned absolute positions: one vector per position, up to a fixed length.
  • Rotary (RoPE): rotates each vector by an angle that depends on its position.
  • Relative bias (ALiBi): lowers the attention score between tokens that are far apart.

Attention

For each token, the model computes a weighted mix of the other tokens in the context. The weights say which tokens matter for this one. Multi-head attention runs several of these computations in parallel, each with its own weights.

Transformer

A transformer is a stack of blocks. Each block has an attention layer and a feed-forward layer, with normalization and a residual connection around each. The last block outputs logits: one score for every token in the vocabulary.

Sampling

Sampling settings decide how the next token is chosen from the logits.

SettingWhat it does
TemperatureScales the logits. Lower values make the most likely token more likely. Zero always picks it.
Top-kSamples only from the K most likely tokens.
Top-pSamples from the smallest set of tokens whose probabilities add up to P.

With a temperature above zero, the same input can produce different outputs. Keep the sampling settings the same in the two runs you compare, and record them with the result.

KV cache

During generation the model stores the attention keys and values for tokens it has already processed. Each new token reuses them, so the model does not recompute the whole prefix. The cache trades memory for speed.

Long context

Attention cost grows with context length. Three common ways to handle long inputs:

  • Sliding window: each token attends only to a fixed number of recent tokens.
  • Sparse attention: each token attends to a chosen subset of positions.
  • Retrieval or memory: text is stored outside the context and fetched when needed.

Mixture of experts (MoE)

An MoE layer holds several feed-forward sub-networks, called experts. A router sends each token to a few of them, so only part of the model’s weights run for any one token.

Normalization and activation

LayerNorm and RMSNorm rescale the values that pass between layers so training stays stable. GELU and SiLU are activation functions: the nonlinear step inside each feed-forward layer.

Training objectives

  • Causal language modeling: predict the next token from the tokens before it. GPT-style models.
  • Masked language modeling: predict tokens that were hidden in the input. BERT-style models.
  • Sequence to sequence: read one sequence and generate another. Translation and summarization models.

Tuning methods

MethodWhat changes
Fine-tuningThe model’s weights are updated on examples of a new task.
LoRA and adaptersThe original weights stay fixed. A small set of added weights is trained.
RLHFThe model is optimized against a reward model trained on human ratings.
DPOThe model is optimized directly on pairs of preferred and rejected outputs.

Versalist uses none of these. It changes the skill an agent works from, not the model weights. See continuous learning.

Scaling laws

Training loss falls in a predictable way as parameters, data and compute grow together. Each doubling buys less than the one before it.

Quantization

Quantization stores weights at lower precision, for example 8 or 4 bits in place of 16. The model gets smaller and faster, and its outputs can change. GPTQ and AWQ are quantization methods. GGUF is a file format for quantized models.

Treat a quantized model as a different model. Do not compare its run with a run of the full-precision model as if only the skill changed.

Synthetic data

Synthetic data is training or test data that a model generated. It is cheap to produce and it repeats the generating model’s mistakes. Keep synthetic cases labelled and separate from cases a person reviewed.

Summary

A language model turns text into tokens, mixes information between tokens with attention, and predicts the next token. For an evaluation, three settings matter most: the model version, the token limits and the sampling settings. Record all three with every run you compare.

More guides

Keep going

Current track: Evaluation systems