Identity Drift in Large Language Models: Causes and Mitigation Practices
Identity drift—when a large language model misidentifies itself in the absence of a system prompt—is a data and pipeline observability problem rather than a sign of self-awareness. This article examines what identity drift is, traces its causes from training data contamination and fine-tuning pollution to evaluation leakage and inference template residue, and presents practical mitigation strategies including identity probes, data lineage tracking, contamination detection, and system prompt hardening for stable, controllable model behavior in production.
Identity Drift in Large Language Models: Causes and Mitigation Practices
1. What Is “Identity Drift”?
When a model under test is asked a basic self-description question without an explicitly injected system prompt, yet answers with an identity inconsistent with the expected one, this phenomenon can be broadly referred to as “identity drift” or “identity misattribution.” It does not mean the model has “developed self-awareness.” Rather, when generating self-referential text, the model preferentially reproduces the more frequent and more dominant identity expressions found in its training distribution.
It is important to emphasize that an “empty system prompt” does not necessarily mean “no guidance at all.” In real inference pipelines, conversation templates, special control tokens, default system messages, evaluation scaffolding, few-shot examples, cached conversation history, and even fixed prefixes concatenated by the client can all constitute implicit context. Therefore, the first step in diagnosing identity drift is not to jump to conclusions, but to fully audit how the inference request’s context is constructed.
Technically, a model’s sense of identity comes from two types of signals: one is the parametric prior formed during training—self-referential patterns that recur across the data distribution; the other is contextual constraint at inference time—the conditions jointly formed by the system prompt, conversation template, and user input. When contextual constraints are missing or weakened, the parametric prior takes over. If the training data contains large amounts of text carrying other identity markers, the model may exhibit a stable “misidentification” for such questions.
2. Possible Causes: Layer-by-Layer Investigation from Data to Inference Pipeline
2.1 Identity Text Mixed into Training Data
Large model training corpora are enormous and come from complex sources. If the corpus contains large amounts of text with fixed identity self-introductions—such as technical Q&As, product documentation, evaluation records, or dialogue logs—the model learns the statistical pattern that “when asked who you are, output a certain identity template.” Even if these texts were not deliberately injected, as long as they are numerous and repetitive enough, they can create strong identity anchoring.
A more subtle case is “indirect identity text”: text that is not a self-introduction but contains phrasing like “As an assistant, I will…”. After large-scale pretraining, the model may bind such phrasing to a specific identity. When investigating, you should examine the frequency, source distribution, and deduplication status of self-referential phrasing in the corpus—not just search for explicit identity keywords.
2.2 Contamination During Fine-Tuning and Annotation
During supervised fine-tuning, preference alignment, or instruction construction, if identity-marked samples slip into the labeled data, template data, or synthetic data, the model learns the “wrong identity” as the correct answer. Synthetic data pipelines are especially risky: if the generation side carries an identity prefix and the cleaning side fails to strip it, contamination enters the training set in a more natural form that is harder to detect with keyword searches.
As a governance measure, establish sample-level lineage: record the source, generation method, cleaning rules, review status, and version number for every training sample. Apply stricter whitelisting and manual sampling rules to self-referential samples to prevent identity templates from propagating across datasets.
2.3 Evaluation Data Leakage and Benchmark Contamination
Evaluation sets are supposed to be independent of training data, but in practice the same batch of public Q&As and dialogue records may be reused at multiple stages. If the evaluation data contains identity questions and that data also enters training or fine-tuning, the model simply “memorizes the answers” for the evaluation. Identity drift is sometimes not a model capability issue but a data isolation issue.
Apply fingerprinting and contamination detection to evaluation sets: build hash indexes for key evaluation samples and run similarity checks before training data is ingested. Keep identity-related probe questions in a separate, isolated set that never participates in training or prompt optimization.
2.4 Implicit Residue in Conversation Templates and the Inference Pipeline
Many inference services concatenate a default template around user messages. If that template retains old identity descriptions, example dialogues, or default role settings, the model still receives strong identity signals even when the business side believes “the system prompt is empty.” In multi-turn conversations, improperly cleaned history messages can also cause identity cross-contamination.
Identity issues therefore require an end-to-end audit: print and compare every layer, from the client request, gateway concatenation, and template rendering, through tokenizer processing, to the final input sequence. The following pseudocode shows a minimal audit approach:
def build_final_input(user_msg, system_msg=None, history=None):parts = []if system_msg:parts.append(f"[SYSTEM]{system_msg}[/SYSTEM]")for turn in history or []:parts.append(f"[{turn.role}]{turn.content}[/{turn.role}]")parts.append(f"[USER]{user_msg}[/USER]")return "".join(parts)def identity_probe(model, user_msg="Who are you?"):final_input = build_final_input(user_msg, system_msg=None, history=[])log(final_input) # Audit the final input, not just the business-level parametersreturn model.generate(final_input)
3. Risk Assessment: Not “Self-Awareness,” but a Controllability Signal
Identity drift itself usually does not constitute a serious security vulnerability, but it is a valuable “health-check signal.” It indicates that model output is significantly influenced by identity templates in the training distribution, and that the contextual constraints in the inference pipeline are not strong enough. For developers, the risks mainly fall into three areas:
First, product consistency risk. A user-facing assistant that claims a different identity erodes trust and raises compliance questions. Second, evaluation credibility risk. Identity misattribution may suggest evaluation data leakage or contamination, which in turn undermines confidence in other capability assessments. Third, supply chain transparency risk. Identity text contamination often reflects complex data sources and incomplete cleaning rules, warranting further checks on copyright, privacy, and content safety.
4. Detection: Regression Testing with Identity Probes
Include identity consistency in pre-launch regression testing rather than waiting for users to report it. Probe design should cover:
- Three context conditions: empty system prompt, weak system prompt, and strong system prompt;
- Single-turn and multi-turn conversations, to observe whether history messages cross-contaminate;
- Questions in Chinese, English, and mixed languages;
- Multiple phrasings: direct questions, role reversal, hypothetical questions, and more;
- Repeated sampling, to observe whether drift is stable.
Test results should not be judged on a single answer. Instead, measure the identity consistency rate, drift direction, and trigger conditions. For business-critical models, set an “identity consistency” release gate: if the score falls below a threshold, block the release and trace back the data and template versions.
5. Mitigation Practices: Hardening Across Data, Prompts, and Process
At the data layer, classify sources, deduplicate, run similarity-based contamination detection, and manually sample self-referential samples. At the fine-tuning layer, isolate identity-related samples, establish sample lineage, and define cleaning rules for synthetic data. At the inference layer, explicitly inject identity constraints, clean default templates and cached history, and prevent an “empty system prompt” from becoming an “implicit old prompt.” At the process layer, integrate identity probes into continuous regression testing and run joint staged rollouts across model, template, and data versions.
System prompt hardening should follow the principles of being explicit, concise, and verifiable—avoiding stacks of role settings that conflict with each other. For example:
You are an assistant deployed within this business system. When asked about your identity,answer according to the current system configuration. If the configuration provides noidentity information, state that you are the assistant configured for the current system,and do not speculate about other identities.
At the same time, preserve an “unknown means unknown” response strategy. When identity information is insufficient, the model should not fill the gap with a high-frequency identity from its training distribution; it should explicitly defer to the current configuration.
6. Conclusion
“Claiming a different identity under an empty system prompt” is best understood as a data and pipeline observability problem, not a question of model consciousness. It reveals multiple possibilities: complex training data sources, fine-tuning sample contamination, evaluation leakage, and inference template residue. Developers should use identity probes as the entry point to build a closed-loop governance process spanning final-input auditing, data lineage, contamination detection, and regression gates. A model’s sense of identity is not mysterious, but it depends on data distribution and contextual constraints more than one might expect. Only by managing identity consistency as an engineering metric can you ensure that production behavior remains stable, explainable, and controllable.
