Skip to content
Discussion options

You must be logged in to vote

Hallucinations happen when the model fills in “expected” patterns.
To avoid this:

  • Add this instruction:
    “Only reference symbols that appear in the provided code. If unsure, say ‘not found.’”

  • Wrap code in XML tags:

    <codebase>
    ...
    </codebase>
    
  • Use temperature = 0

  • Use short, direct instructions instead of open-ended ones

  • If needed, chunk the code into smaller context windows

This eliminates most non-existent symbol references.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zoe-dev1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants