Sonar-TS: Training-Free Natural Language Querying for Massive Time Series Databases
Sonar-TS introduces a training-free framework for natural language querying of massive time series databases, defining the new NLQ4TSDB problem, creating the NLQTSBench benchmark, and using a search-then-verify approach with symbolic indexing and code-based verification to find pattern matches across millions of data points.
Introduction: An Overlooked New Problem
Recent advances in large language models and time series foundation models have enabled natural language questioning of time series (time series QA). However, a seemingly simple class of questions remains unsolved: finding all occurrences of a specific pattern in a database-scale time series, such as "which days in the past year showed a rapid rise followed by a plateau?"
Such a query requires three capabilities simultaneously: pattern understanding (MP), database-scale processing (MS), and natural language grounding (NLG). Existing methods each lack one: Text-to-SQL has scale and language but cannot understand patterns; time series QA models understand patterns and language but cannot ingest database-scale data; classic similarity search handles patterns and scale but cannot accept natural language. This gap is formally defined as the new problem NLQ4TSDB.
NLQTSBench: Measuring the New Problem
NLQTSBench is the first benchmark for NLQ4TSDB. Its key feature is scale: average search space per query is about 12,000 points, whereas prior time series QA benchmarks typically have only a few hundred points.
The benchmark contains 9 subtasks across 4 difficulty levels, totaling 1,153 queries, progressing from basic value retrieval to pattern recognition, periodicity detection, subsequence matching, composite trends, contextual anomalies, causal anomalies, and insight synthesis.
Reliability is ensured by parametric template generation: patterns matching the language description are injected into real background data at controlled signal-to-noise ratios, followed by manual visual inspection of all samples to guarantee one-to-one correspondence between language descriptions and ground-truth patterns.
Sonar-TS: Search-Then-Verify Framework
Sonar-TS operates in three stages — offline indexing, online search-then-verify, and post-processing — and requires no training.
Offline Indexing
Raw sequences are windowed at multiple scales (year, month, day). For each window, statistical primitives (slope, standard deviation, etc.) and SAX (Symbolic Aggregate Approximation) pattern symbols are precomputed and stored in a SQL-queryable feature table. Thus patterns become indexable database objects; for example, "sharp rise then sharp fall" maps to the symbolic regular expression [ab]+.*[de]+.*[ab]+.
Online Search-Then-Verify Loop
An LLM plans the query into sub-steps, generates SQL to retrieve candidate windows from the symbolic index (cheap, scalable, high recall), then generates Python code to verify each candidate on the raw signal using mature operators such as DTW (Dynamic Time Warping), PELT (Pruned Exact Linear Time) for change-point detection, and Theil-Sen regression. Execution failures are fed back for closed-loop self-correction.
Coarse search ensures no misses at scale; fine verification ensures precision on raw data. Verified intervals are assembled into natural language answers with visualizations.
Experimental Results: Leading but Far from Solved
Under the long-history (database-scale) setting, Sonar-TS achieves an overall score of 0.6144, about 3.8× the strongest Text-to-SQL baseline MAC-SQL (0.16). Under the short-context (Lite) setting, training-free Sonar-TS scores 0.30, outperforming ChatTS-14B (0.18) and other time series models. Ablation shows both symbolic coarse search and code-based fine verification are indispensable.
However, even the best-performing Sonar-TS still scores low on tasks most dependent on pattern understanding (shape recognition, composite trends). The leaderboard's real message is that all methods remain far from solving the problem — appropriate for a newly proposed direction.
Methodological Contributions and Discussion
Why It Matters: Application Value
Many high-value real-world needs are essentially pattern queries: financial risk control seeking specific anomaly shapes, operations monitoring looking for "spike-then-drop" failure precursors, industrial/energy equipment anomaly waveform identification, medical localization of specific physiological signal patterns. All share "database scale + pattern intent."
Sonar-TS makes this queryable for the first time: a single natural language sentence locates every pattern-matching segment in database-scale history. It is training-free, relies only on existing SQL and Python infrastructure, and integrates with current time series databases and monitoring stacks at low cost.
Three "firsts": first formal problem definition (NLQ4TSDB), first auditable database-scale benchmark (NLQTSBench), first training-free framework stitching retrievable symbols with executable verification (Sonar-TS).
Comparison with Related Work
vs. Text-to-SQL: Text-to-SQL retrieves at scale but SQL expresses only values, not patterns; Sonar-TS uses SAX to turn patterns into retrievable symbols.
vs. Time Series QA Models (Time-LLM, ChatTS): They understand patterns but are limited by context length; Sonar-TS replaces "read all data" with retrieval, bypassing the context bottleneck.
vs. Classic Time Series Similarity Search: It matches patterns at scale but only accepts example sequences, not natural language; Sonar-TS translates natural language intent into symbolic regex plus executable verification.
Limitations and Future Directions
Coarse search may miss candidates when SAX approximation is too coarse; a fallback to raw data is designed.
Pattern-heavy tasks remain weak; compositional semantic reasoning is unsolved.
Domain adaptation: symbol granularity and verification operators may need recalibration for out-of-distribution domains.
Online cost: verification relies on on-the-fly LLM code generation; latency and cost for complex queries need optimization.
Conclusion
Sonar-TS addresses the long-standing contradiction between "scale" and "pattern" in time series QA by combining retrievable symbols with executable verification. Rather than a final solution, it establishes a new problem, a benchmark, and a viable starting point — moving database-scale time series QA from "impossible" to "measurable and comparable."
Paper: Sonar-TS: Search-Then-Verify Natural Language Querying for Time Series Databases (ICML 2026)
ArXiv: https://arxiv.org/abs/2602.17001
Code: https://github.com/Atlamtiz/Sonar-TS
Dataset: https://huggingface.co/datasets/mrtan/NLQTSBench
Demo: https://huggingface.co/spaces/mrtan/Sonar-TS-Demo
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Data Party THU
Official platform of Tsinghua Big Data Research Center, sharing the team's latest research, teaching updates, and big data news.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
