GPT-2 · RoBERTa Lab · Reference page

Course
glossary

The words this course uses, with the meaning they have in machine learning — and the meaning, often quite different, that the same words already had in the rest of IT.

Reference page · read right after the map Before: chapter 00, the course map

1 Why a glossary

The field of language models borrowed a large part of computing's vocabulary. Token was already the unit a compiler splits off when it reads source code, the credential a server issues after login, and the asset recorded in a blockchain contract. Layer was already a level of the OSI model. Model was already a database's data model and the "M" in the MVC pattern. None of those meanings stopped being valid.

This course uses these words in their machine-learning sense, and that sense is neither the only one nor the oldest. Someone coming from networking, databases, security or software development reads "token", "mask" or "cache" with another meaning in mind — and is right to. This glossary exists so that reading does not depend on guessing which meaning is in use.

How to read each entry

In this course is the meaning used in the chapters, in machine learning. In other areas of IT are the most common meanings of the same word outside that field, with the discipline in parentheses. Chapters are the chapters where the term appears. When the meaning is the same in both columns, the entry says so.

2 Text and representation

termin this coursein other areas of ITchapters
tokenthe piece of text the model handles as a single unit — it can be a whole word, part of one, or even a byte. Each piece has an ID number. house is one piece; produtividade is fouran access credential issued after authentication, such as a JWT (security); the lexical unit a compiler's scanner splits off, such as a keyword or identifier (compilers); a digital asset recorded in a contract (blockchain); a physical authentication device (security)01–16
tokenization, tokenizercutting text into those pieces, before the model sees anything. The tokenizer is the program that does it, working from a fixed list of pieces, decided before training and never changed againreplacing sensitive data, such as a card number, with a meaningless surrogate value (payment security); the lexical analysis stage (compilers)00, 01, 04, 06, 08–11, 13, 15, 16
vocabularythe complete list of pieces the tokenizer knows — and it is closed: nothing outside it exists for the model. In GPT-2 there are 50,257 piecescontrolled vocabulary: a standardized list of terms for classifying information (ontologies, semantic web)00–02, 06–10, 12, 13, 16
embeddingthe translation of a piece of text into numbers. Each token becomes a list of numbers the model learned on its own during training, and words with similar meanings end up with similar lists. The table holding all those lists is also called an embeddingan embedded system (hardware); embedding external content in a page, such as a video (web)00–02, 05, 06, 11, 14–16
vectora list of numbers in order, treated as a point in space. Because a point has a position, two vectors have a distance and an angle between them — and that is how the model measures whether two things are alikea data structure with elements in contiguous positions, the array (programming); an interrupt vector (operating systems); a vector image (computer graphics)01–05, 11, 12, 14, 16
dimensioneach slot inside a vector. If the vector is a list of 768 numbers, it has 768 dimensions; that is the size of GPT-2 smalla dimension table, describing facts in a data warehouse (dimensional modelling); the size of a screen or image in pixels (interfaces)00, 02–05, 11, 12, 14
encodinghere, almost always positional encoding: the extra number that tells the model where in the sentence a piece sits. Without it, the dog bit the man and the man bit the dog would be identical to it. Formally, a vector added to the embeddingcharacter encoding, such as UTF-8 (systems); an audio or video compression format, the codec (multimedia)00, 07, 15, 16

3 Model architecture

termin this coursein other areas of ITchapters
modelthe whole trained program: it takes tokens and returns, for every possible piece, the chance of it coming next. In practice it is two things together: the design (the architecture) and the learned numbers (the weights)a data model, such as entity-relationship (databases); the "M" in the MVC pattern, the layer holding the data (software engineering); a software development process model (software engineering)00–16
layera block of computation repeated, identically, several times — the output of one is the input of the next. GPT-2 small stacks 12 Transformer blocks, and each block holds an attention and a small network that processes each position on its own (the MLP)a level of the OSI model or the TCP/IP stack (networking); a tier of a layered architecture, such as presentation, business and data (software engineering)00–06, 09, 11–15
attentionthe operation that lets each word look at the others in the sentence and decide which ones it depends on. In the dog I saw yesterday barked, it is what links barked to dog, not to yesterday. Technically: an average of the other tokens, weighted by what each one containsno technical meaning outside the field; the name comes from the idea of focus and does not describe human attention00–11, 14–16
headtwo things share the name. (1) One of the attentions running in parallel inside the same layer — each learns to notice a different kind of relation. (2) The last piece of the model, which turns numbers into odds for each word: the “language head”a disk's read/write head (hardware); HEAD, the reference to the current commit in Git (version control); the HTTP HEAD method (web)00, 03–06, 10–12, 14, 15
maskwhat stops the model from seeing what it should not. In GPT it hides the future: predicting word 5, it cannot look at word 6 — otherwise it would not be predicting, it would be copying. In BERT it is the opposite: it hides a word in the middle of the sentence and asks the model to guess ita subnet mask (networking); a bitmask (programming); an input mask that formats a field (interfaces)00, 03, 04, 08, 10, 11, 13–16
encoder, decoderthe two ways to build a Transformer. Encoder: every word sees the whole sentence, ideal for understanding — that is BERT. Decoder: every word sees only what came before, necessary for writing — that is GPT. The difference fits in one line of codecharacter or media encoder and decoder (systems, multimedia); a rotary encoder that measures position (hardware)00, 04, 09–16
parametereach number the model adjusted on its own during training; everything it “knows” lives in them. GPT-2 small has 124 million. What you choose before training is not a parameter, it is a hyperparametera value passed to a function or command (programming); a configuration option of a system (systems administration); a query parameter in a URL (web)00, 02, 03, 05–09, 11–13, 15, 16
weightthe most common kind of parameter: the number an input gets multiplied by. When someone says “I downloaded the model's weights”, that is the file with all those trained numbersthe weight of an edge in a weighted graph (algorithms); a distribution weight in a load balancer (networking)00–07, 10, 12–15
biasthe number that is added after the multiplication by the weights — the b in Wx + b. It shifts the result. Nothing to do with the other sense of bias, the one about prejudice, which is in the column beside italgorithmic bias: an outcome that systematically favours or harms a group (data ethics)01, 06, 09, 15
normalizationrescaling a list of numbers so they sit in a similar range, with no giant values next to tiny ones. That keeps training stable; in the Transformer it is LayerNorm, which rescales each vector to a controlled mean and spreadnormal forms, which remove redundancy from tables (databases); Unicode normalization, which unifies equivalent characters (systems)04–07, 09, 14, 16
statethe hidden state: how a piece of text is represented after it has been through the layers. Same word, but now carrying the context of the whole sentencethe state of a program or of a state machine (programming); session state (web)00–03, 05, 07, 16

4 Training and evaluation

termin this coursein other areas of ITchapters
training, pre-trainingadjusting the parameters, little by little, so the model gets things wrong less often. Pre-training is the long, general phase — reading a lot of text and learning the language — done before any specialisationtraining people to use a system (IT management)00–06, 08–16
fine-tuningtaking an already pre-trained model and continuing to train it, now with data from one specific task. Cheaper than starting from scratch, because it already knows the languageperformance tuning of a database or an operating system (systems administration)00, 06, 08–12, 14, 15
lossthe error score: a single number saying how wrong the model was, which training pushes down. When it stops falling, training stopped learning. Here it is computed with cross-entropypacket loss (networking); lossy compression (multimedia)00, 08, 09
entropyhow unsure the model is. Low when it bets almost everything on one word; high when it spreads the bet across many. In good morning, how are… entropy is low — you is nearly certain. Formally: the measure of uncertainty of a probability distribution, in Shannon's sense, counted in bitsthe same mathematical sense, applied to the randomness an operating system gathers to generate random numbers and to the strength of a password (security)03, 04, 07, 08, 15
gradienttraining's compass: for each parameter, it says which way to move it, and how much, to reduce the loss. Technically, the vector of derivatives of the loss with respect to each parametera smooth transition between colours (design, CSS)02, 03, 05, 09, 15
epochone complete pass through all the training material. Two epochs = the model saw every example twicethe Unix epoch, 1 January 1970, the zero point of time counting (operating systems)08, 10, 13
batchthe handful of examples processed in one go, rather than one at a time. Doing it in groups uses the machine far betterbatch processing: jobs run in sequence, without interaction (operating systems)00, 01, 05, 10, 14
checkpointa copy of the weights saved partway through, so you can resume from there if something goes wrong, or compare versions and keep the best onethe point where the transaction log is written to disk (databases); a snapshot of a virtual machine's state (virtualization)13
precisionhere, how many bits hold each number: float32 uses 32, float16 uses 16. Fewer bits = less memory and more speed, with slightly less exactness. A very different sense from “precision” in statistics, which is beside ita classification metric: of the cases marked positive, how many really were (statistics, system evaluation)02, 04, 11, 15
logitthe raw score the model gives each possible word, before it becomes a percentage. It can be negative, and the scores do not add up to 100 — what turns them into odds is the softmax, the function that squeezes every score onto a 0-to-1 scale summing to 1in statistics, the function log(p / (1 − p)); neural-network usage extends the name to any score before normalization00, 02, 05–08, 12, 13, 15, 16

5 Generation and execution

termin this coursein other areas of ITchapters
inferenceusing the finished model to produce an answer. The opposite of training: no parameter changes, you only read what was already learnedderiving new facts from rules (expert systems, logic); type inference by the compiler (programming languages); a conclusion about a population from a sample (statistics)00, 05, 10, 14
promptthe text you hand the model to continue. It is not a command: it is the beginning of something it will completethe command-line sign that waits for a command, such as C:\> or $ (operating systems)01, 05–09, 11, 15
contexthow much text the model can have in front of it at once. GPT-2 sees 1,024 tokens, and not one more — a limit built into its shape, not a settinga context switch between processes on the CPU (operating systems); a program's execution context (programming)00–02, 04–12, 16
temperaturethe daring dial for writing. Near zero the model always picks the likeliest word and turns repetitive; above 1 it takes more risks and sometimes goes off the rails. Technically, the number that divides the logits before the softmax; the name comes from statistical physicsthe operating temperature of a component, such as the CPU (hardware)00, 03, 07, 12, 14, 16
samplingdrawing the next word according to the odds, instead of always taking the likeliest one. It is what makes the same prompt give different answers each timethe sampling rate of an audio signal (multimedia); a sample of a population in a survey (statistics)00, 05–08, 13, 15, 16
cachehere, the KV cache: the model keeps the attention work already done for earlier words, so it does not redo everything for each new word. Without it, writing a long text gets unbearably slowfast CPU memory; a local copy of HTTP responses; stored query results (hardware, web, databases). The principle is the same: keep it so it is not recomputed04, 06, 10, 11, 13–15
kernela computation routine written to run fast on the graphics card — CUDA kernels. (In chapter 05 the word appears in another sense, the similarity function of an SVM: a classification method that predates deep neural networks)the core of the operating system (operating systems)00, 05, 13, 14
server, serving“serving a model” means keeping it up, waiting for requests and answering — like any other service on the internet. It is the difference between having the model on disk and having the model in usethe same sense as a web or application server (networking); only what is served changes00, 13–15
References

The machine-learning definitions follow the field's general reference; the other meanings follow each discipline's standard or reference text.

  1. Goodfellow, I., Bengio, Y. and Courville, A. (2016). Deep Learning. MIT Press. deeplearningbook.org
  2. Aho, A. V., Lam, M. S., Sethi, R. and Ullman, J. D. (2006). Compilers: Principles, Techniques, and Tools. 2nd ed., Addison-Wesley. Chapter 3, lexical analysis.
  3. Jones, M., Bradley, J. and Sakimura, N. (2015). JSON Web Token (JWT). RFC 7519, IETF. rfc-editor.org/rfc/rfc7519
  4. Hardt, D. (2012). The OAuth 2.0 Authorization Framework. RFC 6749, IETF. rfc-editor.org/rfc/rfc6749
  5. Vogelsteller, F. and Buterin, V. (2015). ERC-20: Token Standard. Ethereum Improvement Proposals, EIP-20. eips.ethereum.org/EIPS/eip-20
  6. PCI Security Standards Council (2011). Information Supplement: PCI DSS Tokenization Guidelines.
  7. ISO/IEC 7498-1:1994. Information technology — Open Systems Interconnection — Basic Reference Model.
  8. Codd, E. F. (1970). A Relational Model of Data for Large Shared Data Banks. Communications of the ACM, 13(6), 377–387.
  9. Kimball, R. and Ross, M. (2013). The Data Warehouse Toolkit. 3rd ed., Wiley.
  10. Yergeau, F. (2003). UTF-8, a transformation format of ISO 10646. RFC 3629, IETF. rfc-editor.org/rfc/rfc3629
  11. Mogul, J. and Postel, J. (1985). Internet Standard Subnetting Procedure. RFC 950, IETF. rfc-editor.org/rfc/rfc950
  12. IEEE and The Open Group. POSIX.1 (IEEE Std 1003.1), definition of "Seconds Since the Epoch".
  13. Shannon, C. E. (1948). A Mathematical Theory of Communication. Bell System Technical Journal, 27, 379–423 and 623–656.

Next: chapter 01 — Tokenization and BPE.
A term missing, or a meaning from another area that deserves to be here? The glossary grows with the course.