A hand sliding a memory module into a row of identical black modules, one with an orange tab at the centre
Article

KV cache leakage: the test that checked the wrong thing

KV cache leakage let 155 responses carry other customers' data. What Cloudflare's report shows about a passing test that checked the wrong thing.

Muhammad Awais YusufCo-Founder & CTO
View as Markdown

Cloudflare's team knew two numbers did not match before launch. The long tests came back with success codes, so they went ahead. KV cache leakage is when the saved working memory an AI model keeps while it answers still holds one customer's data, and gets read while answering someone else. Cloudflare's October 2026 report on the GLM 5.3 model it hosts shows how a passing test can look at the wrong thing.

What Cloudflare knew before launch

According to Cloudflare's report, published on October 26, 2026, it launched GLM 5.3 on its Workers AI service on August 27 with a context window of 1,048,576 tokens. The memory pool on its prefill GPUs, the machines that read the prompt first, held only 681,280 tokens.

The model's context window was 1,048,576 tokens, but the memory pool on the prefill GPUs held 681,280

Cloudflare says it was aware of the mismatch before launch. It expected the engine to return an error for any prompt it could not process. The pool size is printed in the engine's startup logs, and the two numbers are set separately, so nothing forces them to agree. As Cloudflare puts it, checking that they agree was its own job.

Why a success code proved nothing about KV cache leakage

Before launch, the team ran long prompts and saw successful HTTP status codes and a streaming body with no error frames. They assumed the engine handled the gap. Cloudflare names this as the critical gap in its testing: it validated response codes and engine speed at long contexts, but not the model's output or whether it made sense.

A status code says the request was handled. It does not say it was handled correctly. In the affected cases the client got an HTTP 200 where it should have got a 400, and the reply read normally. The only hint was speed: the reply came back faster than a prompt that long should take.

Two small faults that made one leak

Cloudflare calls it two overlapping issues. The first was the mismatch above. The second was a bug in SGLang, the open source engine it runs, in the mode that splits prompt reading from answer writing.

When a prompt did not fit, the engine marked it rejected and swapped it for a one token placeholder. On a single machine, that ended in an error for the client. In the split mode, the checks that decided whether to continue asked whether a request was finished, not whether it was rejected. So the rejected request went on.

The prefill side sent only the memory for the placeholder and signalled that the transfer was complete. The answering side had reserved far more pages than were written, and it read the rest as they were: left over from earlier requests.

The path of one rejected request: marked rejected, admitted anyway, placeholder sent, stale pages read, and a 200 returned

The report adds a detail that matters for any operator. Memory pages are not cleared between requests, which is common among engines and helps performance, so the engine itself is responsible for tracking who owns each page. It also says another user had reported the engine bug in July.

Check the output, not the status code

In all, 155 responses were affected, all to prompts longer than 681,280 tokens, between August 27 and September 9. Cloudflare says that after excluding its own testing and the researcher's, the requests were consistent with ordinary long context use, and it found no evidence of deliberate exploitation.

A security researcher reported the problem on September 8, and the model was taken offline within 40 minutes of the incident being declared. Cloudflare says it now checks the pool size against the context length directly from the running engine, before any change to this kind of deployment ships, and not by inferring from response codes.

Our suggestion for your own tests is the same idea. Put marker text in one request and look for it in another. Test the content that comes back, not just the code.

Block the request, don't hope for an error

The other half of the fix is to stop relying on the engine to say no. Cloudflare enlarged the pool so a prompt that fits the context window always fits the pool, and patched the engine so a rejected request ends with its original error before any transfer happens. SGLang's own report describes the same admission fix, and says it complements deployment checks that compare pool capacity with the configured context length.

That is the design rule we use in document systems. In Stay Funded 360, a missing receipt blocks the download and names the record. It is blocked, not warned, because an incomplete packet that goes out is worse than a delay.

What to ask a vendor that runs your documents

If a vendor or an AI tool in your stack handles client files, three questions are fair. Do you test the content of long or unusual requests, or only that they return success? What happens when a request crosses a known limit: does it refuse, or is an error simply expected? And can you show me a check that two customers' data cannot meet?

One limit applies. On Cloudflare's own service, only this model was affected, and a checked output will not catch every leak. SGLang's post describes a related race that can affect other deployments in the same split mode, so anyone running the engine themselves should read it.

In the compliance portal we built, AI suggests and a person confirms before anything is committed, because some mistakes a test will not see. If you want help working out where a person must confirm in your own workflow, our services page shows how we map that, and we can talk it through in a 30-min call.

Frequently asked questions

What is KV cache leakage?

It is when the saved working memory a model keeps while it answers, called the KV cache, still holds data from an earlier request and is read for a new one. The result can contain another user's text.

How can one user's data show up in another user's answer?

In Cloudflare's case, memory pages were reused without being cleared, and a rejected request was allowed to proceed. The answering side read pages that held earlier requests' data.

Why did the tests not catch it?

They checked status codes and speed at long contexts, not the content of the output. A successful response with a coherent answer looked correct.

How do you test for cross-request leaks?

Send marker text in one request, then check that it never appears in another. Also check that known limits, such as pool size against context length, agree.

Should a document workflow trust the model's error handling?

Not on its own. Block requests that cross a known limit before they reach the model, and have a person confirm anything that matters.