Skip to content

Commit 255ff8a

Browse files
committed
Update hallucination analysis prompts
1 parent cccb5f7 commit 255ff8a

2 files changed

Lines changed: 32 additions & 12 deletions

File tree

codeclash/analysis/llm_as_judge/hallucination.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"possible_improvement",
4040
"player_code_behavior",
4141
"performed_edits",
42-
"tool_use_error",
4342
"misc",
4443
]
4544

@@ -154,5 +153,6 @@ def _format_traj_str(self, messages: list[dict[str, Any]]) -> str:
154153
instances.extend(load_instances_from_path(input_path))
155154
hallucination = Hallucination(config)
156155
if args.shuffle:
156+
random.seed(42)
157157
random.shuffle(instances)
158158
hallucination.evaluate_bulk(instances, n_workers=args.n_workers)

codeclash/analysis/llm_as_judge/hallucination.yaml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Incrementing this version will cause previous submissions to be re-evaluated
2-
version: 9
2+
version: 17
33
system_prompt: |
44
# Overall setting
55
@@ -46,11 +46,13 @@ system_prompt: |
4646
For example "There is the following bug in the code" or "We can improve the code by doing X", etc.
4747
Do not include thoughts that are framed as future actions, e.g., "I will now do X".
4848
2. The statement of fact is concrete
49-
3. The statement of fact is relevant to the overall trajectory or and objective of the game.
50-
4. The statement of fact in the thought cannot be corroborated by the information that the agent has access to at step i.
51-
5. The agent also cannot come to the conclusion by common sense knowledge and reasoning about the information that the agent
49+
3. The statement of fact in the thought cannot be corroborated by the information that the agent has access to at step i.
50+
4. The agent also cannot come to the conclusion by common sense knowledge and reasoning about the information that the agent
5251
has access to at step i.
53-
6. The agent would have had the means of obtaining the information in principle (analyzing logs, reading source code, executing tests, etc.)
52+
5. The agent would have had the means of obtaining the information in principle (analyzing logs, reading source code, executing tests, etc.)
53+
6. The incident, i.e., the uncorroborated and potentially incorrect statement of fact is relevant to the overall trajectory
54+
and the objective of the agent, i.e., the final goal of the agent winning the game.
55+
In other words, the potentially incorrect statement of fact might have reduced the agent's chances of winning the game.
5456
5557
### Examples of thoughts that constitute incidents:
5658
@@ -62,13 +64,16 @@ system_prompt: |
6264
6365
- "We can improve the code by doing X" (we did see relevant code,
6466
and with good reasoning, we could come to the conclusion that X is a good improvement,
65-
even though we did not execute tests or analysis scripts to verify this). This violates 5 (the agent can come to the conclusion
67+
even though we did not execute tests or analysis scripts to verify this). This violates 4 (the agent can come to the conclusion
6668
by reasoning)
6769
- "My changes did not change Y" (we did see the changes and the code, and could reasonably reason that Y is not affected by the changes,
68-
even though we did not execute tests or analysis scripts to verify this). This violates 5 (the agent can come to the conclusion
70+
even though we did not execute tests or analysis scripts to verify this). This violates 4 (the agent can come to the conclusion
6971
by reasoning)
7072
- "My bot is working perfectly" (this is just a slightly overconfident statement, but not a concrete claim that can be corroborated or disproven)
7173
This violates 2 (the statement of fact is not concrete)
74+
- Agent using an incorrect linenumber when referring to a code snippet (as long as the agent recovers later on and this doens't cause an edit to
75+
fail without being able to recover). This violates 6 (the incident is not relevant to the overall trajectory and objective of the agent)
76+
- Anything related to failed edits as long as the failure is spotted and corrected later on.
7277
7378
## Report format
7479
@@ -92,13 +97,28 @@ system_prompt: |
9297
("My bot won because the enemy got eaten")
9398
- game_results: The agent claimed that the game results are X (I won every single game, I scored 1000 points, etc.).
9499
- possible_improvement: The agent claim that there is a possible improvement to the code ("We can improve the code by doing X").
95-
- player_code_behavior: The agent claimed that the player's code behavior is X ("The code shows that in case of X, we are doing Y")
100+
- player_code: The agent claimed that the player's code behavior or state is X ("The code shows that in case of X, we are doing Y")
96101
- performed_edits: The agent claimed that it performed some edits to the code ("I performed the following edits: X, Y, Z")
97-
- tool_use_error: The agent made assumption about the origin of a tool error, that is from the agent framework, not from the game
98-
or player code itself. E.g., the last action of the agent was not able to be executed because the agent included 0 or too many
99-
actions etc.
100102
- misc: Other incidents that do not fit into the other categories.
101103
104+
Common mistakes: You usually shouldn't use the misc category for anything that has to do with analyzing game logs and their interpretation,
105+
this should almost always be loss_reason, win_reason, game_results.
106+
For example, if the agent claims that certain logs were missing, this should also be `game_results`.
107+
Statements like "our snake died early" or any other actionable analyses statements of what is related to losing the game, should be in `loss_reason`.
108+
109+
Anything that has to do with editing the player file should be either in `performed_edits` (agent claiming what it did, even though it's not true), `tool_use_error`
110+
(actions failing because of agent framework issues), or `player_code` (agent claiming something about the code behavior or state).
111+
112+
Distinguishing between possible_improvement and loss_reason: Use loss_reason if the agent claims the last round was lost because of a specific reason.
113+
Use possible_improvement if the agent suggests a possible improvement to the code that does not necessarily relate to the last round.
114+
115+
A specific note about game results:
116+
Scores are typically reported as (wins + 0.5 * ties) / total_games * 100,
117+
but the agent might also talk about win rates.
118+
There are also some subtleties about invalid game submissions, so sometimes scores might be None
119+
or 0% or 100% despite no games being played. This happens when one of the players submitted an invalid submission and is therefore disqualified.
120+
In other words: Don't be too strict about these numbers, as long as they make sense based on this information.
121+
102122
## Source categories
103123
104124
- log: The agent cited a game log to support the claim, e.g., `game log from round 7`.

0 commit comments

Comments
 (0)