🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content
ventr1cPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decoding Time Series with LLMs: A Multi-Agent Framework for Cross-Domain Annotation

An official PyTorch implementation of "Decoding Time Series with LLMs: A Multi-Agent Framework for Cross-Domain Annotation".

Content

1. Evaluation on Downstream Imputation Tasks

To demonstrate the effectiveness of TESSA in improving the performance of various downstream tasks, we further apply the generated general annotations in time series imputation task. Specifically, time series imputation task refers to the process of filling in missing or incomplete data points in a time series dataset, where some values are randomly mask. The results are reported below:

Table: Imputation results with GPT-4o as the LLM backbone. Informer is the imputation model.

Metric Domain NoText TimeMMD DirectLLM TESSA
MSE Environment 0.9718 0.9657 0.9453 0.5698
Energy 0.9109 0.9081 0.9018 0.8690
Social Good 1.4971 0.9784 0.6873 0.5492
MAE Environment 0.6872 0.6867 0.6973 0.5438
Energy 0.8216 0.8176 0.8111 0.8075
Social Good 0.8371 0.7806 0.6036 0.5116

2. Overview

  • ./MM-TSFlib: This directory contains the code of the evaluation framework in the downstream tasks (i.e., forecasting, imputation).
  • ./processed_dataset: The directory contains the generated domain-specific and general annotations in all the datasets.
  • ./raw_dataset: The directory contains the processed datasets used in the experiments.
  • ./script: The directory contains the example scripts to run our code.
  • ./src: This directory contains the components used in TESSA.
  • ./directLLM_annotation_general_open.py The program to generation general annotations by using DirectLLM (using open-sourced LLMs).
  • ./directLLM_annotation_general.py The program to generation general annotations by using DirectLLM (using close-sourced LLMs ).
  • ./directLLM_annotation_specific_open.py The program to generation domain-specific annotations by using DirectLLM (using open-sourced LLMs).
  • ./directLLM_annotation_specific.py The program to generation domain-specific annotations by using DirectLLM (using close-sourced LLMs ).
  • ./evaluation_specific.py The program to evaluate the qualities of domain-specific annotations.
  • ./evaluation_synthetic.py The program to evaluate the qualities of general annotations in synthetic datasets.
  • ./main_construct_synthetic_dataset.ipynb The program to construct synthetic dataset.
  • ./main_decontextualization.py The program to de-contextulize the given domain-specific annotations.
  • ./main_LLMselect_general_long2short_open.py The program to generation general annotations by using TESSA (using open-sourced LLMs). Specifically, we first generate a comprehensive long general annotation and then summarize it. The features are selected by using LLMs.
  • ./main_LLMselect_general_long2short.py The program to generation general annotations by using TESSA (using close-sourced LLMs). Specifically, we first generate a comprehensive long general annotation and then summarize it. The features are selected by using LLMs.
  • ./main_LLMselect_general.py The program to generation general annotations by using TESSA. Specifically, we directly generate the short general annotations. The features are selected by using LLMs.
  • ./main_LLMselect_specific_open.py The program to generation domain-specific annotations by using TESSA. Specifically, we directly generate the short general annotations. The features are selected by using LLMs.
  • ./main_LLMselect_specific.py The program to generation domain-specific annotations by using TESSA. Specifically, we directly generate the short general annotations. The features are selected by using LLMs.
  • ./main_RL.py The program to generation general annotation and domain-specific annotations by using TESSA. Specifically, we directly generate the short general annotations. The features are selected by using RL.
  • ./main_synthetic_DirectLLM.py The program to generation general annotation annotations for the time series in the synthetic dataset by using DirectLLM.
  • ./main_synthetic_TESSA_open.py The program to generation general annotation annotations for the time series in the synthetic dataset by using TESSA. The final general annotations are generated by summarizing from the long general annotations by using open-sourced LLMs.
  • ./main_synthetic_TESSA.py The program to generation general annotation annotations for the time series in the synthetic dataset by using TESSA. The final general annotations are generated by summarizing from the long general annotations by using close-sourced LLMs.

3. Requirements

The required packages are listed in environment.yml. You can run the following code to create the environment from this file:

conda env create -f environment.yml

4. Step 1: Prepare Data

We conduct experiments on 5 real-world datasets and a synthetic dataset. Specifically, the real-world datasets, Finance dataset is in ./raw_dataset/Investtech. The rest four datasets (i.e., Energy, Environment, Health_US and SocialGood) are in raw_dataset/Time-MMD/. The time series data are in raw_dataset/Time-MMD/numerical and raw_dataset/Time-MMD/textual. More details of these four datasets can be found in Time-MMD [paper].

5. Step 2: Generate Domain-decontextualized Annotations

To generate domain-decontextualized annotations and remove domain-specific context from the data, we run:

python main_decontextualization.py 

6. Step 3: Generate General Annotations

In this step, we extra time-series-wise and text-wise Use either open- or close-sourced LLMs with TESSA or DirectLLM to generate general annotations. To use close-sourced LLMs, please run:

# use offline LLM-based feature selection
python main_LLMselect_general.py # use close-sourced LLMs

python main_LLMselect_general_open.py # use open-sourced LLMs (e.g., Llama-3.1 8B, Qwen2-7B)

# use incremental reinforment learning-based feature selection
python main_RL.py

If you want to general general annotation for the time series in synthetic dataset by using TESSA, please run:

python main_synthetic_TESSA.py

7. Step 4: Generate Domain-specific Annotations

After generating general annotations, we run the following code to convert the general annotations to domain-specific annotations by using domain-specific annotation agent:

python main_LLMselect_specific.py # use close-sourced LLMs

python main_LLMselect_specific_open.py # or use open-sourced LLMs (e.g., Llama-3.1 8B, Qwen2-7B)

8. Running the Baseline: DirectLLM

To run the baseline, DirectLLM, to generate the general annotations and domain-specific annotations, we can run the following codes, respectively:

python directLLM_annotation_general.py

python directLLM_annotation_specific.py

If you want to general the general annotations for the time series data in the synthetic dataset, please run:

python main_synthetic_DirectLLM.py

9. Evaluate Peformance in the Downstream Tasks

To evaluate the perfomrance of general annotations, we use the MM-TSFlib to implement the time series forecasting and implutation tasks. We first enter the MM-TSFlib:

cd MM-TSFlib

To run the downstream task, you can refer to the shell scripts in ./MM-TSFlib/scripts. For example, to evaluate the quality of the generated general annotations in the Environment dataset in time series forecasting and imputation tasks, you can run the following code:

bash scripts/environment.sh 0 1 1 TESSA Environment gpt-4o  # Forecasting

bash scripts/environment_imp.sh 0 1 2 TESSA Environment gpt-4o  # Imputation

To evaluate the performance of the general annotations in the synthetic dataset:

python evaluate_synthetic.py

To evaluate the performance of the domain-specific annotations:

python evaluate_specific.py

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages