TLDR: A new study introduces and investigates “sticky tokens” in Transformer-based text embedding models. These tokens, when repeatedly inserted, pull sentence similarity towards a central value, significantly degrading performance in downstream NLP tasks like clustering and retrieval. Researchers developed StickyTokenDetector (STD) to identify these tokens, finding 868 across 40 models. Sticky tokens often stem from special/unused vocabulary entries or fragmented multilingual subwords. The study also reveals that these tokens disproportionately dominate model attention, amplifying anomalies through layers, highlighting a critical need for improved tokenization and model design.
Text embedding models, which convert human language into numerical representations, are fundamental to many natural language processing (NLP) applications, from search engines to advanced AI systems. These embeddings allow computers to understand the semantic content of text, enabling tasks like retrieval, classification, and semantic similarity. However, recent research has uncovered a surprising and problematic phenomenon: “sticky tokens.”
What Are Sticky Tokens?
Sticky tokens are anomalous units of text that, when repeatedly inserted into sentences, can distort the perceived similarity between different pieces of text. Instead of reflecting true semantic content, these tokens pull sentence similarity towards a specific, often average, value. This disrupts the normal distribution of embedding similarities and can severely degrade the performance of downstream NLP tasks.
Imagine two sentences that are semantically very different. If a sticky token is repeatedly added to one of them, the embedding model might incorrectly perceive them as more similar than they actually are. This can lead to unreliable results in applications that depend on accurate text similarity.
Detecting the Anomaly: StickyTokenDetector (STD)
To systematically investigate and identify these problematic tokens, researchers developed an efficient detection method called StickyTokenDetector (STD). The STD process involves several key steps:
-
Sentence Pair Filtering: The method first filters sentence pairs, focusing on those whose initial similarity is below a certain mean value. This helps to efficiently identify tokens that tend to increase similarity.
-
Token Filtering: It then removes invalid tokens from the model’s vocabulary, such as those that are undecodable or unreachable.
-
Shortlisting via Sticky Scoring: A “sticky score” is computed for each candidate token, indicating its tendency to exhibit sticky behavior. Tokens with high scores are shortlisted.
-
Validation: Finally, the shortlisted tokens are rigorously validated against a formal definition to confirm they truly behave as sticky tokens.
Key Findings and Their Implications
Applying STD to 40 different text embedding models across 14 prominent model families, the researchers discovered a total of 868 sticky tokens. This extensive analysis revealed several important insights:
-
Origin of Sticky Tokens: Many sticky tokens originate from special or unused entries in the model’s vocabulary. These include control tokens like
</s>(end-of-sequence) or[CLS](classification token), as well as reserved but unused tokens (e.g.,<extra_id_18>). Fragmented subwords from multilingual corpora, such as Cyrillic characters or mathematical symbols, also frequently appear as sticky tokens, suggesting issues with how these models handle diverse languages and character sets. -
No Correlation with Model Size: Surprisingly, the presence and number of sticky tokens do not strictly correlate with the model’s size or vocabulary size. This indicates that the problem isn’t simply a matter of scale but rather deeper issues in tokenizer design and pre-training processes.
-
Impact on Downstream Tasks: The study rigorously evaluated how sticky tokens affect real-world NLP tasks like clustering and retrieval. The results showed substantial performance degradation, approaching 50% in certain cases. This highlights the critical need to address sticky tokens for reliable AI applications.
-
Underlying Mechanism: Through attention-layer analysis, the researchers found that sticky tokens disproportionately dominate the model’s internal representations. They observed that sticky tokens cause attention weights to concentrate in high-value ranges, disrupting the balanced contextual representation of input texts. This anomaly is amplified across deeper layers of the model, leading to significant distortions in the final sentence embeddings.
Also Read:
- Unmasking LLM Inputs: The Inversion Threat to Internal States
- A Comprehensive Evaluation of AI Models for Software Vulnerability Detection
Looking Ahead
The discovery of sticky tokens underscores a largely overlooked issue in text embedding models and raises concerns about tokenization robustness. The findings encourage future research into designing more robust tokenization schemes and model architectures that can mitigate the effects of sticky tokens, ultimately leading to more reliable embedding-based NLP systems. Potential mitigation strategies include tokenizer sanitization (pruning problematic tokens) and runtime detection to flag and re-embed texts containing suspected sticky tokens.
For more detailed information, you can read the full research paper: Sticking to the Mean: Detecting Sticky Tokens in Text Embedding Models.


