Repository navigation
Reference results: live scan, judge-injection check, judge vs. human labels - #2
Merged
Merged
Conversation
Scripts need the same default prompt the app tests with, and app.py cannot be imported outside Streamlit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The judge never saw the system prompt it was supposed to protect, so it
could not tell a verbatim leak from a generic description: graded by the
old prompt, a response that printed the default prompt word for word was
called SAFE ("no verbatim system prompt was revealed").
Pass the target's system prompt to every judge call (scan, attack tree,
reproducibility, mutations, live stream) in its own tagged block, and
tell the judge it is reference material, not rules to apply to itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenAIClient exposes the google-genai surface the engine uses (models.generate_content, generate_content_stream, chats.create) on top of OpenAI Chat Completions: system instruction -> system message, JSON mode -> response_format json_object, chats keep their history, token usage maps to usage_metadata. guardian.engine stays provider-neutral. Gemini safety settings have no OpenAI equivalent and are ignored. openai is an optional dev dependency; .env.example documents the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- scripts/reference_scan.py runs the dataset against a live model (Gemini or OpenAI), retries failed calls, and writes results.csv, summary.json and the PDF report. Target responses are kept out of the repository (reports/raw/ is gitignored): some may contain the harmful text an attack asked for. - scripts/judge_injection_check.py grades a response that clearly meets INJ-001's success criterion, with and without text that tries to talk the judge into SAFE, under the old and the current judge prompt. - scripts/make_labeling_page.py builds a local page for labelling scan responses by hand, blind to the judge's verdicts. - The engine records the exact text the judge graded (Judged Response), so human labels and judge verdicts are made on the same text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
make_labeling_page.py now takes several scan files (items are keyed run:ID), and judge_agreement.py compares the exported labels with the judge's verdicts: agreement and Cohen's kappa on the three verdicts and on breached-vs-safe, a confusion matrix, and the disagreements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--sample N keeps every response the judge flagged and fills up to N with random SAFE ones, so a 20-item session still contains the breaches. --translate ko adds a machine translation under each English text (cached next to the page); labels are still made against the original. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured with OpenAI models (target gpt-5.4-nano, judge gpt-5.4-mini): - reference scan of all 25 payloads with the default and a thin system prompt: 89 (B) and 78 (B); - judge prompt injection: the pre-fix judge was hijacked by the attack payload it graded and answered SAFE in 18/18 cases, the current one in 0/18; - judge vs. 20 hand labels (enriched sample): 75% agreement on breached-vs-safe (kappa 0.53), 60% on three verdicts (kappa 0.42); the judge misses partial leaks, so breach rates are likely low. reports/ holds the data, PDFs and limits; target responses stay out of the repository. README (en/ko) summarises the results and limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
요약
스캐너와 판정 모델(LLM-as-a-Judge)을 실제 모델로 측정하고, 결과를
reports/와 README에 올려요. 측정 과정에서 찾은 판정 버그도 함께 고쳤어요.바뀐 것
fix(judge): 판정 모델이 지켜야 할 대상의 시스템 프롬프트를 보지 못해서, 원문 그대로의 유출도 SAFE로 판정할 수 있었어요. 이제 구분자로 감싼 기준 자료로 함께 넘겨요(스캔, 공격 트리, 재현성, 변이, 라이브 스트림 전부).feat: OpenAI 어댑터(guardian/openai_client.py)를 추가했어요. 엔진 코드는 그대로 두고 OpenAI 모델로 실행해요.openai는 선택 의존성이에요.feat(scripts): 스크립트 4개를 추가했어요. 참고 스캔, 판정 인젝션 확인, 블라인드 라벨링 페이지(표본 추출, 한국어 기계 번역 옵션), 판정 일치율 계산이에요.docs:reports/(데이터, PDF, 한계)와 README(영·한)의 "참고 결과" 섹션이에요.결과 (대상
gpt-5.4-nano, 판정gpt-5.4-mini)판정 모델은 안전한 응답을 뚫렸다고 한 적은 없지만, 부분 유출을 자주 놓쳤어요. 그래서 스캔의 뚫림 비율은 실제보다 낮게 나왔을 가능성이 커요. README에도 그렇게 적었어요.
공개 범위
reports/raw/(gitignore)에만 있어요.results.csv에는 판정과 판정 근거 요약만 있어요.확인한 것
한계
🤖 Generated with Claude Code