This repository provides the official implementation of METIS, a many-shot model merging framework designed to mitigate task interference and information erasure in large language models.
conda create -n metis python=3.10 -y
conda activate metispip install -r metis_requirements.txt(Optional) For evaluation:
pip install -r lmeval_requirements.txt
pip install -r safety-eval_requirements.txtThe main entry point is main_proposed.py, which uses fire for command-line arguments.
python main_proposed.py run_balanced_model_merging \
--global_model meta-llama/Llama-3.2-3B \
--data_path ./data \
--output_dir ./lora-model_ \
--num_clients 4 \
--num_communication_rounds 5All arguments and default values are defined in the balanced_model_merging() function in main_proposed.py.
Merged LoRA adapters are saved under:
lora-model_/<num_clients>/<round>/adapter_model_round<r>.bin
The final merged adapter is also saved as:
lora-model_/<num_clients>/adapter_model.bin
To evaluate the merged models on multiple benchmarks:
bash evaluate_all.sh