8000 Seed images: LTR training rows for Commons image pages by daoudclarke · Pull Request #621 · mwmbl/mwmbl · GitHub
[go: up one dir, main page]

Skip to content

Seed images: LTR training rows for Commons image pages - #621

Open
daoudclarke wants to merge 3 commits into
wikicommons_image_searchfrom
seed-images-ltr-data
Open

daoudclarke wants to merge 3 commits into
wikicommons_image_searchfrom
seed-images-ltr-data

Conversation

@daoudclarke
Copy link
Copy Markdown
Contributor

From Claude:

Stack: PR 7 of the #610 plan, on wikicommons_image_search (independent track). PR 8 (seed-images-ltr-retrain) builds on it.

What changed

  • mwmbl/rankeval/seed_images/ltr_data.py builds LTR training rows for Commons image pages:
    • overlay writes the train queries' 11,652 Jev-safe images (NSFW < 1.0) into production's own pages. Each image is indexed the way indexing.py does it: the file page URL, the file name as title, the description as extract, no categories. The pages are read whole from api.mwmbl.org (/api/v1/search/page/{n}, cached, eval User-Agent). The merge uses the indexer's own combine_documents and pack_index_page at production's 102.4M pages and 4096 bytes. So an image is kept only where it would really fit, and it competes with every term sharing its page. Each LLM-labelled query then takes the overlaid images its terms and bigrams retrieve, less the ones the majority-terms rule would score 0.
    • batches, merge: pass-3 grading with the exact JUDGE_PROMPT, in the same id || rel || ethos || overall format, through a resumable checkpoint keyed by (query, url). Each query's block shuffles in two graded web anchors, to check the scale. A merge fails if one id gets two different grades.
    • build writes the LLM dataset plus the image rows, tagged pools=commons_image.
  • llm_experiment.py --llm-dataset PATH. To train with images, point it at the new dataset. To train without them, also pass --exclude-pool commons_image. The query split is unchanged (checked).
  • Results section in seed-search-images-eval.md.

Why

Standard search's LTR has never seen an image page. The eval found it putting a store photo at #1 for "matalan". PR 8 retrains it with these rows.

Results (run for real, full set)

Lookup pages receiving images 1,444 of 2,333 (55 existing docs evicted)
Queries retrieving an image 161 of 849
Images retrieved / after majority rule 448 / 353
Relevance 0/1/2/3 8 / 113 / 231 / 1
Ethos 3 351 of 353
Overall mean, images vs web 4.73 vs 3.29
Overall ≥ 4, images vs web 72.8% vs 41.4%
Anchors re-graded beside images (324) overall +0.44 (within 1: 55%), relevance +0.30, ethos +0.05

Surprises:

  • Ethos gives almost every image a 3, because the rubric rewards Creative Commons. So the model may learn "Commons file page" as a class, and PR 8 should also try a relevance-only label.
  • Grading among pictures runs a little high, as the anchors show.
  • A few queries retrieve many images: gunnersbury park 19, seaton tramway 18, kempsey church 17. So the per-list cap matters.

Verification

  • make check and make test pass (1971 passed).
  • Grading: 9 Claude Haiku 4.5 subagent runs, on the pass-3 prompt.
  • Reviews by subagents. Code review, security, and trust-and-safety plus holistic review. Fixed from them:
    • Only the 849 train queries' images are used, as indexing.py does. The en-gb queries' images stay out, so PR 8's en-gb evaluation isn't optimistic.
    • Only overlaid images count as image rows. A Commons page production already holds is a web row.
    • A merge fails on conflicting grades for one id. A description that addresses the judge could print another id's line.
    • Per-axis anchor and grade reporting.

Raised, not fixed (for PR 8 / the user):

  • Images skip pass 2's top-30-by-stored-score cut. An image's stored score is None, so its place among the other None-scored pages would be arbitrary, and the LTR scores every retrieved candidate anyway. Documented in the module.
  • Commons text reaches the judge unmarked. Marking it would change the pass-3 prompt the rows must share.
  • With --exclude-pool, the test split keeps the image rows, so NDCG@10 is not comparable with earlier numbers on the old dataset. PR 8 should also score both models on an image-free test pool, and decide with the holistic judge.
  • Before a retrained model ships, standard search needs a way to tell Jev-approved image documents from crawled Commons file pages (PR 9's store lookup does this at serving time).
  • Evicted web rows (55) stay in the dataset.

Part of #610

🤖 Generated with Claude Code

daoudclarke and others added 3 commits November 10, 2026 07:02
Writes the eval's Jev-safe images into production's index pages in memory
(read whole from api.mwmbl.org, merged with the indexer's own write order
and page size), finds the ones the LLM-labelled queries would retrieve,
and grades them with the pass-3 prompt, with graded anchors per query to
check the scale. The dataset with the image rows is tagged with its own
pool, so llm_experiment can train with and without them; it gains
--llm-dataset to read it.

No functional changes to the crawler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the reviews: overlay only the train queries' images, as indexing.py
does, so an en-gb evaluation never ranks images its own queries found;
count only the overlaid images as image rows, since a Commons file page
production already holds is a web row; fail a merge that grades one id
twice differently, which a description addressing the judge could cause;
and report every axis for the images and the anchors.

No functional changes to the crawler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No functional changes to the crawler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov
codecov Bot commented Nov 10, 2026
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mwmbl/rankeval/ltr/llm_experiment.py 0.00 9A68 % 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0