Skip to content
Book Open access

Understanding and Mitigating Hallucinations in Industrial LLM-based Unit Test Generation

Jul 2026 · SIGSOFT FSE Companion · pp. 892-902 · 0 citations · 40 references
Computer Science

TL;DR

DEHALL is proposed, an automated end-to-end unit test generation tool that systematically mitigates both types of hallucinations through comprehensive context construction and targeted static analysis-based repair.

Abstract

Unit testing plays a critical role in ensuring software quality and reliability in large-scale industrial environments. While Large Language Models (LLMs) offer promising automated test generation capabilities, their practical deployment faces significant challenges due to hallucination problems. In this paper, we analyze compilation failures from LLM-generated unit tests in Ant Group's production systems and identify two fundamental types of hallucinations: extrinsic hallucinations caused by insufficient contextual information and intrinsic hallucinations stemming from model limitations even with adequate context. To address these issues, we propose DEHALL, an automated end-to-end unit test generation tool that systematically mitigates both types of hallucinations through comprehensive context construction and targeted static analysis-based repair. Our approach builds a heterogeneous graph to capture relevant context and employs specialized repair mechanisms for import, field, and method issues. Evaluation on Ant Group's internal datasets reveals that DEHALL achieves 71.56% line coverage and 67.18% branch coverage, significantly outperforming vanilla LLM approaches. In the public benchmarks, it also shows better performance on coverage and better defect detection capability than previous state-of-the-art approaches. DEHALL has been successfully deployed across multiple business domains at Ant Group, achieving an 81% developer adoption rate with positive user feedback on productivity improvements.

Read PDF

Similar papers

#artificial intelligence Preprint Sep 2026

Better Understanding, Better Fixes? A Study of Hallucination in LLM-based Automated Program Repair

Large language models (LLMs) have significantly advanced automated program repair (APR), yet existing evaluations remain largely result-centric and provide limited insight into hallucination during repair. In APR, hallucination may arise not only in final patches but also in the intermediate artifacts that guide patch...

Xuemeng Cai, Jiakun Liu, Linhan Yang et al. · 0 citations
Preprint Aug 2026

Execution-Anchored Hallucination Calibration Reranking for Verilog Code Generation

EAHC is proposed, an Execution-Anchored Hallucination Calibration reranking framework that anchors reasoning judgments to execution behavior so that execution-equivalent candidates receive consistent scores, which implements a dual-channel architecture.

Guang Yang, Xing Hu, Xiang Chen et al. · 0 citations
#software testing Book Open access Aug 2026

Evaluating Inference-Time Defenses against Package Hallucination in LLM-Generated Code

The results recast package hallucination as both a measurement problem and a decoding-time control problem, and they demonstrate that the choice of defense must be matched to the threat model and recommendation utility.

Albérick Euraste Djiré, I. E. Olatunji, Melissa Tessa et al. · 1 citation

Detecting and Mitigating Hallucinations in Large Language Models: A Comparative Study of Generative and Transformer-Based Approaches

The results suggest that no single architecture guarantees factual reliability, however, contextual grounding and verification mechanisms can significantly improve response quality and highlight the importance of combining language modelling capabilities with grounding strategies to support the development of more reli...

Rupinder Kaur, Sangeetha Kaithakkadu, Thankachan · 0 citations
Jul 2026

Measure Twice, Locate Once: Mitigating Hallucinations in LLM-based Agents for Repository-Scale Fault Localization

FaultLens is a novel FL technique that equips an LLM-based agent with a fine-grained feedback mechanism for repository-scale fault localization, and achieves a 43.35% improvement over SoapFL and a 24.24% improvement over AutoFL in the Top-1 metric, surpassing state-of-the-art LLM-based agent methods.

Feiyu Chen, Guowei Yang, Cheryl Lee et al. · 0 citations
Preprint Jul 2026

Unified Hallucination Fuzzing for Multimodal Large Language Models

This work introduces UniHall, a fine-grained dataset grounded in a unified taxonomy spanning Object, Instruction, and Knowledge dimensions, and proposes Self-Adaptive Multimodal Fuzzing (SAMF), a self-adaptive framework that employs evolutionary mutation strategies to explore the boundaries of model hallucinations.

P. Zhou, Jiajun Song, Zhiwei Tang et al. · 1 citation

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.