Code generation by large language models (LLMs) has advanced rapidly toward practical deployment, yet the detection and suppression of code hallucinations—generated code that appears syntactically valid but is semantically incorrect—remains an open challenge. This paper proposes a method that leverages type stability signals intrinsic to Julia's type system as an endogenous indicator of hallucination. The approach comprises: (1) a four-axis evaluation framework (stability, boundary compliance, hallucination, coherence) driven by an internal type-stability prediction head; (2) a Quality Gate rendering ternary COMMIT/REPAIR/HALT verdicts with a self-repair loop; (3) a phased generation protocol constraining generation to struct definitions → function signatures → implementations; and (4) a definition-aware attention mechanism maintaining distance-independent attention to definition sites. Integrated into a 66M-parameter domain-specific Transformer, a tendency toward positive correlation between type-stability scores and hallucination rates is observed. These preliminary findings raise the possibility that directly injecting domain knowledge of the target language's type system into the model architecture may contribute to Compute-Efficient Reliability without relying on massive model scale.
Building similarity graph...
Analyzing shared references across papers
Loading...
Mitsuro Matsuta
Building similarity graph...
Analyzing shared references across papers
Loading...
Mitsuro Matsuta (Tue,) studied this question.
www.synapsesocial.com/papers/69d893c96c1944d70ce04c2b — DOI: https://doi.org/10.5281/zenodo.19448153