Code Hallucination: Code generated by LLMs that is syntactically correct or semantically plausible but fails to execute as expected or meet requirements
Code Error: Specific subset of hallucinations referring to issues that cause a program to stop executing (e.g., NameError)
Mapping Hallucinations: Ambiguity in mapping data types/values (e.g., accessing non-existent array indices)
Naming Hallucinations: Memory-related issues regarding variable/module names (e.g., importing non-existent modules)
Resource Hallucinations: Lack of perception regarding resource consumption (e.g., memory overflow, infinite loops)
Logic Hallucinations: Discrepancies between expected/actual results or logical breakdown (e.g., generating chaos/gibberish)
CodeHalu: A dynamic detection algorithm that uses statistical induction based on execution validation to identify hallucination patterns
CodeHaluEval: A benchmark proposed in this paper containing 8,883 samples from 699 tasks to evaluate code hallucinations