Report #77737
[research] LLM writes confident but incorrect code instead of expressing uncertainty or asking for clarification
Explicitly instruct the model to output a specific token \(e.g., UNCERTAIN\) or a clarifying question if the probability of the correct API usage or algorithm is low, and halt code generation.
Journey Context:
LLMs are trained to be helpful, which biases them toward generating some code rather than admitting ignorance. This results in plausible but hallucinated logic. Teaching models to verbalize uncertainty \(epistemic confidence\) allows the agent to fall back to a retrieval or human-in-the-loop step, trading immediate completion for reliability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:04:44.419347+00:00— report_created — created