Can We Improve Educational Diagram Generation with In-Context Examples? Not if a Hallucination Spoils the Bunch

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Logacheva, Evanfiya, Hellas, Arto, Mihaylova, Tsvetomila, Sorva, Juha, Heinonen, Ava, Leinonen, Juho
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908793385779200
author Logacheva, Evanfiya
Hellas, Arto
Mihaylova, Tsvetomila
Sorva, Juha
Heinonen, Ava
Leinonen, Juho
author_facet Logacheva, Evanfiya
Hellas, Arto
Mihaylova, Tsvetomila
Sorva, Juha
Heinonen, Ava
Leinonen, Juho
contents Generative artificial intelligence (AI) has found a widespread use in computing education; at the same time, quality of generated materials raises concerns among educators and students. This study addresses this issue by introducing a novel method for diagram code generation with in-context examples based on the Rhetorical Structure Theory (RST), which aims to improve diagram generation by aligning models' output with user expectations. Our approach is evaluated by computer science educators, who assessed 150 diagrams generated with large language models (LLMs) for logical organization, connectivity, layout aesthetic, and AI hallucination. The assessment dataset is additionally investigated for its utility in automated diagram evaluation. The preliminary results suggest that our method decreases the rate of factual hallucination and improves diagram faithfulness to provided context; however, due to LLMs' stochasticity, the quality of the generated diagrams varies. Additionally, we present an in-depth analysis and discussion on the connection between AI hallucination and the quality of generated diagrams, which reveals that text contexts of higher complexity lead to higher rates of hallucination and LLMs often fail to detect mistakes in their output.
format Preprint
id arxiv_https___arxiv_org_abs_2601_20476
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Can We Improve Educational Diagram Generation with In-Context Examples? Not if a Hallucination Spoils the Bunch
Logacheva, Evanfiya
Hellas, Arto
Mihaylova, Tsvetomila
Sorva, Juha
Heinonen, Ava
Leinonen, Juho
Computation and Language
Generative artificial intelligence (AI) has found a widespread use in computing education; at the same time, quality of generated materials raises concerns among educators and students. This study addresses this issue by introducing a novel method for diagram code generation with in-context examples based on the Rhetorical Structure Theory (RST), which aims to improve diagram generation by aligning models' output with user expectations. Our approach is evaluated by computer science educators, who assessed 150 diagrams generated with large language models (LLMs) for logical organization, connectivity, layout aesthetic, and AI hallucination. The assessment dataset is additionally investigated for its utility in automated diagram evaluation. The preliminary results suggest that our method decreases the rate of factual hallucination and improves diagram faithfulness to provided context; however, due to LLMs' stochasticity, the quality of the generated diagrams varies. Additionally, we present an in-depth analysis and discussion on the connection between AI hallucination and the quality of generated diagrams, which reveals that text contexts of higher complexity lead to higher rates of hallucination and LLMs often fail to detect mistakes in their output.
title Can We Improve Educational Diagram Generation with In-Context Examples? Not if a Hallucination Spoils the Bunch
topic Computation and Language
url https://arxiv.org/abs/2601.20476