Repository navigation
Re-measure image safety, gate and minimum with Commons captions - #630
Open
daoudclarke wants to merge 6 commits into
Open
daoudclarke wants to merge 6 commits into
daoudclarke wants to merge 6 commits into
Conversation
…ommons mwmbl/imagesearch/seed_images.py runs the #610 request flow in two phases for Combined Search to overlap with Staan and with web ranking: start() gates the query, searches Commons and asks the NSFW question; finish() asks image need and relevance in one request once Staan has answered, then selects. It fails closed to `unavailable`, including when the images are not ready shortly after web ranking finishes. Not wired into an endpoint. The Commons request now also returns each file's English caption (MediaInfo, via prop=entityterms) and its latest revision time, and asks for English metadata explicitly. Files edited in the last week, and files on an operator denylist, are never judged or shown. The need and relevance answers are range-checked like the NSFW ones, web results are capped and kept to one line each, and image requests have their own timeout. No functional changes to the crawler. Part of #610 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…from review Image work gets its own thread pool so threads blocked on Commons or Redis after a missed deadline cannot hold up web search; the selection is shielded so a deadline doesn't cancel the shared phase-1 work. Files in deletion categories, and files with a recent file version, are never judged; the denylist is matched case-insensitively; captions are capped. No functional changes to the crawler. Part of #610 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #628's Commons captions and revision times, so the eval can measure the questions with captions. Conflicts: types.py keeps the eval branch's ApprovedImage and takes production's caption in SourceImage.text; settings keep both sides' image settings. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n fields The cached candidates were collected before #628 fetched captions and revision times, so their images have no caption, as when they were judged. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#628 shows the judge each file's caption. captions.py fetches the captions of the benchmark and the eval's candidates by title, then re-asks the safety benchmark, the real candidates, injection probes with the payload as the caption, and the need and relevance request on the labelled queries. The thresholds (NSFW 1.0, need 1.65, relevance 1.5) hold; the eval doc gains a Captions section. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s gaps The review found probe_batches() had already put each payload at the head of the description. The probes now start from the benchmark's own images and were re-run. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
daoudclarke
added a commit
that referenced
this pull request
Nov 11, 2026
Commons captions are now part of each image's text (#628), so the questions say so. The caption eval (#630) measured the NSFW rewording on the safety benchmark: an identical table, and the 1.0 threshold holds. The relevance rewording was not measured. The NSFW question's fingerprint changes, so cached verdicts are asked again. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
daoudclarke
8000
added a commit
that referenced
this pull request
Nov 11, 2026
Commons captions are now part of each image's text (#628), so the questions say so. The caption eval (#630) measured the NSFW rewording on the safety benchmark: an identical table, and the 1.0 threshold holds. The relevance rewording was not measured. The NSFW question's fingerprint changes, so cached verdicts are asked again. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
daoudclarke
added a commit
that referenced
this pull request
Nov 11, 2026
Commons captions are now part of each image's text (#628), so the questions say so. The caption eval (#630) measured the NSFW rewording on the safety benchmark: an identical table, and the 1.0 threshold holds. The relevance rewording was not measured. The NSFW question's fingerprint changes, so cached verdicts are asked again. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
daoudclarke
added a commit
that referenced
this pull request
Nov 11, 2026
Commons captions are now part of each image's text (#628), so the questions say so. The caption eval (#630) measured the NSFW rewording on the safety benchmark: an identical table, and the 1.0 threshold holds. The relevance rewording was not measured. The NSFW question's fingerprint changes, so cached verdicts are asked again. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
daoudclarke
added a commit
that referenced
this pull request
Nov 11, 2026
The safety benchmark and injection probes held with captions (#630), so the kill switch no longer needs to default to off. Only requests sending images=true search images, and an instance without JEV_API_KEY still answers unavailable without calling Commons or the judge. No functional changes to the crawler. 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.
From Claude:
Stack: builds on #627 (
seed-images-eval-harden), and merges #628 (seed-images-prod-pipeline) into it, so the diff against the base also shows #628's production changes. This PR's own commits add 456 lines.What changed
#628 shows the judge each file's Commons caption (a
Caption:line, capped at 250 characters). The thresholds (NSFW < 1.0, need >= 1.65, relevance >= 1.5) were measured without captions. This PR checks them again with captions.ApprovedImage, takes production'sSourceImage.textwith the caption, and keeps both sides' image settings.collect.image_from_jsonloads candidate files collected before captions as caption""andrevised_at = uploaded_at.mwmbl/rankeval/seed_images/captions.py:fetch: captions by title (prop=entityterms, English label, 50 titles per request, one request at a time, image search's User-Agent and back-off). It fetches 6,530 files: the benchmark plus the real and labelled queries' candidates. 37% have a caption.benchmarkandwording: the safety benchmark in separate mode with the same batches, with captions and with the NSFW question reworded to name the caption.real: the 200 real queries' candidates.probes: injection.py's self and cross probes, with the payload as the caption.gate: the need and relevance request on the 150 labelled queries.report: prints the results.gate_analysis --arm captions.mwmbl/rankeval/seed-search-images-eval.md.Results: the thresholds hold
Production follow-up (not changed here)
NSFW_QUESTIONandIMAGE_RELEVANCE_QUESTIONinmwmbl/imagesearch/prompt.pystill say "file name, description and categories". They should say "file name, caption, description and categories". The NSFW rewording was measured and changes nothing. The relevance rewording was not measured. Changing the wording changesnsfw_fingerprint, so the cached verdicts are re-asked.Verification
make checkpasses, and so doesmake test(databasemwmbl_b, redis db 14).probe_batches()had already injected the description. They now use the caption only, and were re-run.Part of #610
🤖 Generated with Claude Code