NONSENSE: Non-Semantic Strings Expose Semanticity Gaps in Dense Retrieval

Ankit GuptaarXiv 2026

TL;DR

Modern dense retrieval models, which power everything from Google Search to RAG-based AI, assume that high vector similarity equals semantic relevance. This paper introduces NONSENSE, a probe that generates gibberish strings which—despite being completely unreadable—consistently outscore actual human-judged relevant passages, revealing a fundamental "semanticity gap" in how these models represent language.

What Problem Does This Paper Address?

Dense retrieval (DR) has become the standard for open-domain question answering and Retrieval-Augmented Generation (RAG). These systems work by encoding queries and documents into a high-dimensional vector space; if a query vector is close to a document vector, the system assumes they are semantically related.

The authors challenge a core operational assumption: Is high similarity actually evidence of meaning? In other fields, like computer vision, researchers have long known that models can be "fooled" by adversarial noise that looks like static to humans but like a "panda" to a neural network. This paper asks if dense retrievers have similar "off-manifold" vulnerabilities—points in the vector space that the model loves, but which contain zero human-understandable information.

Methods

The authors developed NONSENSE (Non-Semantic Strings Expose Semanticity Gaps), a black-box, sparse-edit probe.

  1. Initialization: It starts with a fixed-length "filler" string (e.g., 256 characters of ":::: ").
  2. Optimization: It iteratively proposes one-character replacements using a visible alphabet (letters, digits, symbols).
  3. Constraints: To ensure the result isn't just a "keyword stuffing" attack, the algorithm rejects any candidate string that contains an actual term from the query (length $\ge$ 3).
  4. Acceptance: A change is only kept if it increases the cosine similarity between the query and the string.
  5. Evaluation: After 50,000 steps, the resulting gibberish string is inserted into the original document corpus and ranked against real documents.

Unlike previous "prompt injection" or "hidden Unicode" attacks, these strings are overtly non-semantic and do not rely on exploiting the tokenizer's hidden states.

Datasets

The study evaluates three popular single-vector retrievers (E5-base-v2, BGE-base-en-v1.5, and Contriever) across five diverse datasets from the BEIR benchmark:

  • SciFact (Scientific fact-checking)
  • SciDocs (Scientific document retrieval)
  • FIQA (Financial QA)
  • NFCorpus (Medical retrieval)
  • ArguAna (Argument retrieval)

Key Insights and Ideas

  • The Semanticity Gap: The most striking insight is that "nearest-neighbor status" in a vector space can be completely separated from "passage-like meaning." A model can be 90% "sure" a string of punctuation is the best answer to a medical query.
  • Geometry vs. Meaning: The success of NONSENSE suggests that the embedding spaces of these models contain "spikes" or "holes"—regions of high confidence that don't correspond to real language.
  • Optimization is Necessary: Randomly generated strings don't fool the models. The "nonsense" must be specifically evolved to exploit the model's internal geometry.
  • Model-Specific Vulnerabilities: Interestingly, a nonsense string that fools E5 usually doesn't fool BGE. This suggests the "gap" isn't a property of the data itself, but an artifact of how each specific model was trained.
Figure 1: Representative queries illustrating the semanticity gap. Optimized NONSENSE strings frequently outscore the retriever’s best judged query-relevant passage (QRP) under the same scoring model (E5-base-v2). Starting from visible filler text, the probe optimizes only for dense similarity, showing that nearest-neighbor geo- metric status can separate from passage-like meaning. See Tables 8–10 for more qualitative examples.

Key Results

The authors compared the NONSENSE strings against the Query-Relevant Passage (QRP)—the single highest-scoring document in the corpus that humans actually judged as relevant.

  • Success Rates: On datasets like SciFact and NFCorpus, NONSENSE strings outscored the best human-judged evidence in 85% to 99% of cases.
  • Corpus Rank: In many instances, the gibberish string achieved a Median Rank of 1, meaning the retriever officially considered a string of symbols to be the most relevant "document" in a collection of thousands.
  • Efficiency: As shown in Figure 2, the optimization often overtakes the human-judged baseline very quickly, sometimes in fewer than 1,000 proposal steps.
Optimization curves showing NONSENSE strings (teal) overtaking human-judged passages (purple).

Detailed metrics across all models and datasets are summarized in the table below:

Main results table showing success rates and ranks.

Limitations and Future Work

  • Scope: This study focused on "single-vector" retrievers. It remains to be seen if more complex "late-interaction" models (like ColBERT) or cross-encoder rerankers are equally susceptible.
  • Transferability: Because the strings are model-specific, they aren't a "universal" attack, but rather a diagnostic tool for developers to stress-test their specific models.
  • Future Directions: The authors suggest that future retrieval pipelines should include "passage-validity checks" or semantic verifiers to ensure that high-scoring results are actually composed of real language before they are passed to a user or an LLM.

Summary updated

Abstract

Dense retrieval is central to modern search, question answering, and retrieval-augmented generation, where high similarity is often treated as evidence of semantic relevance. We examine how far this assumption can be stressed. NONSENSE is a black-box sparse-edit probe that constructs visibly non-semantic strings while forbidding query-term copying, optimizing only the dense similarity between a query and the string. Across five BEIR-style datasets and three popular single-vector retrievers, these strings frequently outscore the retriever's own best judged query-relevant passage (QRP), and often rank first in the full corpus. The result indicates a semanticity gap in the evaluated dense retrievers: nearest-neighbor status can be separated from passage-like meaning. These findings highlight the importance of evaluating dense retrievers not only by whether they retrieve relevant documents, but also by how reliably their similarity scores reflect semantic evidence.
BibTeX
@misc{gupta2026nonsense,
  author = {Ankit Gupta},
  title = {{NONSENSE: Non-Semantic Strings Expose Semanticity Gaps in Dense Retrieval}},
  year = {2026},
  eprint = {2611.22353},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.22353},
}
Figure