atlas

Research map / Large language models / Language, safety and interpretability

SoftMatcha: A Soft and Fast Pattern Matcher for Billion-Scale Corpus Searches

ICLR 2025 · Large language models › Language, safety and interpretability · approach: Pruning and circuits in LLMs · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes SoftMatcha, a soft pattern matcher that relaxes exact n-gram matching with word-embedding similarity and uses inverted indexes to search billion-word corpora in under a second.

Problem

Corpus search tools such as grep and KWIC rely on exact surface-level matching and miss orthographic and morphological variation and paraphrase, while dense vector search is too coarse for n-gram-level queries.

Approach

Softens each pattern word into the set of vocabulary words whose embeddings have cosine similarity above a threshold (computed only over the vocabulary), then uses an inverted index union and a shifting intersection to find exact corpus positions matching the soft pattern.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use semantic relaxation in Soft-BM25 (α=0.55) instead of exact BM25 matchingBM25 on TREC-COVID · TREC-COVIDP@20: 39.5 -> 41.5Helped
Use semantic relaxation in Soft-BM25 (α=0.55) instead of exact BM25 matchingBM25 on TREC-COVID · TREC-COVIDR@1000: 22.2 -> 23.5Helped
Use semantic relaxation in Soft-BM25 (α=0.55) instead of exact BM25 matchingBM25 on TREC-COVID · TREC-COVIDNDCG@20: 34.6 -> 36.3Helped
Use soft semantic pattern matching rather than exact matchingSoftMatcha search on English Wikipedia · English Wikipedia (3.4B words), “homemade bombs” query# hits: 107 -> 1,473Helped
Use soft semantic pattern matching rather than exact matchingSoftMatcha search on Japanese Wikipedia · Japanese Wikipedia (1.1B words), “手製爆弾” query# hits: 27 -> 42Helped
Lower the cosine-similarity threshold α (ablation)SoftMatcha search on English Wikipedia · English Wikipedia, “homemade bomb” querysearch time (seconds): 0.005 at α=1.0; 1213.503 at α=0.1Mixed
Lower the cosine-similarity threshold α (ablation)SoftMatcha search on English Wikipedia · English Wikipedia, “homemade bomb” query# hits: 107 at α=1.0; 504,955,515 at α=0.1Helped
Use α below 0.2 (ablation)SoftMatcha real-time search · English Wikipedia, “homemade bomb” querysearch time (seconds): 55.854 at α=0.2; 1213.503 at α=0.1Hurt

Surprising findings

Limitations

Experimental setup

Datasets: LLM-jp corpus v2.0 (English and Japanese Wikipedia) Perseus Project Latin corpus Augustinian Sermon Parallelism (ASP) Dataset TREC-COVID

Benchmarks: TREC-COVID

Metrics: running time (seconds) number of hits P@20 R@1000 NDCG@20

Baselines: exact matching dense vector search with multilingual-e5-large BM25

Builds on: inverted index faiss HNSW BM25

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy