Large Language Models (LLMs) can generate UML class diagrams from natural language requirements, but hallucinations may compromise the correctness and completeness of the resulting diagrams. Existing evaluations mostly assess the final diagram, without examining the intermediate traces of reasoning-capable LLMs, which can reveal where these hallucinations arise. We develop an empirical taxonomy of eleven hallucination sub-types organised into three dimensions: Prompt Faithfulness (deviations between requirements and reasoning), Code Faithfulness (discrepancies between reasoning and generated PlantUML code), and Reasoning Quality (problems within the reasoning). The taxonomy was derived from 60 manually annotated DeepSeek-R1 traces, applied to 120 further DeepSeek-R1 traces through a dual-LLM annotation pipeline, and examined on 20 DeepSeek-V4-Pro traces. Code Faithfulness was the most frequent dimension for DeepSeek-R1 in both datasets, whereas Prompt Faithfulness dominated for DeepSeek-V4-Pro, suggesting model-dependent failure patterns. In the manually annotated traces, reasoning-trace length showed no significant monotonic association with hallucination frequency, whereas requirement complexity was negatively associated with it, particularly for Prompt Faithfulness errors. In a mitigation experiment on 13 Golden UML ModelSet cases with three Qwen3-based models, adding Prompt Faithfulness and Reasoning Quality constraints to the generation prompt raised the pooled mean F1 score by 4.0 percentage points, whereas a post-hoc Code Faithfulness review provided no consistent further benefit. Relationship modelling remained the lowest-scoring element throughout. These results suggest that localising hallucinations within the generation process can inform targeted, prompt-based mitigation. Whether these findings generalise beyond the DeepSeek and Qwen3 model families remains to be tested.
Figures & tables
Exercise
Classes
Attr+Ops
Associations
1
6
17
7
2
6
35
5
3
7
12
8
4
6
31
7
5
8
18
11
6
9
12
12
Table 1: Structural characteristics of Dataset 1 exercises Bari et al. (2024) .
Case
Classes
Associations
BusTransportation
5
4
BankAccount
6
5
Sightseeing
7
7
ClothingCompany
7
9
FitnessCompanyConan
8
9
University
9
9
Table 2: Structural characteristics of the 13 Golden UML ModelSet cases, ordered by complexity (Classes + Associations).
Figure 1: Taxonomy of hallucinations in LLM-generated UML class diagrams, organised along the three transitions of the generation pipeline.
Figure 2: A1 Unsupported Entity. The reasoning trace introduces Supplier and RestockOrder classes that have no textual basis in the requirement.
Figure 3: A2 Unsupported Relation. The reasoning trace commits to composition relations with explicit multiplicities between Project and Requirement/System that the requirement description does not warrant.
Figure 4: A3 Over-specific Detail. The requirement refers only to “new patient information” without specifying what this information comprises. The reasoning trace nevertheless commits to concrete attributes for Patient (e.g., dateOfBirth , gender ) and assigns them specific datatypes ( String , Date ), none of which is supported by the text.
Figure 5: A4 Missed Requirement. Although the prompt mentions both rows and columns, the reasoning trace omits a Column class.
Figure 6: B1 Dropped Step. The reasoning trace plans both accountNumber and balance on Account , but the PlantUML code emits only balance .
Figure 7: B2 Fabricated Code and B3 Contradiction. The PlantUML code introduces Factory--Machine and Machine--Worker relations absent from the reasoning plan (B2), and changes the multiplicity and direction of OrderLine--ProductType (B3).
Figure 8: B4 Structural Mismatch. The reasoning trace plans a separate StockItem class with inventory properties, but the PlantUML code collapses these into attributes of Movie .
Figure 9: C1 Speculative Branch. The reasoning trace reverses its decision on whether to include a Factory class multiple times, without justification from the requirement description. Each coloured fragment marks a reversal.
Figure 10: C2 Goal Drift. The reasoning trace shifts focus to visual presentation ( skinparam , crow’s-foot notation) rather than faithful implementation of the requirement.
Figure 11: C3 Tool Misuse. The reasoning trace intends composition between Order and OrderLine but uses --o , the PlantUML symbol for aggregation.
Figure 12: Proportional distribution of hallucination types in Dataset 1 (60 manually annotated runs).
Figure 13: Proportional distribution of hallucination types in Dataset 2 (120 descriptions, automated dual-LLM annotation).
Dimension
Dataset 1
Dataset 2
DeepSeek-V4-Pro
(R1, n=60 )
( n=120 )
( n=20 )
Prompt Faithfulness
30.9%
37.0%
56.7%
Code Faithfulness
48.2%
41.7%
5.8%
Reasoning Quality
20.9%
21.3%
37.5%
Table 3: Dimension-level hallucination distribution across datasets and models. DeepSeek-V4-Pro results are based on 20 traces and should be interpreted with caution.
Figure 14: Proportional distribution of hallucination types for DeepSeek-V4-Pro (20 manually annotated traces on the Dataset 1 descriptions).
Figure 15: Mean total errors per run by reasoning-length quartile (Dataset 1, N=60 ).
Model
Condition
Cls
Att
Rel
Overall
DeepSeek-R1-Qwen3-8B
Baseline
84.1
84.8
67.5
78.8
T-Aware Gen.
88.2
89.6
74.3
84.0
T-Aware + CF Rev.
88.8
88.7
71.4
83.0
Qwen3-32B
Baseline
89.7
85.0
82.0
85.5
T-Aware Gen.
90.9
92.5
86.2
89.9
T-Aware + CF Rev.
90.2
90.4
85.1
88.6
Table 4: Mean F1 scores (%) per model and condition across 13 cases. Bold indicates the best score per model and metric.
Model
Condition
ΔF1
W
p
DeepSeek-R1-Qwen3-8B
T-Aware Gen.
+5.2
8.0
0.006*
T-Aware + CF Rev.
+4.1
8.0
0.006*
Qwen3-32B
T-Aware Gen.
+4.3
8.0
0.006*
T-Aware + CF Rev.
+3.0
15.0
0.064
Qwen3-8B
T-Aware Gen.
+2.6
16.0
0.040*
T-Aware + CF Rev.
+3.4
15.0
0.033*
Table 5: Change in Overall F1 (pp) relative to Baseline. Significant results (Wilcoxon, p<0.05 ) marked with *.
Figure 16: The prompt-echoing anti-pattern. The reasoning trace recites a span of the requirement verbatim and then commits to composition between Project and its Requirements/System. The commitment was coded as A2 Unsupported Relation: the prompt’s verb “produces” supports a general association but not the lifecycle dependency composition implies.
As large language models (LLMs) evolve from conversational assistants into agents capable of handling complex tasks, they are increasingly deployed in high-risk domains. However, existing benchmarks largely rely on mixed queries and posterior evaluation, output-level scoring, which quantifies hallucination severity but offers limited insight into where and why hallucinations arise in the generation pipeline. We therefore reformulate hallucination evaluation as a diagnostic problem and propose PRISM, a controlled benchmark that disentangles hallucinations into four dimensions: knowledge missing, knowledge errors, reasoning errors, and instruction-following errors, grounded in three stages of generation (memory, instruction, and reasoning). PRISM contains 9,448 instances across 65 tasks and supports fine-grained, stage-aware diagnostic evaluation. Evaluating 24 mainstream open-source and proprietary LLMs, we uncover consistent trade-offs across instruction following, memory retrieval, and logical reasoning, showing that mitigation strategies often improve specific dimensions at the expense of others. We hope PRISM provides a framework for understanding the specific mechanisms behind LLMs hallucinations, ultimately accelerating the development of trustworthy large language models.
Uncertainty quantification (UQ) methods are widely used for hallucination detection in large language models (LLMs) in closed-book settings where ground-truth evidence is unavailable at inference time. Prior work has proposed combining UQ signals via learned ensembles, but empirical investigations into the robustness of these ensembles are limited. We study a supervised ensembling framework that trains a classifier over heterogeneous UQ-based scorer outputs on a small, domain-specific dataset of labeled LLM responses, then applies it to out-of-sample hallucination classification without retrieval, tools, or reference documents. Across four LLMs, nine datasets, and three generation regimes (short-form QA, long-form generation, and code generation), we provide a systematic robustness analysis along three axes: sample efficiency, in-domain dataset transfer, and generation regime dependence. We find that supervised ensembles outperform the best individual scorer in 30 of 32 settings, with gains realized from as few as 100 labeled instances. Ensembles retain most of their advantage in cases of in-domain transfer under distribution shift, outperforming the best non-ensemble scorer in 23 of 28 transfer settings. Sampling-based black-box ensembles are nearly as effective as full ensembles, while single-generation white-box ensembles offer limited benefit.
Although Vision Language Models (VLMs) have seen tremendous progress across all kinds of use cases, they still fall behind in answering questions regard-ing diagrams compared to photos. Although progress has been made in the area of bar charts, line charts and other diagrams like that there is still few research concerned with other types of diagrams, e.g. in the computer science domain. Our work presents a benchmark for visual question answering based on UML class diagrams which is both challenging and manageable. We further construct a large-scale training dataset with 16.000 image-question-answer triples and show that a LoRA-based finetune easily outperforms Qwen 3.5 27B, which is a recent and well-performing VLM in many other benchmarks.