Skip to main content

Library for Mixing Multiple Models with differential costs and performance.

Project description

AutoMix: Automatically Mixing Language Models



What is AutoMix?

The idea behind AutoMix is simple:

  1. Send a query to small language model (SLM), gets a noisy label on its correctness using few-shot self-verification done with the same model (SLM).

  2. Use a meta-verifier to double check verifier's output, and route the query to a larger language model (LLM) if needed.

Self-Verification and Meta-verification

At the center of automix is the idea of context-grounded self-verification:

  • However, such verification can often be noisy, so we introduce an additional layer of meta-verification using POMDPs or thresholding.

Notebooks

Running inference

Few-shot self-verification

  • Step2 Self Verify - Verification prompts, code to run verification on the outputs produced in step 1. Open In Colab

Meta-verification

  • Step3 Meta Verify - Run meta-verification using different AutoMix methods on outputs produced from Step 2. Open In Colab

  • You can run `pip install automix-llm' to use the meta-verifier system wide.

Replicating the results

  • To replicate the results in the paper, please run python scripts paper_results.py

Data and Outputs

  • We experiment with 5 datasets: CNLI, CoQA, NarrativeQA, QASPER, and Quality.

  • Note: The dataset are sourced from scrolls. Please cite scrolls and the appropriate sources if you use these datasets. We are making them available in a sinlge jsonl file for ease of use and reproducibility. For details on how CoQa was prepared, please see Preparing COQA.

  • Inputs: All input data for the AutoMix project is provided in automix_inputs.jsonl. You can access and download it directly from Google Drive.

  • Outputs from LLAMA2: The outputs generated using the LLAMA2 model are stored in automix_llama2_outputs.jsonl, available alongside the input file in the linked Google Drive.

id: A unique identifier for each question and answer pair.
pid: An additional identifier potentially mapping to specific instances or model variants.
base_ctx: The context.
question: Input question or query.
output: Ground truth.
dataset: .
llama13b_pred_ans: The answer generated by the llama13b model.
llama70b_pred_ans: The answer generated by the llama70b model.
llama13b_ver: Verification outputs of the llama13b model’s answers.

Stats

--------------------------------
| Dataset      | Split | Count |
|--------------|-------|-------|
| cnli         | train | 7191  |
|              | val   | 1037  |
| coqa         | train | 3941  |
|              | val   | 3908  |
| narrative_qa | train | 9946  |
|              | val   | 5826  |
| qasper       | train | 2556  |
|              | val   | 1715  |
| quality      | train | 2515  |
|              | val   | 2085  |
--------------------------------
Name: split, dtype: int64

Citation

@misc{madaan2023automix,
      title={AutoMix: Automatically Mixing Language Models}, 
      author={Aman Madaan and Pranjal Aggarwal and Ankit Anand and Srividya Pranavi Potharaju and Swaroop Mishra and Pei Zhou and Aditya Gupta and Dheeraj Rajagopal and Karthik Kappaganthu and Yiming Yang and Shyam Upadhyay and Mausam and Manaal Faruqui},
      year={2023},
      eprint={2310.12963},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

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

automix-llm-1.0.3.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

automix_llm-1.0.3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file automix-llm-1.0.3.tar.gz.

File metadata

  • Download URL: automix-llm-1.0.3.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for automix-llm-1.0.3.tar.gz
Algorithm Hash digest
SHA256 a9293358f0e4cce4048e509aa3c5cbe3c370332c1a5e24edf1d8821ea1d1151c
MD5 593a3aababa0ac4580f2712771b57875
BLAKE2b-256 f0ae9318c269f1785d2ac8ec448648b19b06e639c6fda0dbe26d59148c15041e

See more details on using hashes here.

File details

Details for the file automix_llm-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: automix_llm-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for automix_llm-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 786dd831ef60c3118b37ed7581c06e8491eef93001e9d1700d3c06b8226d21bb
MD5 3dcfe2b285dfdb7183345c894acedd82
BLAKE2b-256 c477ce4a2a91de9b8073dd0118c0e1c4cff2b3f98814a8fee7ff4390788c3ada

See more details on using hashes here.

Supported by

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