Mayank SaxenaExplainers

How models work · explainer

Why AI Reads Past Your Typos and Hears Past the Noise

Type “I defintely recieved the pakage” and a chatbot answers as if you had spelled it right. Mumble “cheesecake” into a transcription app and it usually writes cheesecake, unless you were saying something else. Both come from one old idea: weigh what arrived against what would make sense. This post walks through it, with measurements on two open models, and shows where the same trick goes wrong.

Mayank SaxenaExplainer, with a small experiment

In short

01What the model actually receives

Before a language model reads anything, a tokenizer cuts the text into pieces from a fixed vocabulary of about 100,000 to 200,000 chunks. Common words are one piece; rare words are split into several (Sennrich et al. 2016). The model only ever sees the numbers of these pieces.

A typo does not reach the model as a “wrong letter”. It changes the pieces. Try it below with two real tokenizers: the one used by GPT-4o and the one used by the Qwen2.5 models I test later.

A typo swaps one familiar piece for a few odd ones

The same sentence, cut into tokens by two real tokenizers. Each box is one token; ␣ marks a leading space.

Figure 1: “definitely” is one token; “defintely” becomes three. The model has to work out from those three pieces that they mean the same word. The row at the bottom is the surprise: misspellings like “recieved” and “definately” are frequent enough in web text that the tokenizer learned them as whole tokens.

That bottom row is a clue to the first half of the answer. Tokenizers learn their vocabulary by merging the letter sequences that show up most often in training text. If “recieved” earned its own token, the model has read it many thousands of times, nearly always in sentences where it meant “received”. To the model, a common misspelling is closer to a synonym than to an error.

Rarer typos do not get that shortcut. For those, the model needs the second half of the answer: context.

02One idea explains both: the noisy channel

In 1948 Claude Shannon described communication as a message passing through a noisy channel (Shannon 1948). Decades later, spelling correctors and speech recognisers were built on the same picture (Bahl et al. 1983; Kernighan et al. 1990). You meant something. Your fingers or a noisy room garbled it. The reader’s job is to guess what you meant.

The noisy channel: guess the message, not the signal

The same picture works for a keyboard and a microphone.

What you meant “received” Noisy channel fingers slip, rooms are loud What arrived “recieved” The reader picks the guess with the highest how well it explains what arrived × how much sense it makes on its own
Figure 2: Two separate questions. The first is about the noise (is “ie” for “ei” a common slip?). The second is about language (is this a word people write here?). A language model is, at its core, a machine for answering the second.

In symbols, with w a candidate meaning and x what arrived:

best guess = the w with the largest  P(x | w) × P(w | context)

The first factor is about the channel: how likely is it that someone meaning w produced x? The second is the prior: before looking at the noisy input at all, how likely is w here? A language model is trained on trillions of words to predict the next one, so it carries an extremely good prior.

02.1A typo that is also a real word

The hardest typos are real words, like “form” for “from”. No dictionary flags them. Only the context can. Below, the prior comes from a real model, Qwen2.5-1.5B: I asked it how likely each full sentence is. The typing-error numbers are a simple assumption: you almost always type what you mean, and swapping two letters is a small but real risk.

The same typed word, two different readings

Switch the context. The letters typed do not change, so the first column stays the same; the language model’s view of the sentence does.

Figure 3: In “I got a letter form my bank”, the letters point to form, but the sentence makes almost no sense with it, so from wins. In the paperwork sentence, both factors agree on form. Middle column measured with Qwen2.5-1.5B (sentence probabilities, rescaled over the four options); left column assumed.

A chatbot does not run this as an explicit formula. It reads your whole message and predicts a reply. But the effect is the same, because the model has learned, from its training text, what people usually mean when they write “form my bank”.

03How much do typos really cost? A small test

To see how far this goes, I took 20 short fill-in-the-blank prompts such as “The capital of France is …” and checked whether a model’s top guess for the next word was the right answer. Then I damaged the prompts at three levels: one typo (two neighbouring letters swapped in the longest word), a typo in every word of four or more letters, and every such word scrambled with only its first and last letters kept. Each damaged version was drawn three times with different random typos, so each bar is 60 prompts. I ran this on two sizes of the same open model family, Qwen2.5 (Appendix A has the details).

One typo is nearly free for the larger model; typos everywhere are not

Share of 60 prompts where the right answer was the model’s single most likely next word. Labels: Qwen2.5-1.5B.

Figure 4: The larger model shrugs off a single typo (51 → 49 of 60); the smaller one drops from 42 to 32. With every word damaged, both fall apart. These are small models; the scrambled sentences that sink them here are ones GPT-4 could almost perfectly repair in earlier work (Cao et al. 2023).

Two patterns are worth taking away. First, a single typo in an otherwise clear sentence costs a large model almost nothing, because the rest of the sentence carries the meaning. Second, the larger of the two models held on to more answers at every level. Two sizes are not a trend, but the direction is the one you would expect. Cao and colleagues found the extreme end of this: GPT-4 could reconstruct sentences in which every word was scrambled, cutting the edit distance to the original (the number of letter changes needed to get back to it) by 95% (Cao et al. 2023).

You can browse the prompts below and see what each model guessed.

Browse the prompts

One random draw of typos per prompt. Top: Qwen2.5-1.5B. Faded: Qwen2.5-0.5B.

Figure 5: Browse a few and a pattern shows: the guess often survives a typo in one word, and breaks once the word that carries the meaning (“Frnace”) is damaged too. When it survives, it usually does so with less confidence.

03.1What happens inside

If the model sees “def”, “int”, “ely”, where does “definitely” come back? Kaplan and colleagues looked inside several open models and found that the early and middle layers rebuild whole words from their pieces. After a few layers, the model’s internal state at the last piece looks like the state it would have for the whole word. This works for words split in odd places, for words outside the vocabulary and, less reliably, for typos (Kaplan et al. 2025). In effect, the model keeps an inner dictionary that is larger and more forgiving than its tokenizer.

Pieces in, word out: the model rebuilds words in its early layers

A schematic of the finding in Kaplan et al. (2025), not a measurement from this post.

early layerslater layers ␣defintely reads as the worddefinitely reads as a piece“ely”
Figure 6: Attention lets the last piece gather information from the pieces before it. Kaplan et al. found that most split words are rebuilt within a few layers (often three to five, sometimes up to fifteen), after which the last piece can be decoded as the full word.

04Hearing: the same trick with sound

Speech is a noisier channel than a keyboard. Accents, background noise and words that sound alike mean the audio alone often cannot decide. Classic speech recognisers had a separate acoustic model and language model and multiplied their scores, exactly as in Figure 2 (Bahl et al. 1983).

Modern systems like OpenAI’s Whisper fold both into one network (Radford et al. 2022). An encoder turns the audio into a sequence of vectors. A decoder, which is a language model, then writes the transcript one token at a time, looking back at the audio vectors at every step. Because it was trained on 680,000 hours of audio with transcripts, the decoder has learned what people tend to say as well as how it sounds.

A speech model is a language model that listens

The structure of an encoder–decoder recogniser such as Whisper, simplified.

sound spectrogram (frequencies over time) Encoderaudio → vectors Decoder = language modelwrites text, one token at a time For dessert we shared a slice of
Figure 7: Each new word is chosen from both sources at once: the audio (through attention to the encoder’s vectors, blue lines) and everything written so far. The second source is why the model prefers sentences that make sense.

Here is the cheesecake case. The muffled sound fits “cheesecake” best, “cheese cake” nearly as well, and “Jesus’ sake” only loosely. Switch the context and see what wins.

What you heard depends on what was said before

Pick an example, then switch the context. Sound scores are assumed for illustration; sentence scores are measured with Qwen2.5-1.5B.

Figure 8: In a dessert sentence, the sound and the sentence agree on cheesecake. After “Oh, for …”, the language model is so sure of Jesus’ sake that it overrides a sound that leaned the other way. The classic “recognize speech” versus “wreck a nice beach” works the same way.

05When the prior wins too much

A strong prior is a bet that you said or typed something ordinary. Most of the time that bet pays. It loses in three predictable places.

05.1Rare names and jargon get “corrected”

Katelyn, Kaitlyn and Caitlin sound identical. With nothing else to go on, a transcriber writes the spelling it has seen most often, whatever your colleague’s name actually is. The same happens to product names, drug names and technical terms that sound like common words. The fix follows from the formula: give the model a better prior. Whisper accepts a text prompt that it treats as earlier transcript, and OpenAI suggests using it to list unusual names and acronyms (OpenAI docs).

Same sound, different spelling: give the model a hint

The sound score is identical for every spelling, so the prior decides alone. Measured with Qwen2.5-1.5B.

Figure 9: With no hint, the model picks a spelling from habit. Put the name in the context, as a list of meeting attendees or a transcription prompt, and the same audio comes out spelled your way.

05.2Silence filled with fluent text

When the audio carries little or no speech, the first factor stops helping and the decoder is left with only its prior: what text usually comes next. A study of Whisper found that about 1% of transcriptions contained whole phrases or sentences that were never spoken, often during long pauses, and that nearly 40% of those were harmful in some way, such as invented violence or false associations (Koenecke et al. 2024). Fluency is not evidence that the words were said.

05.3Exact strings are invisible

The flexibility that hides your typos also hides spelling itself. Because the model sees “strawberry” as one or a few tokens rather than ten letters, questions about letters, such as how many r’s it contains, are hard in a way that reading the word is not (Kaushal & Mahowald 2022). For the same reason, a model may quietly “fix” a typo in code, a product code or a password-like string that was meant to be exactly that.

06What this means in practice

The same principle runs through all of it: the model reports the most likely message, not the literal signal. That is why it reads past your typos, and why it sometimes reads past what you really meant.

Methods

How the measured numbers on this page were produced.

Appendix A: the typo test (Figures 4 and 5)
ModelsQwen2.5-0.5B and Qwen2.5-1.5B, base (not chat) versions from Hugging Face (Qwen Team 2024), run on CPU in bfloat16 with the transformers library.
Prompts20 one-line fill-in-the-blank prompts with an unambiguous next word, listed in data/figures.js.
DamageOne typo: in the longest word, two neighbouring interior letters swapped. Every word: the same in every word of four or more letters. Scrambled: in every such word, the interior letters shuffled, first and last kept. Three random draws per prompt and level (seeds fixed), so 60 prompts per bar.
ScoreWhether the first token of the expected answer (for example “ Paris”) is the single most likely next token. A strict test: a model that would answer “the cheetah” after a different first token counts as wrong.
LimitsSmall models, a small and easy prompt set, and synthetic typos. Real typos are less random (doubled or missing letters, phone keyboards), and chat models usually see far more context than one line.
ModelSpelled correctlyOne typoEvery wordScrambled
Appendix B: the context demos (Figures 3, 8 and 9)

For each context sentence, I filled in every candidate and asked Qwen2.5-1.5B for the probability of the whole sentence (the sum of its token log-probabilities, starting from the start-of-text token). The middle columns show these probabilities rescaled to sum to 100% over the candidates. The typing-error and sound scores in the left columns are not measured; they are stated assumptions chosen to be plausible, so the figures show how a prior and a channel combine rather than what any product outputs. Full numbers are in data/figures.js.

References

  1. Bahl, Jelinek, Mercer (1983). A Maximum Likelihood Approach to Continuous Speech Recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence 5(2). doi:10.1109/TPAMI.1983.4767370
  2. Cao, Kojima, Matsuo, Iwasawa (2023). Unnatural Error Correction: GPT-4 Can Almost Perfectly Handle Unnatural Scrambled Text. EMNLP 2023. arXiv:2311.18805
  3. Kaplan, Oren, Reif, Schwartz (2025). From Tokens to Words: On the Inner Lexicon of LLMs. ICLR 2025. arXiv:2410.05864
  4. Kaushal & Mahowald (2022). What do tokens know about their characters and how do they know it? NAACL 2022. arXiv:2206.02608
  5. Kernighan, Church, Gale (1990). A Spelling Correction Program Based on a Noisy Channel Model. COLING 1990. aclanthology.org/C90-2036
  6. Koenecke, Choi, Mei, Schellmann, Sloane (2024). Careless Whisper: Speech-to-Text Hallucination Harms. ACM FAccT 2024. arXiv:2402.08021
  7. OpenAI. Speech to text guide: prompting. platform.openai.com/docs/guides/speech-to-text
  8. Qwen Team (2024). Qwen2.5 Technical Report. arXiv:2412.15115
  9. Radford, Kim, Xu, Brockman, McLeavey, Sutskever (2022). Robust Speech Recognition via Large-Scale Weak Supervision. arXiv:2212.04356
  10. Sennrich, Haddow, Birch (2016). Neural Machine Translation of Rare Words with Subword Units. ACL 2016. arXiv:1508.07909
  11. Shannon (1948). A Mathematical Theory of Communication. Bell System Technical Journal 27. doi:10.1002/j.1538-7305.1948.tb01338.x