golangLAKEHOUSE/reports/reality-tests/playbook_lift_004.md
root 67d1957b87 matrix: split boost / inject thresholds — kills Shape B cross-pollination
Run #003 surfaced rampant cross-pollination: Q2's "OSHA-30 forklift
Wisconsin" recording (w-4435) became warm top-1 for Q19 (dental
hygienist), Q20 (RN), Q21 (software engineer), and 6 other unrelated
staffing queries. Cause: InjectPlaybookMisses inherited the same
DefaultPlaybookMaxDistance (0.5) as the boost path, but inject is
structurally riskier than boost — boost only re-ranks results that
already retrieved on their own merits, while inject FORCES a result
into top-K, so a loose match cross-pollinates wrong-domain answers.

Empirical motivation from v3:
  Implied playbook hit distances for cross-pollinated cases: 0.20-0.46
  Implied distances for the 6/6 paraphrase recoveries:        0.23-0.30
  Threshold of 0.20 should keep most paraphrases, kill the OOD bleed.

Implementation:
- New DefaultPlaybookMaxInjectDistance = 0.20 in playbook.go.
- New PlaybookMaxInjectDistance field on SearchRequest (override).
- InjectPlaybookMisses signature gains maxInjectDist param; hits whose
  Distance exceeds it are skipped (boost path may still re-rank them).
- TestInjectPlaybookMisses_RespectsInjectThreshold locks the contract
  with one tight + one loose hit, asserting only the tight one injects.
- Existing tests pass explicit threshold (0 = default for tight tests,
  0.5 for the dedupe test which uses 0.30 hits).

Run #004 result on identical queries with the split threshold:

  Verbatim discovery        8 (vs v3's 6 — judge variance, separate)
  Verbatim lift             6 / 8 (75%)
  Paraphrase top-1          6 / 8 (75%)
  Paraphrase any-rank in K  6 / 8

OOD queries Q19/Q20/Q21 ALL show warm top-1 = cold top-1 (no
injection) — cross-pollination eliminated where it was wrong-direction.
Mean Δ top-1 distance dropped from -0.164 (v3, distorted) to -0.071
(v4, comparable to v1's -0.053).

Two paraphrases missed in v4 (Q9, Q15) were ones where qwen2.5
rephrased liberally enough to drift past 0.20 — Q9: "Inventory
specialist..." → "Individual needed for inventory management..." and
Q15: "Engaged warehouse associate..." → "Warehouse associate currently
engaged with a robust history...". The system correctly refusing to
inject when it's not confident is the right product behavior; the
boost path still re-ranks recorded answers when they appear in regular
retrieval.

The Q6 ↔ Q7 cross-pollination ("Forklift-certified loader" ↔
"Hazmat warehouse worker") is legitimate — these are genuinely similar
staffing queries and the judge ranks both directions as plausible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 07:24:55 -05:00

118 lines
7.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Playbook-Lift Reality Test — Run 004
**Generated:** 2026-04-30T12:23:36.594892386Z
**Judge:** `qwen2.5:latest` (Ollama, resolved from env JUDGE_MODEL=qwen2.5:latest)
**Corpora:** `workers,ethereal_workers`
**Workers limit:** 5000
**Queries:** `tests/reality/playbook_lift_queries.txt` (21 executed)
**K per pass:** 10
**Paraphrase pass:** ENABLED
**Evidence:** `reports/reality-tests/playbook_lift_004.json`
---
## Headline
| Metric | Value |
|---|---:|
| Total queries run | 21 |
| Cold-pass discoveries (judge-best ≠ top-1) | 8 |
| Warm-pass lifts (recorded playbook → top-1) | 6 |
| No change (judge-best already top-1, no playbook needed) | 15 |
| Playbook boosts triggered (warm pass) | 8 |
| Mean Δ top-1 distance (warm cold) | -0.070719235 |
| **Paraphrase pass — recorded answer at rank 0 (top-1)** | **6 / 8** |
| Paraphrase pass — recorded answer at any rank in top-K | 6 / 8 |
**Verbatim lift rate:** 6 of 8 discoveries became top-1 after warm pass.
---
## Per-query results
| # | Query | Cold top-1 | Cold judge-best (rank/rating) | Recorded? | Warm top-1 | Judge-best warm rank | Lift |
|---|---|---|---|---|---|---|---|
| 1 | Forklift operator with OSHA-30, warehouse experience, day sh | e-4983 | 1/4 | ✓ e-5729 | e-5729 | 0 | **YES** |
| 2 | OSHA-30 certified forklift operator in Wisconsin, cold stora | e-868 | 9/3 | — | e-7308 | -1 | no |
| 3 | Production worker with confined-space cert and hazmat traini | w-4583 | 1/2 | — | w-1231 | 2 | no |
| 4 | CDL Class A driver, clean record, willing to do regional 4-d | w-3272 | 0/1 | — | w-3272 | 0 | no |
| 5 | Warehouse lead with current OSHA-30 certification, NOT OSHA- | w-2356 | 3/2 | — | w-2356 | 3 | no |
| 6 | Forklift-certified loader, certification must be active, dis | e-3940 | 3/4 | ✓ w-330 | e-7453 | 1 | no |
| 7 | Hazmat-certified warehouse worker comfortable with cold stor | w-4633 | 4/4 | ✓ e-7453 | w-330 | 1 | no |
| 8 | Bilingual production worker with team-lead experience and tr | w-2983 | 0/4 | — | w-2983 | 0 | no |
| 9 | Inventory specialist with confined-space cert and compliance | w-3037 | 7/4 | ✓ w-1231 | w-1231 | 0 | **YES** |
| 10 | Warehouse worker who can run inventory cycles and lead a sma | e-6649 | 1/4 | ✓ w-4113 | w-4113 | 0 | **YES** |
| 11 | Production line worker comfortable filling in as line superv | w-1010 | 3/4 | ✓ w-1153 | w-1153 | 0 | **YES** |
| 12 | Customer service rep willing to cross-train into dispatch or | e-6474 | 1/2 | — | e-6474 | 1 | no |
| 13 | Reliable production line lead with strong attendance and lea | e-4284 | 0/3 | — | e-4284 | 0 | no |
| 14 | Highly responsive forklift operator available for last-minut | e-285 | 4/4 | ✓ e-7308 | e-7308 | 0 | **YES** |
| 15 | Engaged warehouse associate with strong safety compliance re | e-8404 | 5/4 | ✓ w-3242 | w-3242 | 0 | **YES** |
| 16 | CDL-A driver based in IL or WI, willing to run regional 4-da | w-3257 | 4/2 | — | w-3257 | 4 | no |
| 17 | Bilingual customer service rep in Indianapolis or Cincinnati | w-1387 | 0/1 | — | w-1387 | 0 | no |
| 18 | Production supervisor open to Midwest relocation for permane | e-7478 | 1/2 | — | e-7478 | 1 | no |
| 19 | Dental hygienist with three years experience, Indianapolis a | e-2544 | 0/1 | — | e-2544 | 0 | no |
| 20 | Registered nurse with ICU experience, willing to take per-di | w-419 | 0/1 | — | w-419 | 0 | no |
| 21 | Software engineer with React and TypeScript, three years exp | w-334 | 0/1 | — | w-334 | 0 | no |
---
## Paraphrase pass — does the playbook help similar-but-different queries?
For each query whose Pass 1 cold pass recorded a playbook entry, the
judge model rephrased the query, and the rephrased version was sent
through warm matrix.search. The recorded answer ID's rank in those
results tests whether cosine on the embedded paraphrase finds the
recorded query's vector.
| # | Original (≤40c) | Paraphrase (≤60c) | Recorded answer | Paraphrase top-1 | Recorded rank | Paraphrase lift |
|---|---|---|---|---|---|---|
| 1 | Forklift operator with OSHA-30, warehous | Seeking forklift operator certified in OSHA-30, with backgro | e-5729 | e-5729 | 0 | **YES** |
| 6 | Forklift-certified loader, certification | Loader with active forklift certification, separate from reg | w-330 | w-330 | 0 | **YES** |
| 7 | Hazmat-certified warehouse worker comfor | Warehouse worker with Hazmat certification and experience in | e-7453 | e-7453 | 0 | **YES** |
| 9 | Inventory specialist with confined-space | Individual needed for inventory management with certificatio | w-1231 | w-987 | -1 | no |
| 10 | Warehouse worker who can run inventory c | Seeking a warehouse worker capable of conducting inventory c | w-4113 | w-4113 | 0 | **YES** |
| 11 | Production line worker comfortable filli | Seeking a production line worker capable of temporarily step | w-1153 | w-1153 | 0 | **YES** |
| 14 | Highly responsive forklift operator avai | Available for urgent forklift operation shifts requiring imm | e-7308 | e-7308 | 0 | **YES** |
| 15 | Engaged warehouse associate with strong | Warehouse associate currently engaged with a robust history | w-3242 | e-2615 | -1 | no |
---
## Honesty caveats
1. **Judge IS the ground truth proxy.** Without human-labeled relevance, the LLM
judge's verdict is what defines "best." If `qwen2.5:latest` rates badly,
the lift number is meaningless. To validate the judge itself, sample 510
verdicts manually and check agreement.
2. **Score-1.0 boost = distance halved.** Playbook math is
`distance' = distance × (1 - 0.5 × score)`. Lift requires the judge-best
result's pre-boost distance to be ≤ 2× the cold top-1's distance, otherwise
even halving doesn't promote it. Tight clusters → little visible lift.
3. **Verbatim vs paraphrase.** The verbatim lift rate (above) is the cheap
case — same query, recorded playbook, expected boost. The paraphrase
pass (when enabled) is the actual learning property: similar-but-different
queries hitting a recorded playbook. Compare verbatim and paraphrase
lift rates — paraphrase should be lower (semantic-distance gates some
playbook hits) but non-zero is the meaningful signal.
4. **Multi-corpus skew.** Default corpora=`workers,ethereal_workers` — if all judge-best
results land in one corpus, the matrix layer's purpose isn't being tested.
Check per-corpus distribution in the JSON.
5. **Judge resolution.** This run used `qwen2.5:latest` from
env JUDGE_MODEL=qwen2.5:latest.
Bumping the judge for run #N+1 means editing one line in lakehouse.toml.
6. **Paraphrase generation also uses the judge.** The same model that rates
relevance also rephrases queries. A judge that's bad at rating staffing
queries is probably also bad at rephrasing them. Worth sanity-checking
a sample of `paraphrase_query` values in the JSON before trusting the
paraphrase lift number.
## Next moves
- If lift rate ≥ 50% of discoveries: matrix layer + playbook is doing real
work. Move to paraphrase queries + tag-based boost (currently ignored).
- If lift rate < 20%: investigate why judge variance, distance gap too
wide, or playbook math too gentle. The score=1.0 / 0.5× formula may need
retuning.
- If discovery rate (cold judge-best top-1) is itself low: cosine is
already close to optimal on this query distribution. Either the corpus
is too narrow or the queries are too easy.