Skip to content

report detector input provenance in translated hitlogs - #2002

Open
SarveshaKumarKS wants to merge 1 commit into
NVIDIA:mainfrom
SarveshaKumarKS:codex/hitlog-detector-input
Open

report detector input provenance in translated hitlogs#2002
SarveshaKumarKS wants to merge 1 commit into
NVIDIA:mainfrom
SarveshaKumarKS:codex/hitlog-detector-input

Conversation

@SarveshaKumarKS

Copy link
Copy Markdown

Summary

  • record the output representation selected for each detector before detection
  • add optional detector_input and detector_input_source fields to translated-run hitlog records
  • preserve the existing output field as the raw model generation
  • cover both the standard harness and TreeSearchProbe detector path

Why

Language-aware detectors can score reverse_translation_outputs while the evaluator only records attempt.outputs in the standalone hitlog. The score remains positionally aligned, but the evidence that produced a translated-run hit is missing from that record.

This carries detector-input provenance through the attempt so the evaluator does not need to infer a detector's language scope after the fact. Raw-run hitlog schema remains unchanged; the new fields are emitted only when reverse-translated input was selected.

Closes #2001.

Duplicate check

Before implementation I checked issue #2001 and searched open pull requests for both 2001 in:body and hitlog detector input translation; no competing PR or claim was present. #1959 covers positional alignment, while #1174, #1201, and #1826 concern broader multilingual or serialization behavior rather than detector-scoped hitlog evidence.

Tests

  • python -m pytest -q tests/evaluators/test_evaluators.py — 49 passed
  • python -m pytest -q tests/harnesses/test_harnesses.py — 5 passed
  • python -m pytest -q tests/test_attempt.py — 23 passed
  • focused translated-hit regression selection — 3 passed
  • python -m black --check -W 1 ... for all six changed files — passed
  • tests/probes/test_probes.py — 1,347 passed; 9 unrelated metadata cases require unavailable optional packages or network-fetched fixtures

AI assistance

OpenAI Codex assisted with investigation, implementation, tests, and drafting this pull request. The human submitter will review every changed line before marking the PR ready and remains responsible for the contribution.

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Sarvesha Kumar Kombaiah Seetha <202573753+SarveshaKumarKS@users.noreply.github.com>
@SarveshaKumarKS
SarveshaKumarKS marked this pull request as ready for review July 30, 2026 00:41

@jmartin-tech jmartin-tech left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a gap that needs some attention, the changes here impact areas that I think may be a bit too coupled to a specific view.

The idea that an Attempt needs to hold onto details of the detector actions is a bit more than just knowing if translation was involved and will likely be best to address in a more complex feature.

I have offered a more generic serialization idea that aligns hitlog entry changes with how existing Attempt data is currently being stored.

Comment thread garak/probes/base.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is not needed, the attempt does not need to store this information.

Translation either exists on the attempt or does not, the simple path forward here is to just serialize a original response and the translation for each hit.

There is another core issue related to this, at some point detector results should come with evidence from detection. That support is a more complex enhancement that needs standardization.

Comment thread garak/harnesses/base.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is not needed, the attempt does not need to store this information.

Comment thread garak/attempt.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is not needed, the attempt does not need to store this information.

Comment thread garak/evaluators/base.py
Comment on lines +130 to +143
detector_input_record = attempt._detector_inputs.get(detector_name)
if (
detector_input_record is not None
and detector_input_record["source"]
== "reverse_translation_outputs"
and idx < len(detector_input_record["outputs"])
):
detector_input = detector_input_record["outputs"][idx]
hitlog_record["detector_input"] = (
asdict(detector_input) if detector_input else None
)
hitlog_record["detector_input_source"] = detector_input_record[
"source"
]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translation either exists on the attempt or does not, the simple path forward here is to just serialize a original response and the translation for each hit.

                    reverse_translation_output = None
                    if (
                        len(attempt.reverse_translation_outputs) >= idx and attempt.reverse_translation_outputs[idx]
                    ):
                        reverse_translation_output = attempt.reverse_translation_outputs[idx]
                    hitlog_record["reverse_translation_output"] = reverse_translation_output

@jmartin-tech jmartin-tech added reporting Reporting, analysis, and other per-run result functions quality-accuracy This affects result quality/reliability labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

quality-accuracy This affects result quality/reliability reporting Reporting, analysis, and other per-run result functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reporting: record detector-scoped output representation in hitlog for translated runs

2 participants