Repository logo
Log in(current)
Repository logoMIT Open ScholarshipDSpace@MIT
  1. Home
  2. Research Computing
  3. AIA
  4. Reports
  5. A Verification-Guided, Context-Efficient Framework for LLM-Based Software Refactoring

A Verification-Guided, Context-Efficient Framework for LLM-Based Software Refactoring

Thumbnail Image
Download
Name

Xiao_1.pdf

Size

161.17 KB

Format

Adobe PDF

Checksum (MD5)

b6248ac03ac858a873af09fbc9f50ce8

Author(s)
Xiao, Jimmy
•
Mohindra, Sanjeev
Date Issued
August 20, 2026
Abstract
Large Language Models (LLMs) show promise for software refactoring but are hindered by limited context windows and incorrect code generation. We propose a framework enhancing LLM refactoring through context optimization and an automated feedback loop. First, we optimize context using hierarchical subagents and tool-calling access (e.g., shell and REPL environments via MCP servers). This enables models to navigate codebases without ingesting the entire repository. Second, we introduce an iterative feedback loop driven by automated "judges" (build, lint, static analysis, unit testing). When a refactor fails, the system submits structured natural language feedback to the LLM for self-correction, filtering o ut p re-existing technical debt on unchanged lines. Preliminary observations using GitHub Copilot and Aider demonstrate the feasibility of REPL-assisted generation and automated error resolution. We conclude by outlining methodologies for future empirical evaluation.
Subjects
Software Refactoring
LLMs
agentic coding
MIT Department
Lincoln Laboratory
Terms of Use
All rights reserved
Persistent DSpace Link
https://dspace.mit.edu/handle/1721.1/173099
Repository logo
PrivacyPermissionsAccessibilityContact us
Repository logo
Notify us about copyright concerns.