TL;DR
MAGIS is a multi-agent framework that empowers Large Language Models (LLMs) to solve real-world GitHub issues by mimicking a professional software team. By breaking down complex repository-level tasks into specialized roles—Manager, Custodian, Developer, and QA—MAGIS achieves a 13.94% resolution rate on SWE-bench, representing an eight-fold improvement over using GPT-4 alone.
What Problem Does This Paper Address?
While LLMs like GPT-4 are remarkably good at writing isolated functions (think LeetCode style), they often stumble when faced with a real-world GitHub repository. Resolving a GitHub issue isn't just about writing new code; it’s about software evolution. This requires:
- Navigation: Finding the specific files and lines that need changing among thousands of lines of code.
- Context: Understanding how a change in one file might break a dependency in another.
- Constraint Management: Operating within the limited "context window" (memory) of the LLM.
Current benchmarks show that even the best LLMs fail to resolve over 95% of GitHub issues when applied directly. The authors of MAGIS set out to understand why they fail and how a collaborative agent structure can bridge that gap.
Methods
The researchers first conducted an empirical study, discovering that the biggest hurdles were "line localization" (finding the exact lines to fix) and "change complexity" (the number of files/functions involved). To solve this, they built MAGIS (Multi-Agent framework for GitHub Issue Solution), which divides the labor into four specialized roles.
The process is split into two main phases: Planning (locating files and team building) and Coding (execution and iterative review):
- Repository Custodian: Acts as the librarian. It uses a combination of search algorithms (BM25) and a "memory mechanism" to identify relevant files without overwhelming the system with too much text.
- Manager: The architect. It analyzes the issue, breaks it into sub-tasks, "recruits" a team of Developer agents, and hosts a "Kick-off Meeting" to create a unified work plan and resolve dependencies.
- Developer: The coder. These agents focus on specific file-level tasks, generating code "hunks" rather than rewriting entire files.
- Quality Assurance (QA) Engineer: The reviewer. It checks the Developer’s work, provides feedback, and forces iterations until the code meets quality standards.
Datasets
The framework was evaluated using SWE-bench, a rigorous benchmark consisting of 2,294 real-world issues from 12 popular Python repositories (like django, scikit-learn, and flask). They also compared results on SWE-bench Lite, a smaller, canonical subset used for faster iteration and comparison with other state-of-the-art agents.
Key Insights and Ideas
- Line Locating is the "Aha!" Factor: The study found a massive positive correlation between a model's ability to accurately locate the lines to be modified and its eventual success.
- The Complexity Penalty: Success rates drop sharply as the number of files or functions to be modified increases. By assigning one Developer agent per file, MAGIS effectively "parallelizes" the complexity.
- The Power of the "Kick-off Meeting": Unlike other systems where agents work in silos, MAGIS agents "discuss" the plan first. This ensures that if Agent A is changing a function that Agent B relies on, they are aware of the dependency before a single line of code is written.
- Iterative Refinement: The QA agent isn't just a "pass/fail" gate; it provides specific feedback that allows the Developer to fix mistakes in a loop, much like a human PR (Pull Request) review process.
Key Results
- 8x Performance Boost: On the SWE-bench subset, raw GPT-4 resolved only 1.74% of issues. MAGIS, using GPT-4 as its "brain," resolved 13.94%.
- Outperforming the State-of-the-Art: On SWE-bench Lite, MAGIS achieved a 25.33% resolution rate, significantly higher than other specialized agents like AutoCodeRover (16.11%) and SWE-Agent (18.00%).
- Efficiency: MAGIS is surprisingly fast. While the famous "Devin" agent often takes over 10 minutes per issue, MAGIS typically finalizes a resolution in under 5 minutes.
- Ablation Success: Removing the QA agent or the "hints" (human-provided clues) caused performance to drop, proving that every role in the "team" is necessary for peak performance.
Limitations and Future Work
- Language Constraints: The current evaluation is limited to Python repositories. The authors acknowledge that different coding styles and architectures in other languages might affect performance.
- Prompt Sensitivity: Like all LLM-based systems, MAGIS is sensitive to how prompts are engineered. Small changes in instructions can lead to different outcomes.
- Complex Multi-File Changes: While MAGIS handles multi-file issues better than single LLMs, it still struggles when an issue requires massive, sweeping changes across a dozen or more files.
- Future Direction: The authors suggest expanding the framework to support more diverse software architectures (like microservices) and integrating more external tools (like browsers or advanced debuggers) to help agents gather more context.
Summary updated