- From text to numerical representation
A language model does not receive a sentence in the same form that we read it. A tokenizer breaks the text into smaller units called tokens. A token might represent a whole word, part of a word, or punctuation.
Token IDs are mapped to numerical vectors called embeddings. These provide representations the neural network can process. Information about token position also helps the model distinguish sequences such as “the dog chased the cat” and “the cat chased the dog.”
- Context changes interpretation
Consider these sentences:
- “She deposited money at the bank.”
- “She sat beside the river bank.”
The word “bank” appears in both, but its meaning changes with the surrounding words.
In a Transformer, self-attention allows a token’s representation to incorporate information from other relevant tokens. Multiple layers combine attention with further transformations, building representations that depend on context.
Attention is one component of this process. It should not be treated as a complete explanation of a model’s reasoning or as evidence that it understands language exactly as a person does. The original Transformer paper describes the architecture and its attention mechanism.
- How a response takes place
An autoregressive language model generates text incrementally. Given the input and the tokens generated so far, it produces scores for possible next tokens. A decoding procedure then selects the next token, and the process repeats.
For an illustrative prompt such as:
“The opposite of hot is…”
“cold” is a plausible continuation. For an open-ended question, many continuations may be reasonable.
This also helps explain why the same question can produce different wording across attempts: generation can involve sampling rather than always selecting one fixed continuation.
- Why exact output needs a closer look
There are at least three different things we might mean by an exact answer:
- Relevant: It responds to the question.
- Well formatted: It follows the requested structure.
- Factually correct: Its claims are accurate.
A response can satisfy the first two and fail the third. Even a system that reliably follows an output schema can still make mistakes in the values it produces. Clear instructions and valid formatting therefore do not establish factual correctness.
- A small experiment to explore context
Try these prompts in the same language model:
- “What does ‘bank’ mean in ‘She waited beside the river bank’?”
- “Explain that meaning in one sentence for a ten-year-old.”
Compare whether the model recognizes ambiguity, uses the supplied context and adapts its explanation to the audience.
This is a proposed learning exercise, rather than a benchmark. A few successful responses cannot establish general language understanding.
What interests me most is how numerical representations support useful language behaviour—and where that behaviour becomes unreliable. Understanding both sides is essential when moving from studying neural networks to building applications with them
References
Loading article