Table of Contents
Fetching ...

Topological quantification of ambiguity in semantic search

Thomas Roland Barillot, Alex De Castro

TL;DR

This work tackles semantic-ambiguity in sentence embeddings by leveraging persistent homology to detect topological signatures in query neighborhoods. It defines two model-agnostic topological metrics, $W_{1}(H_{0})$ and $LT_{max}(H_{1})$, and validates them through ab-initio simulations and real-world experiments on Nobel Prize Physics lectures using four embedding models. The findings reveal two ambiguity regimes—polysemic and multi-factual—with clear, separable topological fingerprints that persist across models, suggesting practical use for ambiguity detection and improved recall in retrieval-augmented generation. The approach provides a principled, geometry- and topology-based tool to augment traditional similarity measures in semantic search, with potential to enhance precision-recall trade-offs in RAG systems.

Abstract

We studied how the local topological structure of sentence-embedding neighborhoods encodes semantic ambiguity. Extending ideas that link word-level polysemy to non-trivial persistent homology, we generalized the concept to full sentences and quantified ambiguity of a query in a semantic search process with two persistent homology metrics: the 1-Wasserstein norm of $H_{0}$ and the maximum loop lifetime of $H_{1}$. We formalized the notion of ambiguity as the relative presence of semantic domains or topics in sentences. We then used this formalism to compute "ab-initio" simulations that encode datapoints as linear combination of randomly generated single topics vectors in an arbitrary embedding space and demonstrate that ambiguous sentences separate from unambiguous ones in both metrics. Finally we validated those findings with real-world case by investigating on a fully open corpus comprising Nobel Prize Physics lectures from 1901 to 2024, segmented into contiguous, non-overlapping chunks at two granularity: $\sim\!250$ tokens and $\sim\!750$ tokens. We tested embedding with four publicly available models. Results across all models reproduce simulations and remain stable despite changes in embedding architecture. We conclude that persistent homology provides a model-agnostic signal of semantic discontinuities, suggesting practical use for ambiguity detection and semantic search recall.

Topological quantification of ambiguity in semantic search

TL;DR

This work tackles semantic-ambiguity in sentence embeddings by leveraging persistent homology to detect topological signatures in query neighborhoods. It defines two model-agnostic topological metrics, and , and validates them through ab-initio simulations and real-world experiments on Nobel Prize Physics lectures using four embedding models. The findings reveal two ambiguity regimes—polysemic and multi-factual—with clear, separable topological fingerprints that persist across models, suggesting practical use for ambiguity detection and improved recall in retrieval-augmented generation. The approach provides a principled, geometry- and topology-based tool to augment traditional similarity measures in semantic search, with potential to enhance precision-recall trade-offs in RAG systems.

Abstract

We studied how the local topological structure of sentence-embedding neighborhoods encodes semantic ambiguity. Extending ideas that link word-level polysemy to non-trivial persistent homology, we generalized the concept to full sentences and quantified ambiguity of a query in a semantic search process with two persistent homology metrics: the 1-Wasserstein norm of and the maximum loop lifetime of . We formalized the notion of ambiguity as the relative presence of semantic domains or topics in sentences. We then used this formalism to compute "ab-initio" simulations that encode datapoints as linear combination of randomly generated single topics vectors in an arbitrary embedding space and demonstrate that ambiguous sentences separate from unambiguous ones in both metrics. Finally we validated those findings with real-world case by investigating on a fully open corpus comprising Nobel Prize Physics lectures from 1901 to 2024, segmented into contiguous, non-overlapping chunks at two granularity: tokens and tokens. We tested embedding with four publicly available models. Results across all models reproduce simulations and remain stable despite changes in embedding architecture. We conclude that persistent homology provides a model-agnostic signal of semantic discontinuities, suggesting practical use for ambiguity detection and semantic search recall.
Paper Structure (26 sections, 9 equations, 6 figures, 2 tables, 3 algorithms)

This paper contains 26 sections, 9 equations, 6 figures, 2 tables, 3 algorithms.

Figures (6)

  • Figure 1: Top Left) Simulated $W_{1}(H_{0})$ for scenario 1 (red) and scenario 2 (blue) with neighborhood scale $\varepsilon=0.4$. Top Right) Simulated $LT_{max}(H_{1})$ for scenario 1 (red) and scenario 2 (blue) with neighborhood scale $\varepsilon=0.4$. Bottom Left) Simulated $W_{1}(H_{0})$ for scenario 1 (red) and scenario 2 (blue) as a function of the relative neighborhood scaling factor $\varepsilon$. Bottom Right) Simulated $LT_{max}(H_{1})$ for scenario 1 (red) and scenario 2 (blue) as a function of the relative neighborhood scaling factor $\varepsilon$. Simulation conditions: ($D=256, N=64, n_{\text{parent}}=32,\varepsilon=0.4,\sigma_{\text{noise}}=0.1$)
  • Figure 2: Left) Simulated $W_{1}(H_{0})$ for scenario 1 (plain) and scenario 3 (dashed) as a function of the relative neighborhood scaling factor $\varepsilon$. Right) Simulated $LT_{max}(H_{1})$ for scenario 1 (plain) and scenario 2 (dashed) as a function of the relative neighborhood scaling factor $\varepsilon$. Simulation conditions: ($D=256, N=64, n_{\text{parent}}=32,\varepsilon=0.4,\sigma_{\text{noise}}=0.2$)
  • Figure 3: Left) $W_{1}(H_{0})$ KDE plot distributions for pairs of queries-corpus $(\mathcal{Q};\mathcal{C})$ chunk sets ($\mathcal{C}_{250}$;$\mathcal{C}_{750}$) and ($\mathcal{C}_{750}$;$\mathcal{C}_{250}$) in blue and red respectively for neighborhood scale $\varepsilon=0.4$. Right) Max $H_{1}$ loop lifetime KDE plot distributions for ($\mathcal{C}_{250}$;$\mathcal{C}_{750}$) and ($\mathcal{C}_{750}$;$\mathcal{C}_{250}$) in blue and red respectively with neighborhood scale $\varepsilon=0.4$.
  • Figure 4: Left) Mean $W_{1}(H_{0})$ (plain lines) and 25-75% inter-quantile range (dashed lines) for ($\mathcal{C}_{250}$;$\mathcal{C}_{750}$) and ($\mathcal{C}_{750}$;$\mathcal{C}_{250}$) in blue and red respectively as a function of the relative neighborhood scaling factor $\varepsilon$. Right) equivalent plot for $LT_{max}(H_{1})$. The presented data is for ModernBERT-base-embed model.
  • Figure 5: Top Left) Simulated $W_{1}(H_{0})$ for scenario 1 (red) and scenario 2 (blue). Top Right) Simulated $LT_{max}(H_{1})$ for scenario 1 (red) and scenario 2 (blue). Bottom Left) Simulated $W_{1}(H_{0})$ for scenario 1 (red) and scenario 2 (blue) as a function of the relative neighborhood scaling factor $\varepsilon$. Bottom Right) Simulated $LT_{max}(H_{1})$ for scenario 1 (red) and scenario 2 (blue) as a function of the relative neighborhood scaling factor $\varepsilon$. Varied simulation conditions: $\{(D=64, N=16, n_{\text{parent}}=12),(D=128, N=32, n_{\text{parent}}=16), (D=256, N=64, n_{\text{parent}}=32)\}$, Fixed simulation conditions: $\varepsilon=0.4,\sigma_{\text{noise}}=0.1$
  • ...and 1 more figures