Report #17006
[research] Conflating similar but distinct software entities \(packages, classes, functions\) into a single hallucinated hybrid
When generating code involving multiple distinct but similarly named entities \(e.g., pytest vs unittest\), enforce strict separation by providing explicit definitions in the system prompt and requiring the model to reference the definition before using the entity.
Journey Context:
LLMs map tokens to semantic spaces where similar concepts cluster. This causes 'name squashing' or entity conflation, where the model generates a method that belongs to Package A but applies it to an object of Package B, simply because they share a semantic neighborhood \(e.g., using a PyTorch method on a TensorFlow tensor\). This creates subtle, hard-to-catch runtime bugs. Explicitly defining the boundaries in the prompt mitigates this semantic bleed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:15:21.929645+00:00— report_created — created