SoftMatcha 2: A Fast and Soft Pattern Matcher for Trillion-Scale Corpora
Yoneda, Masataka, Matsushita, Yusuke, Kamoda, Go, Suenaga, Kohei, Akiba, Takuya, Waga, Masaki, Yokoi, Sho
We present an ultra-fast and flexible search algorithm that enables search over trillion-scale natural language corpora in under 0.3 seconds while handling semantic variations (substitution, insertion, and deletion). Our approach employs string matching based on suffix arrays that scales well with corpus size. To mitigate the combinatorial explosion induced by the semantic relaxation of queries, our method is built on two key algorithmic ideas: fast exact lookup enabled by a disk-aware design, and dynamic corpus-aware pruning. We theoretically show that the proposed method suppresses exponential growth in the search space with respect to query length by leveraging statistical properties of natural language. In experiments on FineWeb-Edu (Lozhkov et al., 2024) (1.4T tokens), we show that our method achieves significantly lower search latency than existing methods: infini-gram (Liu et al., 2024), infini-gram mini (Xu et al., 2025), and SoftMatcha (Deguchi et al., 2025). As a practical application, we demonstrate that our method identifies benchmark contamination in training corpora, unidentified by existing approaches. We also provide an online demo of fast, soft search across corpora in seven languages.
Feb-12-2026
- Country:
- Africa > Eswatini
- Asia
- China > Hubei Province
- Wuhan (0.04)
- Japan > Honshū
- Kansai
- Kyoto Prefecture > Kyoto (0.04)
- Osaka Prefecture > Osaka (0.04)
- Kantō > Tokyo Metropolis Prefecture
- Tokyo (0.14)
- Tōhoku
- Fukushima Prefecture > Fukushima (0.04)
- Miyagi Prefecture > Sendai (0.04)
- Kansai
- Singapore (0.04)
- South Korea (0.04)
- China > Hubei Province
- Europe
- Austria
- Czechia > Prague (0.04)
- Germany
- Baden-Württemberg > Karlsruhe Region
- Karlsruhe (0.04)
- Bavaria > Upper Bavaria
- Munich (0.04)
- Baden-Württemberg > Karlsruhe Region
- Netherlands (0.04)
- North America
- Canada > Quebec
- Montreal (0.04)
- United States
- Maryland > Montgomery County
- Gaithersburg (0.04)
- Massachusetts > Suffolk County
- Boston (0.04)
- Virginia (0.04)
- Maryland > Montgomery County
- Canada > Quebec
- Genre:
- Research Report (0.82)
- Industry:
- Technology:
- Information Technology
- Artificial Intelligence
- Cognitive Science > Problem Solving (1.00)
- Machine Learning
- Neural Networks > Deep Learning (1.00)
- Pattern Recognition (1.00)
- Natural Language
- Chatbot (1.00)
- Large Language Model (1.00)
- Text Processing (0.88)
- Representation & Reasoning (1.00)
- Information Management > Search (1.00)
- Artificial Intelligence
- Information Technology