TIGER-AI-Lab/LongICLBench

Code and Data for "Long-context LLMs Struggle with Long In-context Learning" [TMLR2025]

113

stars

27

commits

Python

primary language

Feb 20, 2025

updated

arxiv.org/abs/2404.02060
large-language-models

README

🐍 LongICLBench

This repo contains the official code and data for our TMLR25 paper Long-context LLMs Struggle with Long In-context Learning

πŸ€— HuggingFace Dataset

🌟 Leaderboard

We created LongICLBench to conduct comprehensive evaluations of Large Language Models (LLMs) on extreme-label classification challenges with in-context learning. We compiled six datasets that encompass a broad spectrum of labels, ranging from 28 to 174 categories, and varied the lengths of input (from few-shot demonstrations) between 2K and 50K tokens to ensure thorough testing Our principal discoveries reveal:

  • 1️⃣ A notable decline in the performance of even the most advanced models as the complexity of the tasks increases.
  • 2️⃣ In the most challenging scenarios, especially those with 174 classes, models find it difficult to discern subtle differences.
  • 3️⃣ The performance of certain models is sensitive to the position of the instances in the demonstrations.

πŸ› οΈ Set up

git clone https://github.com/TIGER-AI-Lab/LongICLBench.git
cd LongICLBench
pip install -r requirements.txt

🌈 Benchmarking

We collect six extreme-label classification datasets with details as below:

DatasetTask Type#Classes#Tokens/Shot#Total Tokens
GoEmotionEmotion Classification2828[1K, 4K]
BANKING77Intent Classification7728[2K, 11K]
TecREDRelation Extraction4180[4K, 18K]
Few-NERDEntity Recognition6661[5K, 23K]
DialogRERelation Extraction36226[8K, 32K]
DiscoveryDiscourse Marker Classification17461[10K, 50K]

πŸŽ–οΈ Model Evaluation

We evaluate the performance of 13 long-context large language models. Their information are presented as follows:

ModelSizeInitializationStrategyTrainSupport
Gemma-7B-base7BGemmaRoPE + LF8K8K
LLaMA-2-7B-32K7BLLaMA-2Position Interpolation32K32K
ChatGLM3-6B-32K6BChatGLMPosition Encoding Scheme32K32K
Qwen-1.5-7B-base7BQwenRoPE32K32K
Mistral-7B-v0.2-base7BMistralLF32K32K
LLaMA-2-7B-LongLora7BLLaMA-2Shifted Short Attention100K100K
Yi-6B-200K6BYiPosition Interpolation +LF200K200K
InternLM2-7B-base7BInternLMDynamic NTK32K200K
Long-LLaMA-code-7B7BLLaMA-2Focused Transformer8K256K
RWKV-5-World3BRWKVAttention-free Model4K∞
Mamba-2.8B2.8BMambaState Space Model2K∞
GPT4-turbo-GPT-4--128K
GPT4o-GPT-4--128K
Cluade3-Opus-Cluade3--200K
Gemini1.5-Pro-Gemini--10M

The evaluation results for some of the datasets is presented as follows: (Please check more details in our paper)

πŸ•ΉοΈ Run the script to re-obtain the demonstrated results: (You can just set [api_key] to '' for the locally deployed models)

sh script_goemotion.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_bank77.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_fewnerd.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_tacred.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_dialogue.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_discovery.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]

To evaluate the results for Few-NERD and DialogRE with F1 score:

python fewnerd_evaluate.py --model [model_short_name] --round [number_of_rounds]
python dialogueRE_evaluate.py --model [model_short_name] --round [number_of_rounds]

πŸ–ŠοΈ Citation

Please kindly cite our paper if you find our study useful:

@misc{li2024longcontext,
      title={Long-context LLMs Struggle with Long In-context Learning}, 
      author={Tianle Li and Ge Zhang and Quy Duc Do and Xiang Yue and Wenhu Chen},
      year={2024},
      eprint={2404.02060},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Contributors

ltl3A87

27 commits

TIGER-AI-Lab/LongICLBench

Code and Data for "Long-context LLMs Struggle with Long In-context Learning" [TMLR2025]

113

stars

27

commits

Python

primary language

Feb 20, 2025

updated

arxiv.org/abs/2404.02060
large-language-models

README

🐍 LongICLBench

This repo contains the official code and data for our TMLR25 paper Long-context LLMs Struggle with Long In-context Learning

πŸ€— HuggingFace Dataset

🌟 Leaderboard

We created LongICLBench to conduct comprehensive evaluations of Large Language Models (LLMs) on extreme-label classification challenges with in-context learning. We compiled six datasets that encompass a broad spectrum of labels, ranging from 28 to 174 categories, and varied the lengths of input (from few-shot demonstrations) between 2K and 50K tokens to ensure thorough testing Our principal discoveries reveal:

  • 1️⃣ A notable decline in the performance of even the most advanced models as the complexity of the tasks increases.
  • 2️⃣ In the most challenging scenarios, especially those with 174 classes, models find it difficult to discern subtle differences.
  • 3️⃣ The performance of certain models is sensitive to the position of the instances in the demonstrations.

πŸ› οΈ Set up

git clone https://github.com/TIGER-AI-Lab/LongICLBench.git
cd LongICLBench
pip install -r requirements.txt

🌈 Benchmarking

We collect six extreme-label classification datasets with details as below:

DatasetTask Type#Classes#Tokens/Shot#Total Tokens
GoEmotionEmotion Classification2828[1K, 4K]
BANKING77Intent Classification7728[2K, 11K]
TecREDRelation Extraction4180[4K, 18K]
Few-NERDEntity Recognition6661[5K, 23K]
DialogRERelation Extraction36226[8K, 32K]
DiscoveryDiscourse Marker Classification17461[10K, 50K]

πŸŽ–οΈ Model Evaluation

We evaluate the performance of 13 long-context large language models. Their information are presented as follows:

ModelSizeInitializationStrategyTrainSupport
Gemma-7B-base7BGemmaRoPE + LF8K8K
LLaMA-2-7B-32K7BLLaMA-2Position Interpolation32K32K
ChatGLM3-6B-32K6BChatGLMPosition Encoding Scheme32K32K
Qwen-1.5-7B-base7BQwenRoPE32K32K
Mistral-7B-v0.2-base7BMistralLF32K32K
LLaMA-2-7B-LongLora7BLLaMA-2Shifted Short Attention100K100K
Yi-6B-200K6BYiPosition Interpolation +LF200K200K
InternLM2-7B-base7BInternLMDynamic NTK32K200K
Long-LLaMA-code-7B7BLLaMA-2Focused Transformer8K256K
RWKV-5-World3BRWKVAttention-free Model4K∞
Mamba-2.8B2.8BMambaState Space Model2K∞
GPT4-turbo-GPT-4--128K
GPT4o-GPT-4--128K
Cluade3-Opus-Cluade3--200K
Gemini1.5-Pro-Gemini--10M

The evaluation results for some of the datasets is presented as follows: (Please check more details in our paper)

πŸ•ΉοΈ Run the script to re-obtain the demonstrated results: (You can just set [api_key] to '' for the locally deployed models)

sh script_goemotion.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_bank77.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_fewnerd.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_tacred.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_dialogue.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]
sh script_discovery.sh [model_short_name] [CUDA_DEVICES] 500 [api_key]

To evaluate the results for Few-NERD and DialogRE with F1 score:

python fewnerd_evaluate.py --model [model_short_name] --round [number_of_rounds]
python dialogueRE_evaluate.py --model [model_short_name] --round [number_of_rounds]

πŸ–ŠοΈ Citation

Please kindly cite our paper if you find our study useful:

@misc{li2024longcontext,
      title={Long-context LLMs Struggle with Long In-context Learning}, 
      author={Tianle Li and Ge Zhang and Quy Duc Do and Xiang Yue and Wenhu Chen},
      year={2024},
      eprint={2404.02060},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Contributors

ltl3A87

27 commits

Languages

Python

96.6%

Shell

3.4%