Knowledge Graphs give LLMs the context they need to understand your code better
This paper presents a novel approach to improve software repository question-answering by combining LLMs with knowledge graphs. The research demonstrates how knowledge graphs can enhance LLMs' ability to understand and retrieve repository data accurately, achieving significant improvements in query accuracy.
-----
https://arxiv.org/abs/2412.03815
π€ Original Problem:
β Existing software repository chatbots struggle with natural language understanding and accurate data retrieval, limiting their effectiveness for both technical and non-technical users.
β Current LLM-based chatbots fail to retrieve accurate repository data 83.3% of the time.
-----
π§ Solution in this Paper:
β The approach uses a two-step process: first constructing a knowledge graph from repository data, then synergizing it with LLMs for natural language interactions.
β A Knowledge Graph Constructor collects and models repository data into graph format.
β The Query Generator translates natural language questions into graph queries using an LLM.
β The Query Executor extracts and runs these queries against the knowledge graph.
β The Response Generator creates natural language answers based on retrieved data.
-----
π‘ Key Insights:
β GPT-4 showed highest accuracy (65%) in generating Cypher queries from natural language
β Chain-of-thought prompting significantly improved complex query handling
β Knowledge graphs provide structured context that enhances LLM accuracy
-----
π Results:
β Initial approach achieved 65% accuracy in answering repository questions
β Chain-of-thought prompting improved accuracy to 84%
β Complex query accuracy increased from 50% to 90%










