Skip to content
/ ReACT Public

source code for paper "From Parameter to Representation: A Closed-Form Approach for Controllable Model Merging" (AAAI2026)

License

Notifications You must be signed in to change notification settings

CREAHDD/ReACT

Repository files navigation

From Parameter to Representation: A Closed-Form Approach for Controllable Model Merging

AAAI 2026 arXiv FusionBench

This repository contains the official implementation for the AAAI 2026 paper: "From Parameter to Representation: A Closed-Form Approach for Controllable Model Merging".

ReACT shifts the controllable merging paradigm from expensive parameter-space optimization to a closed-form linear correction in the representation space. It enables on-the-fly generation of Pareto-optimal models with minimal computational cost.

💡 Method Overview

ReACT Method Overview

Figure 2: An overview of our proposed method, illustrated with a two-task ($T=2$) example. (a) We first identify that model merging causes representation distortion: the feature distribution of a merged model deviates from that of an individual task model. (b) We propose to correct this by finding a linear correction matrix $\hat{W}t$ for each task, which has a closed-form solution. (c) Finally, we derive a Pareto-optimal transformation $W\mathbf{p}$ by analytically aggregating the individual corrections based on a user preference vector $\mathbf{p}$.

Dependencies

This project is built upon the FusionBench framework. This modular design allowing easy switching between various merging methods (e.g., AdaMerging, TIES), models, and tasks.

Installation

# Clone this repository
git clone https://github.com/CREAHDD/ReACT.git
cd ReACT

# Install dependencies
pip install -r requirements.txt

Note: Ensure fusion_bench is properly set up in your environment or included in the python path as per the project structure.

Data & Model Preparation

Please organize your project directory as follows.

1. Download Checkpoints

The pre-trained and fine-tuned checkpoints for CLIP ViT-B/32 used in this work are sourced from the Task Vectors repository.

  • Download the models and place them in models/ViT-B-32/.
  • Ensure you have the fine-tuned weights for the 8 tasks (Cars, DTD, EuroSAT, GTSRB, MNIST, RESISC45, SUN397, SVHN).

2. Directory Structure

.
├── config/                 # Hydra configs for ReACT and Evaluation
├── fusion_bench/           # Core framework (submodule/library)
├── models/
│   ├── ViT-B-32/           # Place downloaded checkpoints here
│   │   ├── Cars/finetuned.pt
│   │   ├── ...
│   │   └── zeroshot.pt
│   └── merging_weights/    # Pre-calculated merging weights (if any)
├── scripts/                # Shell scripts for building and evaluating
├── main.py                 # Script to build ReACT artifacts (Calculate correction matrices)
├── evaluate.py             # Script to evaluate with preference vectors
└── ...

🚀 Quick Start

1. Build ReACT Artifacts

First, run main.py to perform the base merge (e.g., AdaMerging) and calculate the representation correction matrices (ReACT). This saves a lightweight .pt artifact.

You can use the provided script:

bash scripts/build_ReACT.sh

Or run manually:

# Example: 8-task AdaMerging + ReACT with 100% calibration data
python main.py \
    --config-name ReACT_ada_TA8 \
    post_method.calibration_dataset.calibration_set_ratio=1 \
    post_method.artifact_path='outputs/AM_ReACT_100cal.pt'

2. Evaluate with Preferences

Once the artifact is generated, use evaluate.py to evaluate the merged model under different user preferences (Pareto front exploration) without re-running the merging process.

You can use the provided script:

bash scripts/eval_ReACT.sh

Or run manually (e.g., Equal preference across all tasks):

python evaluate.py \
    --config-name evaluate_ReACT \
    experiment_name=AM_ReACT_equal \
    evaluation_mode.mode=equal \
    artifact_path="outputs/AM_ReACT_100cal.pt" \
    adamerging_weights="models/merging_weights/AM_weights.pt"

Configuration

  • config/ReACT_ada_TA8.yaml: Configuration for the merging process and ReACT calculation.
  • config/evaluate_ReACT.yaml: Configuration for evaluation modes.
    • Supported evaluation_mode.mode: manual, random, grid, priority, onehot, subspace_sample, equal.
    • Supported interpolation_method: linear_pareto (Ours), average, geometric, polar.

Citation

If you find this work useful, please cite our paper:

@inproceedings{wu2026react,
  title={From Parameter to Representation: A Closed-Form Approach for Controllable Model Merging},
  author={Wu, Jialin and Yang, Jian and Wang, Handing and Wen, Jiajun and Yu, Zhiyong},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  year={2026}
}

About

source code for paper "From Parameter to Representation: A Closed-Form Approach for Controllable Model Merging" (AAAI2026)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published