Code-Craft: Hierarchical Graph-Based Code Summarization for Enhanced Context Retrieval

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sounthiraraj, David, Hancock, Jared, Kortam, Yassin, Javvaji, Ashok, Singh, Prabhat, Shankar, Shaila
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910909674291200
author Sounthiraraj, David
Hancock, Jared
Kortam, Yassin
Javvaji, Ashok
Singh, Prabhat
Shankar, Shaila
author_facet Sounthiraraj, David
Hancock, Jared
Kortam, Yassin
Javvaji, Ashok
Singh, Prabhat
Shankar, Shaila
contents Understanding and navigating large-scale codebases remains a significant challenge in software engineering. Existing methods often treat code as flat text or focus primarily on local structural relationships, limiting their ability to provide holistic, context-aware information retrieval. We present Hierarchical Code Graph Summarization (HCGS), a novel approach that constructs a multi-layered representation of a codebase by generating structured summaries in a bottom-up fashion from a code graph. HCGS leverages the Language Server Protocol for language-agnostic code analysis and employs a parallel level-based algorithm for efficient summary generation. Through extensive evaluation on five diverse codebases totaling 7,531 functions, HCGS demonstrates significant improvements in code retrieval accuracy, achieving up to 82 percentage relative improvement in top-1 retrieval precision for large codebases like libsignal (27.15 percentage points), and perfect Pass@3 scores for smaller repositories. The system's hierarchical approach consistently outperforms traditional code-only retrieval across all metrics, with particularly substantial gains in larger, more complex codebases where understanding function relationships is crucial.
format Preprint
id arxiv_https___arxiv_org_abs_2504_08975
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Code-Craft: Hierarchical Graph-Based Code Summarization for Enhanced Context Retrieval
Sounthiraraj, David
Hancock, Jared
Kortam, Yassin
Javvaji, Ashok
Singh, Prabhat
Shankar, Shaila
Software Engineering
Information Retrieval
Understanding and navigating large-scale codebases remains a significant challenge in software engineering. Existing methods often treat code as flat text or focus primarily on local structural relationships, limiting their ability to provide holistic, context-aware information retrieval. We present Hierarchical Code Graph Summarization (HCGS), a novel approach that constructs a multi-layered representation of a codebase by generating structured summaries in a bottom-up fashion from a code graph. HCGS leverages the Language Server Protocol for language-agnostic code analysis and employs a parallel level-based algorithm for efficient summary generation. Through extensive evaluation on five diverse codebases totaling 7,531 functions, HCGS demonstrates significant improvements in code retrieval accuracy, achieving up to 82 percentage relative improvement in top-1 retrieval precision for large codebases like libsignal (27.15 percentage points), and perfect Pass@3 scores for smaller repositories. The system's hierarchical approach consistently outperforms traditional code-only retrieval across all metrics, with particularly substantial gains in larger, more complex codebases where understanding function relationships is crucial.
title Code-Craft: Hierarchical Graph-Based Code Summarization for Enhanced Context Retrieval
topic Software Engineering
Information Retrieval
url https://arxiv.org/abs/2504.08975