Repository navigation
Inspect AI integration: run packs as Inspect tasks, read Inspect logs back - #122
Merged
Merged
Conversation
simpleaudit.integrations.inspect, behind the new `inspect` extra: - `simpleaudit/audit` task (registered through an inspect_ai entry point). The task model is the target, the `grader` role the judge (required, so the target never judges itself) and the `auditor` role the probe writer (defaults to the grader). Each sample runs the unchanged SimpleAudit loop through InspectModelClient, an acompletion shim over an Inspect Model, injected via judge_client/auditor_client. Epochs reduce to the modal severity; metrics are the 0-100 safety score and counts per severity. - Inspect keeps control of failures: the shim records the first exception from a model call and the solver re-raises it, so token limits, terminations and provider errors behave as in any Inspect eval instead of becoming SimpleAudit ERROR results. - load_inspect_log turns any Inspect log into RepeatedExperimentResults, one run per epoch. SimpleAudit-task samples come back exactly as stored; other samples are rebuilt from their messages with tool calls and results as tool_events, so rejudge, reframing_check and perturbations work on Inspect transcripts. CI installs the extra so the tests run there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
any-llm-sdk 1.40.1 requires anthropic<1 in its base dependencies, not only in its [anthropic] extra, so every SimpleAudit install pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Epochs reduce with modal_severity, which breaks ties toward the more severe verdict like aggregate_severities; Inspect's mode reducer kept whichever tied epoch came first, so a pass/critical split reported pass. - The solver stores the result and the display transcript before it re-raises a model error or limit, so a stopped sample keeps what the target said. - load_inspect_log returns ERROR with an empty transcript for a simpleaudit/audit sample that never stored a result, instead of presenting the hidden scenario description as a user turn. Samples are recognised by a simpleaudit_pack metadata key. - Tool errors from other evals keep Inspect's error message; severities from scores or a severity= mapper are normalised (None is ungraded). - The scorer leaves out only ERROR and ungraded, and scores an off-ladder severity as medium, as AuditResults.score does. severity_counts sends a value between two steps to the more severe one. - A judge schema Inspect's JSONSchema cannot express whole ($defs, $ref, const, ...) is not sent, with a warning, instead of being sent stripped. - The transcript shown in Inspect View names attached files instead of reading them again after judging, and is built with role/content only (the previous helper call broke on messages with tool events). - Scenarios are read once per file version and checked for unique names in one place. - examples/inspect_log_robustness.py checks --epoch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs SimpleAudit scenario packs as an Inspect AI task, and loads Inspect logs as SimpleAudit results so that
rejudge,reframing_checkand the stability report work on them. It's a new optional extra,inspect; nothing insimpleauditimports it.Usage
How it works
graderrole is the judge, and it's required: without it, Inspect falls back to the model under test. Theauditorrole writes the probes and defaults to the grader.InspectModelClient, so they appear in Inspect's transcript and usage and follow Inspect's limits and retries. SimpleAudit's own retries are off.AuditResults.score, a severity off the ladder counts as medium, andERRORandungradedare left out.modal_severity: the most common severity, with a tie going to the more severe one, as inaggregate_severities. Inspect'smodereducer keeps whichever tied epoch came first.safety_score(0–100) and a count per severity.load_inspect_logreturnsRepeatedExperimentResults.ERRORwith an empty transcript.tool_events. Their severity isungradedunless a score or theseverity=mapper gives one; those values are normalised.JSONSchemacan't express in full ($defs,$ref,const, …) isn't sent, and a warning says so. The reply is parsed as JSON either way.examples/inspect_log_robustness.pyruns the perturbation check on any Inspect log.For review
inspect scoredoesn't grade again. Re-grading goes throughload_inspect_logandrejudge. Moving the judge into a scorer would needrun_scenariosplit into a conversation phase and a judge phase.anthropic<1, while Inspect's Anthropic provider needsanthropic>=2. The README describes the workaround.eval("simpleaudit/audit")from Python in the repo root, the editable install'ssimpleaudit.egg-infohides the metadata Inspect uses to name the task. TheinspectCLI and regular installs aren't affected, and the registry test runs in a subprocess for this reason.Tests
tests/test_inspect_integration.pyhas 23 tests that run offline on Inspect'smockllm. They cover:rejudge.Live checks, with
anthropic/claude-haiku-5-5as model and grader:inspect eval simpleaudit/auditon 3nav_aapscenarios × 2 epochs: a medium/low split reduced to medium both in Inspect and in the stability report fromload_inspect_log.--token-limit: Inspect recorded it as a limit, the transcript up to that point was kept, and it loaded asERROR.examples/inspect_log_robustness.pyran on the log.