Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Code and data for "Timo: Towards Better Temporal Reasoning for Language Models" (COLM 2024)

NotificationsYou must be signed in to change notification settings

zhaochen0110/Timo

Repository files navigation

This repository contains the code, data, and models for the paper "TIMO: Towards Better Temporal Reasoning for Language Models", accepted at COLM 2024.

Table of Contents

📌Introduction

We introduceTIMO 🌱, a series of open-source large language models (LLMs) designed fortemporal reasoning. TIMO models are trained on self-generated temporal preference pairs and optimized with a novelself-critic temporal optimization method, enabling the models to excel in both temporal reasoning and general tasks. TIMO is the new state-of-the-art for temporal reasoning across 19 tasks while maintaining robust general task performance.

🚀Models

Our models are available on Hugging Face:

📊Datasets

We have uploaded all datasets used in various stages of training to Hugging Face. You can access them via the links below:

🌟Highlights

TIMO achieves state-of-the-art results in temporal reasoning tasks. Here are the key results for 7B and 13B models:

7B Parameter Model

ModelMath-time AvgPure-time AvgAverage
Timo64.478.0772.7
MAmmoTH57.0862.7160.0
WizardMath58.861.2659.9
CodeLlama54.5564.1059.8
LLaMA257.6566.3062.7
WizardCoder53.0559.8357.8
ToRA51.0365.7158.2
TimeLLaMA48.329.038.6

13B Parameter Model

ModelMath-time AvgPure-time AvgAverage
Timo72.8382.9778.3
MAmmoTH70.6869.5272.1
LLaMA266.1870.4270.7
WizardMath63.6570.6268.4
WizardCoder61.666.0865.9
CodeLlama63.5567.0565.7
ToRA57.8568.9065.6

⚙️Installation

Clone this repository and install the required dependencies:

git clone https://github.com/zhaochen0110/Timo.gitcd Timopip install -r requirements.txt

🛠️Training and Inference

Quick Start

To quickly start using TIMO, run the following code:

fromtransformersimportpipelinepipeline=pipeline("text-generation","Warrieryes/timo-7b-hf")template='''Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{query}\n\n### Response:'''query="What is 08:32 AM - 04:28?\n (A) 6:10 AM\n (B) 2:49 AM\n (C) 6:17 AM\n (D) 4:04 AM"input=template.format(query=query)output=pipeline(input)[0]['generated_text']print(output)

Large-scale Evaluation

To replicate the experimental results in our paper, run:

python inference.py \    --model_path$model_path \    --data_path$data_path \    --excel_folder$excel_folder \    --output_path$output_path

Self-critic Temporal Preference Generation

We use theMAmmoTH project's code to train mathematical models. Then we use the following code to generate Temporal Preference pairs:

python generate.py \    --model_path$model_path \    --generate True \    --train_data_path$train_data_path \    --score True \    --save_path$save_path

Temporal direct preference optimization

After generating preference pairs, we use Direct Preference Optimization (DPO) to train the model:

python tdpo.py \    --model_name_or_path$model_name_or_path \    --json_path$json_path \    --output_dir$output_dir

📜 License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.

🙏 Acknowledgements

This project is partly based on the work done inMAmmoTH. Special thanks to their authors for valuable contributions.

📖 Citation

Please cite our paper if you use our data, model or code. Please also kindly cite the original dataset papers.

@article{su2024timo,  title={Timo: Towards Better Temporal Reasoning for Language Models},  author={Su, Zhaochen and Zhang, Jun and Zhu, Tong and Qu, Xiaoye and Li, Juntao and Zhang, Min and Cheng, Yu},  journal={arXiv preprint arXiv:2406.14192},  year={2024}}

About

Code and data for "Timo: Towards Better Temporal Reasoning for Language Models" (COLM 2024)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp