Abstract
Resolving conflicts from merging different software versions is a challenging task. To reduce the overhead of manual merging, researchers develop various program analysis-based tools which only solve specific types of conflicts and have a limited scope of application. With the development of language models, researchers treat conflict code as text, which theoretically allows for addressing almost all types of conflicts. However, the absence of effective conflict difficulty grading methods hinders a comprehensive evaluation of large language models (LLMs), making it difficult to gain a deeper understanding of their limitations. Furthermore, there is a notable lack of large-scale open benchmarks for evaluating the performance of LLMs in automatic conflict resolution. To address these issues, we introduce ConGra, a CONflict-GRAded benchmarking scheme designed to evaluate the performance of software merging tools under varying complexity conflict scenarios. We propose a novel approach to classify conflicts based on code operations and use it to build a large-scale evaluation dataset based on 44,948 conflicts from 34 real-world projects. We evaluate state-of-the-art LLMs on conflict resolution tasks using this dataset. By employing the dataset, we assess the performance of multiple state-of-the-art LLMs and code LLMs, ultimately uncovering two counterintuitive yet insightful phenomena.
Introduction
Software development frequently involves merging disparate versions of a codebase, a process that often results in "merge conflicts" when automated tools like Git cannot reconcile changes. While traditional program analysis tools provide some relief, they are typically restricted to specific languages or conflict types. Large Language Models (LLMs) have emerged as a promising general-purpose alternative by treating code as text. However, the lack of a large-scale, complexity-graded benchmark has made it difficult to rigorously evaluate LLM performance in this domain.
To bridge this gap, we present CONGRA (CONflict-GRAded), a benchmarking scheme and dataset designed to evaluate software merging tools across varying levels of conflict complexity.
Methodology: The CONGRA Pipeline
The CONGRA framework follows a multi-stage pipeline to transform raw commit records into a structured benchmark.
1. Coloring and Classification
Instead of relying on heavy compilation-based analysis, CONGRA utilizes tree-sitter, a lightweight syntax tree parser. This allows the system to extract "code operations"—such as variable declarations or function body modifications—from conflicting versions. Conflicts are then classified into seven categories based on three primary types:
- Text (T): Changes in comments or non-functional text.
- Syntax (S): Changes to declarations, prototypes, or language-specific features.
- Functional (F): Changes to the logic within function bodies.
2. Resolution Generation
To test the capabilities of LLMs, the framework uses a "Chain of Thought" (CoT) prompting strategy. This approach guides the model through understanding the conflict's cause and deciding on a merge strategy before providing the final code.
3. Evaluation Metrics
Evaluation goes beyond simple exact-string matching. CONGRA employs Rich Metrics, including Edit Similarity (ES), Winnowing Similarity (WS) for structural patterns, and Semantic Similarity (SS) using embeddings to capture the underlying meaning of the resolved code.
The CONGRA Dataset
The resulting CONGRA dataset is significantly larger and more diverse than previous benchmarks. It comprises 44,948 conflict scenarios sourced from 34 popular open-source projects, including the Linux Kernel, TensorFlow, and Django. The dataset covers four major programming languages: C, C++, Java, and Python. For comparison, the previous state-of-the-art benchmark, ConflictBench, contained only 180 cases.
Key Insights and Results
Our evaluation of state-of-the-art LLMs revealed several surprising phenomena:
- The Guidance Paradox: Counterintuitively, LLMs often perform better on complex conflicts (e.g., F+S+T) than on simple text-only conflicts (T). Simple conflicts often lack sufficient "guidance," leading models to be overly conservative, whereas complex conflicts provide richer context that clarifies the intended resolution.
- Generalists vs. Specialists: General-purpose models like Llama3-8B and DeepSeek-V2 consistently outperformed specialized code models such as CodeLlama. This suggests that the breadth of general pre-training is more valuable for merge reasoning than narrow code-specific fine-tuning.
- Context Noise: Models with very long context windows did not necessarily perform better. In fact, excessive surrounding code often introduced noise that distracted the models, indicating that intelligent context selection is more important than raw context length.
- Language-Specific Performance: Models showed high precision on functional conflicts in Java, likely due to the language's predictable boilerplate patterns (e.g., getters and setters).
Conclusion
CONGRA provides the first large-scale, graded foundation for evaluating automatic conflict resolution. Our findings highlight that while LLMs are powerful, their success depends heavily on the quality of guidance and the avoidance of context noise. Future work will focus on refining context selection and improving the classification of advanced language features.
The CONGRA dataset and tools are available at https://github.com/HKU-System-Security-Lab/ConGra.
Summary updated