How can knowledge graphs aid LLMs in understanding code evolution?
RaPhs" class="internal-link">Knowledge Graphs can significantly aid large language mODEls (LLMs" class="internal-link">LLMs) in understanding code evolution by providing structured representations of relationships between code entities and their historical changes. They work by capturing the connections between different code components, such as functions, classes, and libraries, along with their evolution over time, which allows LLMs to contextualize changes and dependencies in the codebase. This structured information enhances the LLM's ability to generate relevant code snippets and understand the implications of modifications in a dynamic software environment.
For example, a study demonstrated that integrating knowledge graphs with LLMs improved the models' performance in code completion tasks by 20%, as the graphs provided essential context about the relationships and historical usage patterns of code elements. Additionally, research has shown that knowledge graphs can help identify code smells and suggest refactoring opportunities by analyzing the evolution of code across different versions, thereby enabling LLMs to produce more efficient and maintainable code.
Sources: 2603.22184v1, 2603.25804v1, 2603.15611v1