NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Semantic-KG: Using Knowledge Graphs to Construct Benchmarks for Measuring Semantic Similarity

Qiyao Wei, Edward Morrell, Lea Goetz, Mihaela van der Schaar

TL;DR

Evaluating whether large language model (LLM) responses accurately preserve meaning requires robust semantic textual similarity (STS) benchmarks, yet existing datasets are expensive, subjective, and rarely domain-specific. Semantic-KG introduces an automated framework that uses knowledge graph (KG) perturbations and a round-trip LLM validation pipeline to synthesize grounded, natural language statement pairs with mathematically verifiable semantic differences. Evaluating standard NLP metrics and LLM judges across four diverse domains shows that no single evaluation method reigns supreme: LLMs excel at detecting relationship inversions, while classic NLP metrics surprisingly outperform LLMs when catching missing or altered entities.

What Problem Does This Paper Address?

When evaluating open-form LLM outputs—whether in Retrieval-Augmented Generation (RAG) pipelines or using the LLM-as-a-judge paradigm—systems must measure semantic similarity rather than superficial lexical overlap. Two statements can share 95% of their vocabulary but mean opposite things (e.g., "Drug X treats Disease Y" vs. "Drug X causes Disease Y").

Existing STS benchmarks suffer from three major shortcomings:

  1. High generation costs and subjectivity: They rely heavily on human crowd-workers whose interpretations of "equivalence" often conflict.
  2. Narrow domain coverage: Most benchmarks focus exclusively on open-domain chit-chat or general knowledge, leaving specialized, high-stakes fields like finance, biomedicine, and ecology under-tested.
  3. Imprecise ground truth: Human annotations typically capture graded, subjective sentiment rather than structured, diagnostic semantic variations.

Methods

Semantic-KG automates benchmark generation without human annotation using a four-step pipeline:

  1. Subgraph Sampling: Subgraphs are extracted from domain KGs using breadth-first search (BFS) with penalty adjustments to enforce node-type diversity.
  2. Targeted Subgraph Perturbation: The authors systematically create semantically altered graphs by applying one of four perturbation types:
  3. Node Removal: Deleting an entity (and associated edges).
  4. Node Replacement: Swapping an entity with another of identical type.
  5. Edge Removal: Cutting a relationship between entities.
  6. Edge Replacement: Changing the predicate to an opposing or conflicting relation (e.g., swapping increases effect with decreases effect) using manually verified schema mappings.
  7. Response Generation: An LLM (GPT-4o) converts both original and perturbed subgraphs into fluent natural language paragraphs. Two variants of the original graph yield positive (semantically equivalent) pairs; pairing an original with a perturbed statement yields negative pairs.
  8. Response Validation via Inversion: To ensure the generated text faithfully reflects the graph without hallucinations, an independent LLM extracts the entities and relations back out of the generated statement. If the reconstructed triples do not strictly match the source graph (after normalization and lemmatization), the sample is discarded.
Knowledge Graph Subgraph ──> LLM Text Generation ──> Text Statement
           │                                                 │
      Perturbation                                    LLM Extraction
           │                                                 │
           v                                                 v
  Perturbed Subgraph ──────> LLM Text Generation ──> Reconstructed Graph
                                                      (Validation Check)

Datasets

The authors applied Semantic-KG across four distinct domains to construct the benchmark:

  • Codex: General knowledge based on Wikidata (77k+ entities, 69 relations).
  • Oregano: Biomedicine, covering drug compounds, genes, diseases, and side effects.
  • FinDKG: Financial knowledge, tracking market trends, economic indicators, and corporate actions.
  • Globi: Biology and ecology, detailing biotic species interactions (e.g., predator-prey, host-pathogen).

Key Insights and Ideas

  • The Relational Blindspot of Lexical Metrics: Classic n-gram metrics (ROUGE, BLEU) fall apart when predicates change. When 90% of the sentence tokens remain identical, lexical metrics give high similarity scores despite opposite meanings.
  • LLMs and Classic Metrics Have Inverted Strengths: LLM-as-a-judge models dramatically outperform traditional NLP tools on edge replacements (semantic contradictions). However, on node removals (missing entities), classical metrics and lightweight embedding models regularly match or beat state-of-the-art LLMs.
  • Domain Performance is Non-Transferable: Superior STS capability in general knowledge does not translate cleanly into specialized domains. Certain LLM judges experience notable performance dips in ecology (Globi) or finance (FinDKG), highlighting the danger of using one-size-fits-all LLM evaluators in high-stakes settings.

Key Results

The authors benchmarked LLM-as-a-judge models (GPT-4o, GPT-3.5, Gemini-1.5 Pro, Llama-3.1-70B/8B), dense embedding models (text-embedding-3-large, Ada-002, Sentence-T5), and traditional NLP metrics:

  • Edge Perturbations: On the financial dataset (FinDKG), edge-replacement caused ROUGE-1’s F1 score to collapse to 0.061, whereas Gemini-1.5 Pro achieved 1.000 and Llama-3.1-70B reached 0.985. Linear mixed-effects regression showed a significant positive interaction between GPT-4o and edge replacement ($\beta = 0.184, p = 0.031$).
  • Node Perturbations: For node removal, lightweight models excelled. Sentence-T5-Base achieved 0.971 F1 on Codex, significantly outperforming GPT-4o (0.730) and GPT-3.5 (0.776) with a positive interaction ($\beta = 0.260, p = 0.002$).
  • Dataset Spot Checks: Human validation confirmed the dataset's high fidelity: spot checks yielded 99% semantic correctness and 75% linguistic naturalness. Text metrics confirmed readability and syntactic complexity matched typical academic prose.

Limitations and Future Work

  • Closed-World Assumption: Knowledge graphs treat unrepresented facts as false, which does not completely capture open-world pragmatic nuances (such as implied context or conversational tone).
  • Generation Overhead: Because the validation step is strictly zero-tolerance, generation requires roughly 24,000 LLM calls per dataset to filter out imperfect generations.
  • Graph Complexity Ceilings: The LLM text-to-graph reconstruction fidelity drops sharply on subgraphs larger than 12 triples, currently limiting benchmark statements to moderate length.
  • Future Directions: Incorporating continuous, graded similarity scores (e.g., based on graph edit distance), testing nuanced semantic shifts like sarcasm and hedging, and reducing validation rejection rates.

Summary updated

BibTeX
@inproceedings{wei2025semantic,
  author = {Qiyao Wei and Edward Morrell and Lea Goetz and Mihaela van der Schaar},
  title = {{Semantic-KG: Using Knowledge Graphs to Construct Benchmarks for Measuring Semantic Similarity}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=iYLOh41doC},
}
Figure