Lu Li†, Tianyu Zhang†, Zhiqi Bu†, Suyuchen Wang, Huan He, Jie Fu, Yonghui Wu, Jiang Bian, Yong Chen, Yoshua Bengio
† Equal contribution
conda env create -f environment.yaml
conda activate map
git clone https://github.com/mlfoundations/task_vectors # we used the zero-shot task vectors from this repo
python run_MAP.py # check the args.py for the hyperparameters and 4 modes
The overall process of MAP under 2 tasks.
- Step 1: select tasks and their corresponding task vectors.
- Step 2: sample a few scaling weights
$c$ to query the task metrics accordingly. - Step 3: use a quadratic model to approximate the mapping of
$c \rightarrow \textit{metrics}$ as a surrogate model. - Step 4: use NSGA-III (or other multi-objective optimization algorithms) to find amortized Pareto fronts.
Figure (a) shows the contour plots of the actual accuracy landscape for the ViT models obtained from 100 scaling coefficients (sampled uniformly) evaluated on the SUN397 and Cars.
Figure (b) shows the contour plots of the fitted quadratic functions. Red lines represent the Pareto front in the decision variable
Figure (c) shows an example of the Pareto Front. Pareto front (Grid search) is regarded as the ground truth given the enough number of grid points. Pareto front (MAP, predicted) is the amortized Pareto front. Pareto front (MAP, real) is the Pareto front involving the same
Given a preference weights vector [a,b,c,d]
. In the following example, it is the example_preferece.yaml
file.
- According to the losses on single task, first, we merge Cars and SVHN models according to the amortized Pareto Front and the preference
[a, b]
. - In the mean time, we merge SUN397 and DTD models according to the amortized Pareto Front and the preference
[c, d]
. - Finally, we merge the merged Cars+SVHN and SUN397+DTD models according to the amortized Pareto Front and the preference
[a + b, c + d]
.
Merge Cars and SVHN Models
|
Merge SUN397 and DTD Models
|
Merge SUN397+DTD and Cars+SVHN Models
|
python MAP/run_MAP.py \
--zeroshot-merge-models SUN397Val CarsVal DTDVal SVHNVal EuroSATVal GTSRBVal RESISC45Val \
--zeroshot-eval-datasets SUN397Val CarsVal DTDVal SVHNVal EuroSATVal GTSRBVal RESISC45Val \
--preference example_preferece.yaml \
--results-path nested_experiments8
# Example of the example_preferece.yaml
{
"SUN397Val": 1,
"CarsVal": 2,
"DTDVal": 6,
"SVHNVal": 5,
"EuroSATVal": 4,
"GTSRBVal": 3,
"RESISC45Val": 7,
}