TL;DR
CodeWiki is a new open-source framework designed to generate holistic, architecture-aware documentation for large-scale codebases by using a recursive "divide-and-conquer" agent system. Alongside the framework, the authors introduced CodeWikiBench, a benchmark that moves beyond shallow text-matching metrics to evaluate documentation quality using hierarchical, AI-driven rubrics.
What Problem Does This Paper Address?
While Large Language Models (LLMs) are excellent at documenting individual functions or files, they struggle with "repository-level" documentation. Two main hurdles exist:
- Context Limits: Large codebases far exceed the memory (context window) of even the most advanced LLMs, making it impossible for a model to "see" the entire system at once.
- Architectural Blindness: Existing tools often produce a flat list of summaries but fail to capture the "big picture"—how modules interact, how data flows through the system, and the high-level design patterns that govern the project.
Furthermore, evaluating whether a generated README is actually good is notoriously difficult. Traditional metrics like BLEU or ROUGE only measure how much the text "overlaps" with a reference, failing to capture whether the documentation is technically accurate or architecturally sound.
Methods
CodeWiki employs a three-phase approach to bridge the gap between low-level code and high-level architecture:
- Top-Down Hierarchical Decomposition: The system uses static analysis (AST parsing) to build a dependency graph of the repository. It then breaks the codebase into a "module tree," ensuring that each piece is small enough for an LLM to process while maintaining logical boundaries.
- Recursive Agent System: A "divide-and-conquer" agent workflow processes the tree. If a module is still too complex, the agent dynamically delegates sub-tasks to specialized sub-agents. This allows the system to scale to repositories of arbitrary size.
- Bottom-Up Synthesis: Once the "leaf" modules are documented, the system synthesizes these details upward. It doesn't just aggregate text; it uses LLMs to generate high-level overviews and visual artifacts, such as Mermaid-based architecture and data-flow diagrams, to help developers visualize the system.
For evaluation, the authors created CodeWikiBench. Instead of simple text comparison, it uses a "Rubric Generator Agent" to extract requirements from official documentation. Then, a panel of "Judge Agents" evaluates the generated documentation against these specific, hierarchical criteria.
Datasets
The researchers curated CodeWikiBench, a multilingual benchmark consisting of 7 prominent open-source repositories. These were selected to cover a wide range of scales (86K to 1.4M lines of code) and seven mainstream programming languages:
- Python: All-Hands-AI–OpenHands
- JavaScript: sveltejs–svelte
- TypeScript: puppeteer–puppeteer
- C#: Unity-Technologies–ml-agents
- Java: elastic–logstash
- C: wazuh–wazuh
- C++: electron–electron
Key Insights and Ideas
- Relationships > Summaries: The core "aha" moment is that repository documentation is about relationships, not just content. By focusing on the dependency graph, CodeWiki preserves the "mental map" of the architecture.
- The Power of Rubrics: The paper demonstrates that "LLM-as-a-Judge" is much more effective when guided by a hierarchical rubric. Breaking a complex evaluation into tiny, binary "adequacy decisions" (e.g., "Does this mention the Visual Parser component?") leads to much higher reliability.
- Language Sensitivity: Documentation quality is heavily influenced by the programming language. Scripting languages (Python, TS) are significantly easier for AI to document than systems languages (C, C++), likely due to the latter's complex memory management and metaprogramming patterns.
Key Results
- Superior Performance: CodeWiki achieved an average quality score of 68.79%, outperforming the leading closed-source baseline (DeepWiki) by 4.73%.
- Significant Gains in Scripting: The framework showed massive improvements in TypeScript (+18.54%) and Python (+9.41%) compared to baselines.
- Human Validation: In a pilot study with business analysts, researchers, and engineers, humans preferred CodeWiki’s documentation in 77.8% of cases, citing better coverage of repository architecture.
- Scalability: The recursive delegation allowed CodeWiki to handle the 1.4M LOC Wazuh repository effectively, whereas "whole-repo" prompting methods typically fail or hallucinate at that scale.
Limitations and Future Work
- The "Systems Language" Gap: Performance on C and C++ remains lower (around 53-64%). The authors note that low-level constructs like pointers and templates require more specialized parsing strategies.
- Rubric Reliability: While the auto-generated rubrics showed ~73% semantic reliability, they still lack comprehensive human verification, which could introduce subtle biases in evaluation.
- Future Directions: The team aims to improve parsing for systems languages and explore "version-aware" documentation that can automatically update as a codebase evolves, acting as a "semantic bridge" for tasks like code migration.
Summary updated