Instruction-based Time Series Editing

Jiaxing Qiu, Thomas Hartvigsen · DOI · OpenReview

Introduction

Time Series Editing (TSE) is a critical task for counterfactual reasoning in domains such as medicine and finance. It involves modifying specific properties of a signal—like a patient's heart rate or stock market trends—while preserving the underlying characteristics of the original data. Traditional approaches to TSE have often been limited by rigid categorization and a lack of fine-grained control. Researchers have introduced InstructTime, the first framework designed to edit time series data using natural language instructions, offering a more intuitive and flexible interface for data manipulation.

The Challenge of Time Series Editing

Until now, TSE models have faced two primary hurdles. First is the issue of rigidity: existing models rely on "attribute vectors" (predefined categories like [Trend: Up, Seasonality: None]). This approach fails when a user needs to describe a nuanced change not captured by the original labels. Second is the lack of control: many diffusion-based models are "all-or-nothing," meaning they generate a result that either possesses the attribute or does not, with no way to transition gradually between states.

InstructTime allows for natural language instructions and controllable editing strength, contrasting with the rigid, attribute-based approach of prior methods.

The InstructTime Framework

InstructTime treats time series editing as a multi-modal translation task. The architecture is designed to map both time series data and natural language instructions into a shared mathematical space, enabling precise modifications.

Methodology Overview

As shown in the architecture diagram below, the system consists of several integrated components:

  • Multi-Resolution Encoder: To capture both global trends and local anomalies, the model utilizes a bank of parallel CNNs with varying kernel sizes. This ensures that hierarchical features of the time series are preserved.
  • Instruction Encoder: A pretrained text model (such as MPNet) converts natural language into a semantic vector, allowing the system to understand synonymous phrases like "a sudden drop" and "an abrupt decrease."
  • Shared Hypersphere & Interpolation: The model is trained using a CLIP-style contrastive loss to align time series and text in a shared embedding space. This structure allows for linear interpolation between the original signal and the instruction's location. By adjusting an interpolation weight ($w$), users can control the "editing strength," transitioning from a mild to a severe modification.
  • Transformer Decoder: A self-attention-based decoder takes the interpolated embeddings to reconstruct the final edited time series.
The InstructTime pipeline includes a training phase using contrastive learning to align text and time series, followed by an editing phase that uses latent space interpolation to control the strength of the requested change.

Experimental Evaluation

The model was evaluated on three benchmarks: a synthetic dataset with five controlled attributes, real-world air quality data, and a newly introduced NICU Heart Rate dataset containing over 36,000 records. This clinical dataset focuses on editing "bradycardia events" (abnormal heart rate drops) and variability.

Key Results

InstructTime achieved state-of-the-art (SOTA) performance across several key metrics:

  • Editability: It significantly outperformed diffusion-based models in reflecting requested changes. On the NICU dataset, it achieved a RaTS score of 0.18, surpassing the previous best of 0.15.
  • Preservability: The model was superior at keeping non-edited parts of the signal stable. On synthetic data, its Mean Squared Error (MSE) was 2.26, roughly 35% lower than existing methods (~3.45).
  • Few-Shot Generalization: The model demonstrated the ability to adapt to entirely new conditions with as few as one to ten examples through specialized tuning.

Conclusion and Future Work

InstructTime demonstrates that natural language can serve as a universal interface for time series manipulation. By leveraging geometric continuity in a shared embedding space, it provides a "semantic continuum" for editing. While the model excels at structural edits like trends and shifts, it currently struggles with stochastic local variability (noise) compared to diffusion models. Future research will focus on integrating diffusion mechanisms to better handle random noise and moving toward iterative, step-wise editing workflows.

Summary updated

BibTeX
@misc{qiu2025instruction,
  author = {Jiaxing Qiu and Thomas Hartvigsen},
  title = {{Instruction-based Time Series Editing}},
  year = {2025},
  eprint = {2508.01504},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.01504},
}
Figure