Graph Adversarial Refinement for Robust Code Fixes: Enhancing Policy Networks via Structure-Aware Contrastive Learning
Keywords: Structure-Aware Contrastive Learning
Abstract: \begin{abstract}
We propose \textbf{Graph Adversarial Refinement (GARM)}, a novel module to enhance the robustness of policy networks in adversarial reinforcement learning for code fixes. Modern code repair systems frequently breakdown when confronted with adversary perturbed inputs, which mainstreamer the structural weaknesses in their internal representations. To facilitate that, GARM combines graph structure learning and adversarial training to dynamically identify and perturb less-critical edges in code graphs while maintaining semantically-significant adjacencies. The module consists of three key components: a \textbf{Graph Structure Learning (GSL)} sub-module that quantifies edge importance, an \textbf{Adversarial Perturbation Generator (APG)} that introduces controlled perturbations, and an \textbf{Adversarial Contrastive Learning (ACL)} sub-module that enforces robustness by aligning original and perturbed embeddings. The proposed method uses the graph transformer as its encoder and therefore captures the long-range dependencies better than conventional graph neural networks. Moreover, the adversarial perturbations are incrementally refined during training, which makes the policy network harder and harder before disrupting its capacity to generate accurate fixes. Experiments show that GARM actually increases resilience to adversarial code edits with high repair accuracy. The modular design facilitates seamless integration into existing reinforcement learning pipelines, making it practical for deployment in real-world scenarios where code integrity is critical. Our work fills in the gap between powerful graph representation learning and adversarial reinforcement learning that provides a principled solution for secure and reliable automated code repair.
\end{abstract}
Primary Area: transfer learning, meta learning, and lifelong learning
Submission Number: 25409
Loading