Sonar-TS: Search-Then-Verify Natural Language Querying for Time Series Databases
Abstract
Natural Language Querying for Time Series Databases (NLQ4TSDB) aims to assist non-expert users retrieve meaningful events, intervals, and summaries from massive temporal records. However, existing Text-to-SQL methods are not designed for continuous morphological intents such as shapes or anomalies, while time series models struggle to handle ultra-long histories. To address these challenges, we propose Sonar-TS, a neuro-symbolic framework that tackles NLQ4TSDB via a "Search-Then-Verify" pipeline. Analogous to active sonar, it utilizes a feature index to "ping'' candidate windows via SQL, followed by generated Python programs to "lock on'' and verify candidates against raw signals. To enable effective evaluation, we introduce NLQTSBench, the first large-scale benchmark designed for NLQ over TSDB-scale histories. Our experiments highlight the unique challenges within this domain and demonstrate that Sonar-TS effectively navigates complex temporal queries where traditional methods fail. This work presents the first systematic study of NLQ4TSDB, offering a general framework and evaluation standard to facilitate future research.
Lay Summary
Time-based data is everywhere in industry. Common examples include temperature readings, stock prices, and factory sensor logs. When a non-expert wants to find specific information from such data, they often face a serious obstacle. For example, they might ask: "In the past month, on which day did the temperature rise sharply and then drop quickly between 10am and 3pm?" Today, no existing method can directly answer such a natural language question over a real time series database. Existing approaches fall short in different ways. Text-to-SQL methods are designed for relational databases. They cannot describe shape-based patterns that are unique to time series data. Time series language models can answer questions on short data segments. But they cannot handle the database-scale histories used in real applications. In this work, we formally define this problem as Natural Language Querying for Time Series Databases (NLQ4TSDB). We release the first benchmark, NLQTSBench, for standardized evaluation. We also propose Sonar-TS, a framework based on a Search-Then-Verify pipeline. This work is a foundational step. It establishes the task and opens the door for future research. NLQ4TSDB is a real and meaningful problem in industry. Solving it lets users quickly understand what happened over a past period, without writing code or learning a specialized query language. This can support better decision-making in monitoring, diagnostics, and operations.