potentialpaper

Contrastive Code Graph Embeddings for Reinforcement Learning-Based Automated Code Refactoring

Hu Ao

ICLR 2026 submission

Edit this page

Or clone it with git

The page gets its repository with its first edit, so start in the web editor.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

Abstract. We propose a novel reinforcement learning (RL) framework for automated code refactoring that uses contrastive pre-trained code graph embeddings to overcome the limitations of the traditional heuristic-based reward functions. The key challenge is balancing the implementation of syntactic improvements - while maintaining the semantics of the code being refactored - something that necessarily requires the existing RL approaches to accomplish and that most often do last year because of the handcrafted nature of their metrics. Our approach presents a syntax-guided contrastive encoder that acquires structural invariant representations of code graphs by relating structurally augmented variants under a self-supervised objective. These embeddings are then combined with standard measures of code quality in a composite reward function, allowing the RL agent to reason about both low-level changes to the syntactic structure as well as high-level changes in the semantic structure. The policy network itself, which takes the form of a graph attention network, runs on the joint representation space directly, which models dependency on the context on the code structure.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

add · history

No versions are recorded yet: its preprint, the venues it went to and what they decided, the camera-ready. Missing a version?

We don't know of a submission of this paper to a venue with open reviews. Missing a submission?

Loading the discussion…