Shared Pretrained Encoder
CLIP-pretrained ViT-L/14 reference encoder.
Reinforcement Learning Final Project 2026
We turn model merging into a sequential decision problem: an RL policy visits each layer, observes task-vector geometry and coefficient history, then chooses how much each source model should contribute to the merged model.
Model merging combines several task-specific models into one unified model without retraining the full network. It is useful for multi-task learning and efficient deployment, but it becomes difficult when task vectors point in conflicting directions.
MMCR studies whether reinforcement learning can learn better layer-wise merging decisions than fixed rules. Instead of applying one global coefficient to the whole model, the policy chooses an adaptive coefficient vector for each mergeable layer.
Different tasks may update the same layer with different magnitudes or directions, so a fixed merging rule can be too coarse.
Early layer decisions affect the partially merged model and can change what later layer decisions should look like.
The merged model is usually evaluated after multiple layers, making it hard to know which coefficient choices helped most.
CLIP-pretrained ViT-L/14 reference encoder.
Downloaded fine-tuned encoders with trained task heads.
Compute encoder task vectors from model differences.
Remove weak updates and reduce sign conflicts before RL search.
Norms, cosine similarity, layer statistics.
64-sample entropy batches per task.
States, actions, rewards, coefficient history.
Layer progress, current-layer task-vector geometry, the full coefficient table, and an updated-layer mask.
A raw Gaussian action is transformed into non-negative coefficients for the K source task vectors.
Merge only the current layer.
Negative prediction entropy on small reward subsets, plus a standard-deviation penalty for task balance.
Advance until the terminal layer.
Visit layers sequentially, collect returns, then update the policy.
GRPO updates the policy from groups of full merging trajectories. RLOO uses the other trajectories as a leave-one-out baseline, so advantages are relative and no critic is needed.
The best coefficient table observed during training constructs the final merged encoder.
Evaluate task heads on full test splits.
Given K fine-tuned source models and one shared pretrained model, MMCR represents each source model as a task vector. For layer l and source model k, the task vector is the parameter difference between the fine-tuned model and the pretrained backbone. The merged layer is constructed by adding a weighted sum of task vectors back to the pretrained layer.
One episode corresponds to constructing one complete merged model. At each step, the environment focuses on one mergeable layer, writes the policy-selected coefficient vector into that layer, updates the coefficient table, and advances to the next layer. This turns model merging from a one-shot coefficient search into a trajectory-level optimization problem.
MMCR uses a stochastic Gaussian policy and optimizes it with a GRPO-style objective. Each update samples a group of complete merging trajectories. Instead of learning a separate value function, the method computes a return leave-one-out baseline from the other trajectories in the same group.
The compared model merging baselines include Task Arithmetic, TIES, DARE-TA, NAN-TA, and AdaMerging. For methods that require data during coefficient optimization, the reward or validation sample budget is aligned with MMCR whenever possible, so a method does not gain advantage simply by using more optimization samples.
MMCR achieves the best average accuracy among the compared merging methods and remains competitive against longer-running AdaMerging baselines.
| Method | SUN397 | Cars | RESISC45 | EuroSAT | SVHN | GTSRB | MNIST | DTD | Avg. |
|---|---|---|---|---|---|---|---|---|---|
| TIES | 76.11 | 83.93 | 83.65 | 80.66 | 84.70 | 89.14 | 89.29 | 65.53 | 81.63 |
| AdaMerging-300 epochs | 78.20 | 85.56 | 87.67 | 83.50 | 68.45 | 86.81 | 61.74 | 70.96 | 77.86 |
| AdaMerging-500 epochs | 78.71 | 87.58 | 90.21 | 88.14 | 88.13 | 89.37 | 91.45 | 72.87 | 85.81 |
| AdaMerging-600 epochs | 78.70 | 87.66 | 90.62 | 88.78 | 89.08 | 89.79 | 92.61 | 73.67 | 86.36 |
| MMCR (ours) | 77.57 | 89.11 | 89.06 | 85.72 | 90.65 | 89.96 | 92.54 | 76.64 | 86.41 |
MMCR improves average accuracy from 81.63% to 86.41%, showing that learned layer-wise coefficients add value beyond preprocessing alone.
MMCR slightly outperforms AdaMerging-600 epochs while using a trajectory-based optimization structure that parallelizes naturally.
| Method | Avg. Accuracy | Role in the experiment |
|---|---|---|
| Pretrained model | 65.12 | Lower reference before task-specific fine-tuning. |
| Fine-tuned source models | 93.06 | Upper reference before compression into one merged model. |
| Task Arithmetic (0.3) | 78.67 | Simple linear task-vector merging baseline. |
| DARE-TA | 78.29 | Task arithmetic with dropped and rescaled updates. |
| NAN-TA | 73.37 | Training-free coefficient estimation baseline. |
| TIES | 81.63 | Strong data-free task-vector conflict reduction baseline. |
| AdaMerging-500 epochs | 85.81 | Strong data-based coefficient optimization baseline. |
| AdaMerging-600 epochs | 86.36 | Longer data-based coefficient optimization baseline. |
| MMCR (ours) | 86.41 | Sequential RL-based layer-wise merging with TIES preprocessing and GRPO + RLOO. |
| Method | GPUs Used | Runtime | Time (min) | Avg. Acc. |
|---|---|---|---|---|
| TIES | No (CPU) | 3m 14s | 3.23 | 81.63 |
| AdaMerging-300 epochs | 1 GPU | 3h 05m 00s | 185.00 | 77.86 |
| AdaMerging-500 epochs | 1 GPU | 5h 56m 52s | 356.87 | 85.81 |
| AdaMerging-600 epochs | 1 GPU | 6h 58m 54s | 418.90 | 86.36 |
| MMCR (ours) | 1 GPU | 4h 05m 10s | 245.17 | 86.41 |
| MMCR (ours) | 2 GPUs | 2h 35m 58s | 155.97 | 86.41 |
The final two-GPU MMCR run gives about a 1.57x wall-clock speedup. The gain is useful, while synchronization and policy-update overhead prevent perfect scaling.
Using TIES improves MMCR from 83.69% to 86.41% average accuracy. The largest gains appear on MNIST and EuroSAT.
GRPO + RLOO reaches 86.41%, while PPO reaches 78.19%. Group-relative advantages are more stable for this sparse, expensive reward setting.
Terminal-only reward is efficient at 86.23%, while interval 6 reaches 86.57% with higher runtime. Reward density improves accuracy but costs more.
Transfer works well for related two-task groups, but becomes weaker for three-task or unrelated transfers, suggesting task similarity matters.
| Setting | Avg. Accuracy | Conclusion |
|---|---|---|
| MMCR without TIES | 83.69 | Raw task vectors contain noisy or conflicting updates. |
| MMCR with TIES | 86.41 | TIES improves the search space and gives a +2.72 point gain. |
| Method | Avg. Accuracy | Time (min) | Interpretation |
|---|---|---|---|
| PPO | 78.19 | 24.50 | Fast, but unstable in this sparse reward setting. |
| Dr. GRPO | 82.73 | 148.47 | Removing group standard-deviation normalization hurts performance. |
| DAPO-lite | 86.05 | 393.93 | Competitive but too expensive due to resampling overhead. |
| GSPO | 86.32 | 151.18 | Very close to GRPO, using trajectory-level policy ratios. |
| MMCR | 86.41 | 155.97 | Best accuracy and selected as the final MMCR optimizer. |
| Reward Setting | Avg. Accuracy | Time (min) | Conclusion |
|---|---|---|---|
| Terminal-only | 86.23 | 50.40 | Most efficient; final reward is already informative. |
| Interval 13 | 86.41 | 155.97 | Final setting; balances reward density and runtime. |
| Interval 6 | 86.57 | 247.37 | Slightly higher accuracy but more expensive. |
EuroSAT/SVHN → RESISC45/MNIST
EuroSAT/SVHN/DTD → RESISC45/MNIST/GTSRB
EuroSAT/RESISC45 → MNIST/SVHN
Formulating model merging as a sequential layer-wise RL problem lets the policy adapt coefficients across layers instead of relying on a single fixed merging rule.
The strongest configuration combines TIES-preprocessed task vectors, positive coefficient transformation, entropy-based reward, and GRPO with return leave-one-out advantages.
MMCR reaches 86.41% average accuracy across eight vision tasks, improving over TIES and slightly outperforming the longer-running AdaMerging-600 epochs baseline.
Reward evaluation is still expensive because each trajectory requires repeatedly constructing and evaluating merged models. Multi-GPU parallelism helps, and the final speedup is about 1.57x rather than ideal scaling. Policy transfer also becomes weaker for three-task or unrelated target groups.
Future experiments could explore cheaper reward proxies, stronger transfer adaptation, larger task groups, and improved scheduling for intermediate reward evaluation. The transfer results suggest that reusable merging policies are promising for related tasks, but target-specific optimization is still important for unrelated domains or larger task groups.