GSoC 2026 Module B — Week 4: evaluation harness + recall-first gold corrections + prompt tuning#976
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughThe noise-filter prompt and labeled fixtures are updated to refine NOISE and KNOWLEDGE classifications. A new evaluation CLI runs regex, sanitization, and batched LLM stages, applies confidence thresholds, reports metrics, and writes per-record CSV results. ChangesNoise filter classification and evaluation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/evaluate_noise_filter.py (1)
116-116: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winAdd
strict=Truetozip()This catches a survivor/result length mismatch instead of silently truncating predictions.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/evaluate_noise_filter.py` at line 116, Update the zip call in the survivors/results iteration to pass strict=True, ensuring mismatched survivor, gold, and result lengths raise an error instead of being silently truncated.Sources: Coding guidelines, Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/evaluate_noise_filter.py`:
- Line 162: Guard the accuracy calculation in the evaluation output around the
`correct / total` expression so a zero `total` does not raise an exception.
Preserve the existing formatted accuracy output for nonzero totals and emit an
appropriate zero/empty-result value when no valid records are available.
---
Nitpick comments:
In `@scripts/evaluate_noise_filter.py`:
- Line 116: Update the zip call in the survivors/results iteration to pass
strict=True, ensuring mismatched survivor, gold, and result lengths raise an
error instead of being silently truncated.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 5b55ef4d-78c8-4478-a191-2c1d9ed5a93b
📒 Files selected for processing (4)
application/tests/noise_filter/fixtures/labeled_data.jsonapplication/tests/noise_filter/llm_classifier_test.pyapplication/utils/noise_filter/prompts.pyscripts/evaluate_noise_filter.py
Summary
Adds the Module B evaluation harness and uses it to tune Stage 2 toward the
mid-evaluation target. Measures the full gate (regex → sanitize → LLM
classifier) against the labeled dataset under the recall-first rule.
Result on the 100-record labeled set: accuracy 0.93, KNOWLEDGE recall
1.00 (zero security chunks dropped), NOISE recall 0.84, NOISE precision
1.00. The remaining misses are all safe-direction (NOISE → KNOWLEDGE false
positives that the downstream stage re-judges), never lost knowledge.
What's added / changed
scripts/evaluate_noise_filter.py(new) — evaluation harness. Runs thelabeled set through the real gate, scores against gold, and reports the
recall-first headline (KNOWLEDGE recall + KNOWLEDGE→NOISE leakage), a 3×3
confusion matrix, per-class precision/recall/F1, mean confidence, and a
Stage-2-only breakdown. Flags:
--limit,--threshold,--model,--batch-size,--no-regex,--out.application/tests/noise_filter/fixtures/labeled_data.json— 9 labelcorrections for consistency with the recall-first rule:
dangerous-sink catalogs)
UNCERTAIN → KNOWLEDGE.KNOWLEDGE → NOISE, matching how such chunks were already labeledelsewhere. New distribution: 56 KNOWLEDGE / 44 NOISE.
application/utils/noise_filter/prompts.py— sharpened the NOISEdefinition to distinguish security knowledge from content about a security
project (release/version notes, licenses, translations, reference-format
docs, titles/banners, event teasers are NOISE even when they name a security
standard), plus 2 hard-negative few-shots. Few-shot mix is now 5/5/2.
application/tests/noise_filter/llm_classifier_test.py— updated thefew-shot distribution assertion.
How to run
python scripts/evaluate_noise_filter.py # full dataset
python scripts/evaluate_noise_filter.py --limit 10 # quick smoke run
The harness makes real LLM calls using
CRE_NOISE_FILTER_LLM_MODEL(default
gemini/gemini-2.5-flash-lite, auth via the existingGEMINI_API_KEY).Testing
black --checkclean.the labeled fixture, and the new harness.