Natural Language-Focused Software Engineering via Code-Documentation Equivalence
- URL: http://arxiv.org/abs/2606.22247v1
- Date: Sat, 20 Jun 2026 22:19:00 GMT
- Title: Natural Language-Focused Software Engineering via Code-Documentation Equivalence
- Abstract summary: We present a novel approach, called Documentary, to automatically generate equivalent documentation for a given code snippet.<n>Our results show that documentation-to-code equivalence allows an LLM to predict the output of a function with 12.8--24.5% higher accuracy.<n>Human developers consider documentation generated by Documentary to be more useful for understanding and editing code than the original human-written documentation.
- Score: 17.47344940875897
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: Source code documentation is an integral part of software development and maintenance, as it helps in understanding the code and facilitates communication among developers. However, existing documentation is often incomplete, outdated, or inaccurate, which can lead to misunderstandings and errors. In the era of large language models (LLMs), which are being extensively used for software engineering tasks, the quality of documentation becomes even more critical, as documentation provides important context for the models. In this paper, we introduce the notion of documentation-to-code equivalence, a novel property that captures whether documentation accurately and completely describes the code it documents. We present a novel approach, called Documentary, to automatically generate equivalent documentation for a given code snippet. Our evaluation shows that Documentary can generate equivalent documentation for 53.4% of the evaluated function-level code snippets. To show the benefits of documentation-to-code equivalence, we describe and evaluate two software engineering tasks: code understanding and code editing. Our results show that documentation-to-code equivalence allows an LLM to predict the output of a function with 12.8--24.5% higher accuracy, when compared to human-written documentation and documentation generated by a baseline approach. Furthermore, human developers consider documentation generated by Documentary to be more useful for understanding and editing code than the original human-written documentation.
Related papers
- MonkeyOCRv2: A Visual-Text Foundation Model for Document AI [71.06391669976786]
MonkeyOCRv2 is a visual-text pretrained model for document AI.<n> MonkeyDoc v2 is the largest document-image pretraining corpus, comprising 113 million images spanning 17 languages.
arXiv Detail & Related papers (2026-07-13T13:43:39Z) - Code-QA-Bench: Separating Code Reasoning from Documentation Memorization in Repository-Level QA [7.478327602641997]
Code-QA-Bench is a framework for synthesizing repository-level code understanding benchmarks.<n>We generate 528 code-derivable and 100 doc-dependent tasks across 10 Python repositories.<n>The framework is open-source and applicable to any well-documented Python repository.
arXiv Detail & Related papers (2026-05-28T02:52:58Z) - DocFetch - Towards Generating Software Documentation from Multiple Software Artifacts [5.780991619197141]
Existing automated approaches to generate documentation largely focus on source code.<n>We propose DocFetch, to generate different types of documentation from multiple software artifacts.<n>We evaluate the performance of DocFetch using a manually curated groundtruth dataset.
arXiv Detail & Related papers (2025-08-25T06:54:27Z) - METAMON: Finding Inconsistencies between Program Documentation and Behavior using Metamorphic LLM Queries [10.9334354663311]
This paper proposes METAMON, which uses an existing search-based test generation technique to capture the current program behavior in the form of test cases.<n> METAMON is supported in this task by metamorphic testing and self-consistency.<n>An empirical evaluation against 9,482 pairs of code documentation and code snippets, generated using five open-source projects from Defects4J v2.0.1, shows that METAMON can classify the code-and-documentation inconsistencies with a precision of 0.72 and a recall of 0.48.
arXiv Detail & Related papers (2025-02-05T00:42:50Z) - BigDocs: An Open Dataset for Training Multimodal Models on Document and Code Tasks [57.589795399265945]
We introduce BigDocs-7.5M, a high-quality, open-access dataset comprising 7.5 million multimodal documents across 30 tasks.<n>We also introduce BigDocs-Bench, a benchmark suite with 10 novel tasks.<n>Our experiments show that training with BigDocs-Bench improves average performance up to 25.8% over closed-source GPT-4o.
arXiv Detail & Related papers (2024-12-05T21:41:20Z) - Contextual Document Embeddings [77.22328616983417]
We propose two complementary methods for contextualized document embeddings.
First, an alternative contrastive learning objective that explicitly incorporates the document neighbors into the intra-batch contextual loss.
Second, a new contextual architecture that explicitly encodes neighbor document information into the encoded representation.
arXiv Detail & Related papers (2024-10-03T14:33:34Z) - Testing the Effect of Code Documentation on Large Language Model Code Understanding [1.602193274044797]
Large Language Models (LLMs) have demonstrated impressive abilities with regards to code generation and understanding.
We show that providing an LLM with "incorrect" documentation can greatly hinder code understanding.
We show that incomplete or missing documentation does not seem to significantly affect an LLM's ability to understand code.
arXiv Detail & Related papers (2024-04-03T23:33:56Z) - Towards Summarizing Code Snippets Using Pre-Trained Transformers [20.982048349530483]
In this work, we take all the steps needed to train a DL model to document code snippets.
Our model identifies code summaries with 84% accuracy and is able to link them to the documented lines of code.
This unlocked the possibility of building a large-scale dataset of documented code snippets.
arXiv Detail & Related papers (2024-02-01T11:39:19Z) - Precise Zero-Shot Dense Retrieval without Relevance Labels [60.457378374671656]
Hypothetical Document Embeddings(HyDE) is a zero-shot dense retrieval system.
We show that HyDE significantly outperforms the state-of-the-art unsupervised dense retriever Contriever.
arXiv Detail & Related papers (2022-12-20T18:09:52Z) - DocCoder: Generating Code by Retrieving and Reading Docs [87.88474546826913]
We introduce DocCoder, an approach that explicitly leverages code manuals and documentation.
Our approach is general, can be applied to any programming language, and is agnostic to the underlying neural model.
arXiv Detail & Related papers (2022-07-13T06:47:51Z) - Unified Pretraining Framework for Document Understanding [52.224359498792836]
We present UDoc, a new unified pretraining framework for document understanding.
UDoc is designed to support most document understanding tasks, extending the Transformer to take multimodal embeddings as input.
An important feature of UDoc is that it learns a generic representation by making use of three self-supervised losses.
arXiv Detail & Related papers (2022-04-22T21:47:04Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.