AI
New Framework Combines AI Documentation and Smart Retrieval to Help Developers Navigate Massive Code Repositories
Researchers propose Code Comprehensor, a system that automatically generates hierarchical documentation and uses machine learning to help large language models quickly locate relevant code across complex software projects.
Managing vast, intricate codebases that grow and change constantly presents one of software engineering's most persistent obstacles—making it harder for teams to onboard new members, maintain existing systems, refactor efficiently, and trace the ripple effects of code changes. Feeding this complexity into large language models only compounds the problem, since the models need context about not just a single piece of code but how it fits into the broader repository ecosystem.
The Three-Part Solution#
Researchers have introduced Code Comprehensor, a framework designed to tackle these challenges through three integrated components. The system builds a CodeGraph that maps how different parts of code call and depend on each other, generates CodeScribe documentation that uses AI to create hierarchies of explanations following those call paths, and deploys CodeContrast, a retrieval model trained to match natural language queries with relevant code passages by learning aligned representations of both text and code.
How It Works#
The retrieval model—inspired by CLIP, a technique used in computer vision and language—learns to recognize which code sections best answer textual questions about the repository. Once it identifies relevant code neighborhoods with high precision, an LLM-powered orchestrator uses this grounded context to answer specific domain questions. This two-stage process combines fast semantic matching with reasoning that draws on verified evidence.
Validation Across Real Codebases#
The team tested Code Comprehensor on OpenCV, a well-known open-source library, as well as on a proprietary codebase containing five million lines of code. Their experiments demonstrated that the richer documentation produced by CodeScribe—including hierarchical explanations, parent and sibling method context, and synthetically generated questions—consistently improved the retrieval model's ability to find relevant code matching text queries. In LLM-as-judge evaluations using the RAGAS benchmark, the system achieved above 90% faithfulness scores, indicating that the retrieved context reliably answers user questions without hallucination.

