Commit 9eacd79
committed
fix(tll): tighten shouldUseTLL regex to reduce false-positives (review #9)
The original gate was a single alternation regex that fired on any
single occurrence of `first|last|before|after|then|later|track|...`.
That over-fired on plain factual queries that incidentally contained
one of those tokens — `what is my first name`, `the model used before
GPT-4`, `track my spending` — pulling in unrelated TLL chain memories
on the augmented retrieval path.
Replaced the gate with a two-tier check:
1. ORDERING_TERMS_RE — a curated set of single-token signals
(first/last/before/after/then/later/earlier/previous/next/prior).
Only fires TLL when TWO co-occur, e.g. "what aspects did I
discuss BEFORE and AFTER X".
2. SEQUENCE_PATTERNS — phrase-level structural signals
(`in (chronological/reverse/the) order`, `when did`, `since when`,
`over time`, `evolution of`, `history|timeline of`,
`originally`/`initially`, `progression of`,
`how X evolved/shifted/changed`, `brought up`). Single phrase
hit is enough.
Removed `track`, `sequence`, and bare `order` from the gate — they
were the largest false-positive contributors.
Updated `src/services/__tests__/tll-retrieval.test.ts`:
- Positive list rewritten to canonical EO/MSR/TR shapes that hit
one of the structural patterns or co-occurring ordering terms.
- Negative list now includes the false-positive shapes the loose
regex used to match (the three reviewer-cited ones plus a handful
of single-ordering-term factual queries).
41/41 unit tests pass against the updated gate.1 parent 623ac96 commit 9eacd79
2 files changed
Lines changed: 81 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 69 | | |
67 | | - | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
75 | 82 | | |
76 | 83 | | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
81 | 88 | | |
82 | | - | |
83 | | - | |
| 89 | + | |
| 90 | + | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
| 94 | + | |
87 | 95 | | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
91 | 99 | | |
92 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
93 | 110 | | |
94 | 111 | | |
95 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
35 | 79 | | |
36 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
37 | 83 | | |
38 | 84 | | |
39 | 85 | | |
| |||
0 commit comments