Merging LoRA Adapters for Multi-Task Code Analysis: An Empirical Study of Linear Combination and Task Interference
SANKALP PATHAK
We investigate whether task-specific LoRA adapters — each fine-tuned independently on Meta-Llama-3.1-8B-Instruct — can be merged via weighted linear combination into a single adapter that preserves performance on both tasks. We evaluate 19 configurations (a 4×4 lambda grid plus three baselines) on synthetic static-code-analysis data (3,463 samples) and PrimeVul vulnerability data (9,858 expert-verified C/C++ samples). The best merged configuration retains 98% of solo vulnerability-detection performance while gaining code-analysis capability, and 91% of solo code-analysis performance while gaining vulnerability detection. Interference is asymmetric: vulnerability detection is more sensitive to the code-analysis adapter weight than vice versa.