Build a small cross-modal receipt matcher with versioned pairs, a missing-channel fallback and a reviewer trace for every error.
Project: audit an image-and-text receipt matcher
Prepare the packet
Create receipt image and OCR text records with media IDs, parent receipt IDs, page numbers, transform versions and consent status. Include two near-duplicate receipts from the same merchant, an OCR correction, a missing image, a withdrawn asset and one intentionally mismatched pair. Pair validation should reject the mismatch and withdrawal before embedding or scoring.
Establish baselines
Implement a text-only exact-field baseline and an image-only or metadata baseline before combining signals. For the cross-modal path, use fixed provided vectors or a chosen encoder and record both encoder versions. Score candidates with normalized similarity and a permitted-asset filter. Compare the combined route against the strongest single-channel baseline on the same held-out receipt groups.
Evaluate the hard cases
Use parent-receipt grouping and a later test period. Report candidate coverage, recall at three, near-duplicate errors, missing-channel fallback rate and latency. A correct result with the wrong page alignment is still a failure if the workflow needs an evidence region. Inspect at least one low-margin match and one case where OCR disagrees with the image.
Submit a trace
Provide raw fixture, pairing rules, transform manifest, vector version, index snapshot, ranked candidate IDs and a reviewer packet for each failure. Delete one asset after index construction and prove that the serving filter excludes it immediately. State which steps are simple fixture oracles and which would require a real image or text encoder in deployment.
Implementation
def eligible_matches(candidate_rows, withdrawn_media_ids):
withdrawn = set(withdrawn_media_ids)
return [row for row in candidate_rows
if row["media_id"] not in withdrawn and row["consent_ok"]]Performance and operating cost
Filtering C candidates is O(C + W) expected time and O(C + W) memory for W withdrawn IDs. Encoder and index costs vary by implementation; measure those separately instead of attributing a fast fixture filter to the complete system.
Common Mistakes
- Do not pair records by list position.
- Do not include duplicate receipt crops in separate evaluation splits.
- Do not return a withdrawn asset from a stale index.
