Abstract
Controllable and transparent text generation has been a long-standing goal in NLP. Almost as long-standing is a general idea for addressing this challenge: Parsing text to a symbolic representation, and generating from it. However, earlier approaches were hindered by parsing and generation insufficiencies. Using modern parsers and a safety supervision mechanism, we show how close current methods come to this goal. Concretely, we propose the Sentence Smith framework for English, which has three steps:
- Parsing a sentence into a semantic graph.
- Applying human-designed semantic manipulation rules.
- Generating text from the manipulated graph. A final entailment check (4.) verifies the validity of the applied transformation. To demonstrate our framework's utility, we use it to induce hard negative text pairs that challenge text embedding models. Since the controllable generation makes it possible to clearly isolate different types of semantic shifts, we can evaluate text embedding models in a fine-grained way, also addressing an issue in current benchmarking where linguistic phenomena remain opaque. Human validation confirms that our transparent generation process produces texts of good quality. Notably, our way of generation is very resource-efficient, since it relies only on smaller neural networks.
Introduction
Text embeddings serve as the foundation for modern natural language processing tasks, including semantic search and Retrieval-Augmented Generation (RAG). However, evaluating the depth of "understanding" in these models remains a challenge. Standard benchmarks like MTEB often rely on paraphrase detection, which can be gamed by models focusing on lexical overlap rather than structural meaning. For instance, a model might treat "The snake bites the tiger" and "The tiger bites the snake" as nearly identical due to shared vocabulary, despite the reversed semantic roles.
To address this, we introduce SentenceSmith, a neuro-symbolic framework designed to perform surgical, controllable edits on text. By generating "hard negatives"—sentences that are lexically similar but semantically distinct—we can expose specific linguistic failures in state-of-the-art embedding models.
The SentenceSmith Framework
SentenceSmith employs a four-step pipeline to transform sentences while maintaining precise control over semantic shifts:
- Parsing: Input text is converted into an Abstract Meaning Representation (AMR) graph, which captures "who is doing what to whom" using nodes for concepts and edges for semantic roles.
- Symbolic Manipulation: We apply human-designed rules to the AMR graph. These include Polarity Negation (PN), Role Swap (RS), Antonym Replacement (AR), Underspecification (US), and Hypernym Substitution (HS).
- Generation: A specialized neural model translates the modified AMR graph back into fluent natural language.
- Validation: A Natural Language Inference (NLI) model performs a final check to ensure the edit successfully altered the meaning (e.g., ensuring a negation results in a contradiction).
Experimental Evaluation
We utilized SentenceSmith to induce a benchmark of approximately 13,000 validated "foil" pairs derived from the PAWS and GPTP datasets. These pairs serve as a stress test for text embeddings, requiring models to distinguish between true paraphrases and semantically altered foils with high lexical overlap.
We evaluated a wide range of models using "Triple Accuracy," which measures a model's ability to rank a true paraphrase higher than a generated foil. This metric allows us to pinpoint exactly which linguistic phenomena (like negation or role reversal) cause a model to fail.
Results and Discussion
Our evaluation revealed significant gaps in the semantic understanding of current models:
- Negation and Role Swapping: Many models struggle with negation (PN) and role swapping (RS). RS proved particularly difficult, suggesting that many embeddings still behave like "bag-of-words" models that fail to capture structural relationships between entities.
- Model Performance:
sentence-t5-largeemerged as the most robust model, significantly outperforming much larger LLM-based embeddings likeE5-MISTRAL-7Bon the GPTP dataset. This suggests that optimizing for broad context in LLMs may compromise precise sentence-level semantics. - Benchmark Correlation: Performance on SentenceSmith only moderately correlates (0.54) with MTEB rankings, indicating that our framework captures linguistic nuances that standard benchmarks overlook.
Conclusion
SentenceSmith provides a transparent, resource-efficient method for evaluating the fine-grained semantic capabilities of text embeddings. While currently limited to English and the scope of AMR, it offers a path toward more rigorous and interpretable NLP evaluation. The framework and datasets are available for community use to help drive the development of truly "understanding" models.
Summary updated