Special Token Pollution and Prompt Boundary Failure in LLMs

    This article explains why entering a partial thinking tag such as `<think` can make a model generate structured reasoning as if it were continuing another conversation. It traces the root cause to tokenization rather than cache mix-ups, shows how user text and system control tokens can become indistinguishable in the token stream, and outlines a reproduction method, impact boundaries, and governance practices covering tokenizer consistency, corpus cleaning, alignment data, input validation, and regression testing.

    1. The Symptom: Why a Thinking Tag Makes the Model Sound Like It Is in Someone Else’s Conversation

    A common recent report is this: a user types only the beginning of a thinking tag (something like <think) into the chat input box. Instead of treating the input as empty, the model returns a fully structured block of reasoning, as if it were continuing a context that does not exist. Because the output style closely resembles “thinking mode,” it is easy to misread the behavior as the model matching another user’s session.

    A more precise description is that the model is not reading anyone else’s data. It is treating the user-supplied string as a system-level control signal. To understand why, you have to go back to the first step in how a large model processes text: tokenization.

    2. Root Cause: Not a Cache Mix-Up, but an Indistinguishable Token Stream

    2.1 Under a Correct Design, System Markers and User Text Live in Separate Spaces

    In mainstream chat models, session start/end markers, role markers, and thinking-section start/end markers are special tokens. They are usually mapped to fixed, single token IDs and are only supposed to be injected by the system side. Even if a user types the exact same characters in the input box, the tokenizer splits them into multiple ordinary tokens. For example:

    1. System injection: <think> -> [114514] # single token, controlled
    2. User input: "<think" -> [1919, 810] # multiple tokens, ordinary text

    With this design, the token stream the model sees naturally carries a “source label,” so instruction levels do not get confused.

    2.2 When It Breaks: The String Was Not Treated as a Special Token During Training

    If, during training, corpus cleaning or template assembly writes the thinking tag as an ordinary string, the model sees two forms across many samples: one is the controlled single token, and the other is the split ordinary token sequence. The two are semantically equivalent but not equivalent in the token stream. As a result, the model learns that seeing this ordinary token combination also means entering the thinking section.

    The consequence is prompt boundary failure: user-crafted text can forge a system-level state switch. This is the same class of problem as escaping/injection in traditional markup parsing, and can be called token pollution.

    2.3 Why It Looks Like Reciting an Answer Instead of Throwing an Error

    The model does not validate whether the input is empty. It only predicts conditional probabilities based on the token stream. Once the thinking section is forcibly opened, the model continues completion according to the training distribution, producing content that looks coherent but has no real basis. This output is not retrieved real history; it is hallucinated continuation under distribution fitting.

    3. A Reproducible Verification Path (General Method)

    1. Disable any session cache and history context, and run pure weight-based inference;
    2. Inject no system prompt, and keep the template minimal;
    3. Fix decoding parameters (such as temperature, Top-p, and maximum length), and repeat the same input multiple times;
    4. Run a controlled comparison: input the special-token form, the split form, and completely unrelated text separately;
    5. Observe whether it consistently enters the thinking section, and record the semantic relevance of the output to the input.

    If it still reproduces frequently with no cache and no system prompt, you can rule out the “hit someone else’s cache” theory and point to training-time tokenization and template issues.

    4. Impact Boundaries: No Need to Panic, but It Must Be Fixed

    • Data security: there is no cross-user data leakage; the token stream contains no one else’s content;
    • Stability: prompt isolation is broken, which may cause instruction priority confusion and uncontrollable output;
    • Evaluation: it pollutes benchmark results and distorts test cases such as “empty input” and “unauthorized instructions”;
    • Engineering: it is a data and template governance problem, not an inference service failure.

    5. Governance: From Tokenization to Data and Alignment

    1. Unify tokenization and templates: ensure system-level markers are injected only as single tokens, while user text always goes through ordinary tokenization;
    2. Clean the corpus: go back through the training set and fix special markers that were incorrectly expanded;
    3. Build alignment samples: add minimal instruction fine-tuning/preference data on the order of a hundred-plus examples to teach the model to treat forged markers “as ordinary text”;
    4. Validate on the input side: escape or reject suspected control markers on the server side to keep them out of template assembly;
    5. Run regression evaluation: add “forged system markers,” “empty input,” and “role escalation” to a fixed test set and monitor continuously.

    6. A Practical Checklist for Developers

    • Never concatenate user input directly into a system template;
    • Maintain a whitelist and injection audit for special tokens;
    • Keep a minimal system prompt on the inference service side to define the role and boundaries clearly;
    • Use a fixed test set for version regression to avoid “fix one, break another”;
    • Log template rendering results and token ID sequences in the observability system for fast diagnosis.

    7. Conclusion

    This kind of problem is fundamentally a prompt boundary engineering issue: when user-controllable text and system control signals are identical at the token level, the model cannot tell where an instruction comes from. The fix does not depend on a complex architecture; it depends on three things: tokenization consistency, data cleaning, and alignment evaluation. Make the boundary solid, and the model will not be thrown off by a single tag.