Skip to main content

Toolkit for Active Learning in Generative Tasks

Project description

ATGen: Active Learning for Natural Language Generation

License: MIT

A comprehensive toolkit for applying active learning techniques to natural language generation tasks. This repository contains implementations of various active learning strategies specifically designed for text generation models, helping to reduce annotation costs while maximizing model performance.

🌟 Features

  • Multiple Active Learning Strategies: Implementation of strategies like HUDS, HADAS, FAC-LOC, IDDS, and more
  • Flexible Model Support: Compatible with various language models (Qwen, Llama, etc.)
  • Comprehensive Evaluation: Supports multiple evaluation metrics including ROUGE, BLEU, BERTScore, AlignScore, etc.
  • Interactive Visualization: Streamlit dashboard for exploring results and comparing strategies
  • Hydra Configuration: Easily configurable experiments through Hydra's YAML-based configuration system
  • PEFT Integration: Efficient fine-tuning using Parameter-Efficient Fine-Tuning methods

📋 Requirements

  • Python 3.10+
  • CUDA-compatible GPU (for model training)
  • Dependencies listed in requirements.txt

🔧 Installation

  1. Clone the repository:

    git clone https://github.com/Aktsvigun/atgen.git
    cd atgen
    
  2. Run the installation script:

    bash install.sh
    

    This will install:

    • All required Python packages
    • External metrics (submodlib, AlignScore)
    • Required NLP resources

🚀 Usage

Running Active Learning Experiments

Experiments can be launched using the run-al command:

CUDA_VISIBLE_DEVICES=0 HYDRA_CONFIG_NAME=base run-al

Parameters:

  • CUDA_VISIBLE_DEVICES: Specify which GPU to use
  • HYDRA_CONFIG_NAME: Configuration file (e.g., base, custom, test)

Additional parameters can be overridden via the command line following Hydra's syntax:

CUDA_VISIBLE_DEVICES=0 HYDRA_CONFIG_NAME=base run-al al.strategy=huds model.checkpoint=Qwen/Qwen2.5-7B

Interactive Dashboard

Launch the Streamlit application to explore and visualize your experiments:

streamlit run Welcome.py

Navigate to http://localhost:8501 in your web browser to access the dashboard.

📁 Project Structure

  • configs/: Configuration files for experiments
    • al/: Active learning strategy configurations
    • data/: Dataset configurations
    • labeller/: Labeller configurations
  • src/atgen/: Main package
    • strategies/: Implementation of active learning strategies
    • metrics/: Code for evaluation metrics
    • utils/: Utility functions
    • run_scripts/: Scripts for running experiments
    • labellers/: Labelling mechanisms
    • visualize/: Visualization tools
  • pages/: Streamlit application pages
  • outputs/: Experimental results storage
  • cache/: Cached computations to speed up repeated runs

📚 Supported Active Learning Strategies

  • huds: Hypothetical Document Scoring
  • hadas: Harmonic Diversity Scoring
  • random: Random sampling baseline
  • fac-loc: Facility Location strategy
  • idds: Improved Diverse Density Scoring
  • And more...

📊 Supported Datasets

The toolkit comes pre-configured for several datasets including summarization, question answering, and other generative tasks. Custom datasets can be added by creating new configuration files.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📜 License

This project is licensed under the MIT License - see the LICENSE.md file for details.

🔗 Citation

If you use this toolkit in your research, please cite:

@software{atgen,
  title = {ATGen: Active Learning for Natural Language Generation},
  url = {https://github.com/Aktsvigun/atgen},
  year = {2025},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atgen-0.0.0.dev2.tar.gz (56.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atgen-0.0.0.dev2-py3-none-any.whl (74.2 kB view details)

Uploaded Python 3

File details

Details for the file atgen-0.0.0.dev2.tar.gz.

File metadata

  • Download URL: atgen-0.0.0.dev2.tar.gz
  • Upload date:
  • Size: 56.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for atgen-0.0.0.dev2.tar.gz
Algorithm Hash digest
SHA256 f40036b5d27074f912d797f1f3e7916a231e7ba67f4365c284a708a746a55c48
MD5 14c4491759481d1750d9d238bb32293a
BLAKE2b-256 59f7a8f6d5097153d603481a1a142825df35d45201f3999216c2764814f7a3c0

See more details on using hashes here.

File details

Details for the file atgen-0.0.0.dev2-py3-none-any.whl.

File metadata

  • Download URL: atgen-0.0.0.dev2-py3-none-any.whl
  • Upload date:
  • Size: 74.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for atgen-0.0.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 662df41ce97a16605eba75d05a9e07ed323f7bf2862807d0f60fefb535cdcebe
MD5 768c2e2bb31b4d21822230ee9bf02d7b
BLAKE2b-256 4c88a475ed2f93af899431f79ff92b856e946ae4ba38078a68b5da91a96a3286

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page