ArticleTechnology

Add one equals sign to a comment and DeepSeek's AI changes its answer

Where text happens to land in an AI model's compressed memory can swing its accuracy by up to 40 points. The average score never lets on.

A detailed view of colorful source code displayed on a computer screen.
Photo by Markus Spiske on Pexels · Photos provided by Pexels

Here is a line of code that stops halfway: `T.Cast(FP`. Anyone who writes this sort of thing knows the next character is 8, as in FP8. Ask an AI model to finish it, then add one decorative equals sign to a docstring further up, the note programmers leave to explain their code, and ask again. Then add another.

When researchers at ByteDance Seed did this to DeepSeek-V4-Flash-Base, its top guess kept flipping between 8 and a wrong answer, 32: two steps right, two steps wrong, round and round in a cycle of four. It happened on 60 of the 64 inputs they tried. Not a character of the actual code had changed.

So how can a row of equals signs in a comment change what a model thinks comes next?

It comes down to how the model remembers. A language model reads in tokens, which are words or pieces of words, and keeps running notes on everything it has read so far, known as its KV cache. Long documents make those notes expensive, so DeepSeek-V4 squashes them: each window of eight tokens is boiled down into a single entry, with a new window starting every four. Picture someone taking minutes who writes one line for every few sentences. Start them a sentence late and every line bundles things up slightly differently, though nobody has said anything new.

Where a token sits inside its window is what the researchers call its phase. One extra equals sign shoves everything after it along by one place. It ought to make no difference. An older DeepSeek model without the squashing picked 32 on just 4 of the 64.

To measure how much difference it makes, the team hid facts among 16,000 records and asked the models to find them, using prompts identical except for phase. All four DeepSeek-V4 models showed the same four-beat rhythm, and the gap between their best and worst phase ran from 15 to 40 percentage points. Post-training, the polishing a model gets after its main training, raised the scores and narrowed the gap, but the rhythm stayed.

What ought to bother people is how well this hides. In small test models the team trained themselves, a compressed one averaged 59.4 per cent on retrieval, against 61.1 per cent for one that kept full notes. At its worst phase, though, the compressed model scored 9.9 per cent. The uncompressed model's worst was 58.4.

The team caught the culprit too: shift the compression windows along by one slot and the weak spots move along with them. The paper, posted to arXiv on 28 September, has not yet been peer reviewed. The authors' proposed fix is unglamorous: test these models at every phase and report the worst score next to the average. That seems the least anyone should ask of software that can be talked out of the right answer by a bit of punctuation in a comment.

How we make Nooze