Query2Diagram: Answering Developer Queries with UML Diagrams

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Baryshnikov, Oleg, Alekseev, Anton M., Nikolenko, Sergey I.
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918468484333568
author Baryshnikov, Oleg
Alekseev, Anton M.
Nikolenko, Sergey I.
author_facet Baryshnikov, Oleg
Alekseev, Anton M.
Nikolenko, Sergey I.
contents Software documentation frequently becomes outdated or fails to exist entirely, yet developers need focused views of their codebase to understand complex systems. While automated reverse engineering tools can generate UML diagrams from code, they produce overwhelming detail without considering developer intent. We introduce query-driven UML diagram generation, where LLMs create diagrams that directly answer natural language questions about code. Unlike existing methods, our approach produces semantically focused diagrams containing only relevant elements with contextual descriptions. We fine-tune Qwen2.5-Coder-14B on a curated dataset of code files, developer queries, and corresponding diagram representations in a structured JSON format, evaluating with both automatic detection of structural defects and human assessment of semantic relevance. Results demonstrate that fine-tuning on a modest amount of manually corrected data yields dramatic improvements: our best model achieves the highest F1 scores while reducing defect rates below state-of-the-art LLMs, generating diagrams that are both structurally sound and semantically faithful to developer queries. Thus, we establish the feasibility of using LLMs for scalable contextual, on-demand documentation generation. We make our code and dataset publicly available at https://github.com/i-need-a-pencil/query2diagram.
format Preprint
id arxiv_https___arxiv_org_abs_2604_23816
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Query2Diagram: Answering Developer Queries with UML Diagrams
Baryshnikov, Oleg
Alekseev, Anton M.
Nikolenko, Sergey I.
Software Engineering
Artificial Intelligence
Software documentation frequently becomes outdated or fails to exist entirely, yet developers need focused views of their codebase to understand complex systems. While automated reverse engineering tools can generate UML diagrams from code, they produce overwhelming detail without considering developer intent. We introduce query-driven UML diagram generation, where LLMs create diagrams that directly answer natural language questions about code. Unlike existing methods, our approach produces semantically focused diagrams containing only relevant elements with contextual descriptions. We fine-tune Qwen2.5-Coder-14B on a curated dataset of code files, developer queries, and corresponding diagram representations in a structured JSON format, evaluating with both automatic detection of structural defects and human assessment of semantic relevance. Results demonstrate that fine-tuning on a modest amount of manually corrected data yields dramatic improvements: our best model achieves the highest F1 scores while reducing defect rates below state-of-the-art LLMs, generating diagrams that are both structurally sound and semantically faithful to developer queries. Thus, we establish the feasibility of using LLMs for scalable contextual, on-demand documentation generation. We make our code and dataset publicly available at https://github.com/i-need-a-pencil/query2diagram.
title Query2Diagram: Answering Developer Queries with UML Diagrams
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2604.23816