In-context learning for extreme multi-label classification
Top 69.6% on sourcepulse
This repository provides Infer-Retrieve-Rank (IReRa), a modular program for extreme multi-label classification (XMC) using in-context learning with large language models (LLMs) and retrievers. It targets researchers and practitioners needing to classify text into thousands or millions of categories with minimal labeled data, achieving state-of-the-art performance without fine-tuning.
How It Works
IReRa employs a novel "Infer-Retrieve-Rank" strategy, leveraging a teacher LLM to generate demonstrations for a student LLM. This approach optimizes a student model's performance on XMC tasks using only a few labeled examples. The system is built on the DSPy programming model, allowing users to customize components like LLMs, retrievers, and optimization strategies to balance cost and performance. LM calls are cached for reproducibility.
Quick Start & Requirements
802f2d5f26c1a64d8aad6adbd8b4394b9c4bb743
), and install it, followed by pip install -r requirements.txt
.lm_config.json
.bash scripts/load_data.sh
and bash scripts/load_cache.sh
.bash scripts/compile_left_to_right.sh
or bash scripts/run_left_to_right.sh
for pre-compiled results. Evaluate with python run_irera.py
or compile and run with python compile_irera.py
.Highlighted Details
Maintenance & Community
The project is maintained by Karel D'Oosterlinck. Users can follow @KarelDoostrlnck on Twitter for updates. Contributions are welcomed via issues or pull requests.
Licensing & Compatibility
The repository does not explicitly state a license in the README. Compatibility for commercial use or closed-source linking is not specified.
Limitations & Caveats
The README notes that results from run_irera.py
may differ slightly from compile_irera.py
due to potential bugs in model loading/saving. The Optimizer class's awareness of program implementation details needs to be resolved for more flexible strategy application.
1 year ago
1 week