arXiv:2610.30593cs.DBOct 2026

Manuscript Offprint

arXiv:2610.30593

TT-SAX: A Two-Track Time Series Symbolization for Natural Language Shape Querying

Zhao Tan, Xianglong Bao, Zhipeng Xi, Ming Jin

Zhao Tan, Xianglong Bao, Zhipeng Xi, and Ming Jin (⊗)^{(\otimes)}

Griffith University, Australia

zhao.tan@griffith.edu.au, xianglong.bao@griffithuni.edu.au, z.xi@griffith.edu.au, ming.jin@griffith.edu.au

Abstract. Natural language querying for time series databases aims to let users find what they need in long histories of data by asking in plain language. Shape queries ask how a series moves. They are the main challenge of this task. Recent work makes them feasible by using symbolization as a bridge between the query and the long history. However, existing symbolizations were designed for compression, similarity indexing, or classification. What a symbolization should provide for natural language querying has not been systematically studied. We therefore examine the definitions of six classical symbolizations against this task and identify three limitations. (1) Direction is missing from the string, (2) direction is measured at too small a scale, and (3) the letters are arbitrary. Three design principles follow. We follow these principles and make a minimal redesign of SAX called TT-SAX (two-track SAX). The level letters stay. Each segment gains a trend letter. It is measured across neighboring segments rather than inside one, and graded to match the adjectives that queries use. We conduct extensive experiments on the public NLQTSBench benchmark, comparing TT-SAX with the six classical symbolizations across six LLMs. TT-SAX outperforms all six on shape queries, and ablations trace its gains back to the three limitations one by one. This paper is the first systematic study of time series symbolization with natural language querying as the design goal. It provides a foundation for future research on this task. Our code is available at https://github.com/Atlamtiz/tt-sax.

Keywords: natural language querying · time series databases · symbolic representation · shape querying

1 Introduction

Time series are among the fastest growing kinds of data. Sensors, servers, and markets produce them continuously, and time series databases (TSDBs) now store histories of billions of points. Querying has not kept pace with storage. "On which day of the past year was the closing price highest?" asks about a value, and one ordinary SQL query answers it. On the same curve, users often want to ask about shapes such as "on which days did the price plunge and then recover quickly?" Answering such shape queries at database scale remains an

Z. Tan et al.

Figure

Fig. 1. How symbolization serves a natural language shape query, illustrated with SAX. (1) Each window of the series is symbolized into a short string of letters. (2) An LLM compiles the query into a regular expression over the letters. (3) The regex runs over every window's string.

open challenge. This paper is concerned with letting non-expert users pose shape queries to a TSDB in a single sentence. This is the main challenge within natural language querying for time series databases (NLQ4TSDB) [16].

The recently proposed Sonar-TS [16] answers shape queries at database scale by using symbolization as a bridge between language and data. On one side, the time series is compressed offline into short strings of discrete symbols. On the other, a large language model (LLM) compiles the query into a regular expression over these symbols. Figure 1 shows an example. The query above, “plunge and then recover quickly”, compiles to [de]+.∗a+.∗[de]+[de]+.*a+.*[de]+. This means a run of high letters, then bottom letters, then high letters again. In this way, a shape query over a long history of raw values becomes one regular expression matched against short strings. This search is cheap enough to cover an entire database.

Sonar-TS adopts the most basic symbolization, SAX, and leaves open which symbolization suits NLQ4TSDB. Symbolization itself has a long history. SAX [8] writes one level letter per segment of a window. Its descendants add more numeric detail to the string, such as extrema, slopes, angles, and adaptive pieces [9,10,19,12,2]. These additions serve distance and classification, never an LLM. We argue that these symbolizations run into three limitations here. (1) Direction is missing. In level-only symbolizations such as SAX and ESAX [9], a rise never appears as a symbol; it is only implied by the order of level letters. A regex must then guess the level spellings of a rise, and either covers them all and matches too much, or covers a few and misses. (2) Direction is measured at too small a scale. 1d-SAX [10], TFSAX [19], and TSAX [12] do write direction, but they measure it inside a single segment. A segment is short, so the measurement follows the noise inside a long trend, and one sustained rise is written as a broken run of trend letters. Longer segments would smooth the measurement, but they would also coarsen the level letters and erase short shapes. (3) The letters are arbitrary. A shape query ultimately lands on the trend letters, yet most existing symbolizations spell them with abstract codes. For example, 1d-SAX writes a steep rise as the letter “e”. For distance functions and classifiers this is harmless, since renaming every letter changes nothing. For an LLM, whether the alphabet itself helps or hurts retrieval is a question that has received little study.

The three limitations point to three principles. Direction should be written into the string. It should be measured at the scale that queries describe. And the letters should be chosen for the LLM, not left arbitrary. We follow these principles with a minimal redesign of SAX, called TT-SAX (two-track SAX). Each window is written as two words. The level word is the SAX word, untouched. The trend word gives each segment one trend letter, measured across neighboring segments. The letter has five grades spelled F, f, s, r, R for steep fall, slow fall, stable, slow rise, and steep rise. Trend letters are not new. We choose and grade them for the LLM.

Our contributions are as follows.

– We analyze six classical symbolizations against NLQ4TSDB and identify three limitations, which yield three design principles.

– We propose TT-SAX, a minimal redesign of SAX that follows these principles. It pairs the level word with an aligned trend word, measured across neighboring segments and spelled with a mnemonic alphabet.

– We evaluate TT-SAX against the six classical symbolizations on the public NLQTSBench benchmark across six LLMs, with ablations attributing its gains to the three design choices.

References (21)