cazyundee commited on
Commit
25910d6
·
1 Parent(s): 7af8059

sync: from ael backend/space/

Browse files
Files changed (1) hide show
  1. rerank.py +30 -26
rerank.py CHANGED
@@ -71,35 +71,39 @@ MODEL = os.environ.get("AEL_RERANK_MODEL", "english")
71
 
72
  # Drop a result the model thinks this unlikely to answer the query.
73
  #
74
- # This started at 0.5, on the reasonable-sounding argument that 0.5 is the
75
- # neutral point of a calibrated probability. That argument is wrong for this
76
- # model, and the measured score distribution says so. Nine queries against
77
- # production on 2026-10-02 (`?racerDetails=1`):
78
  #
79
- # genuinely answers the query 0.927 "Homepage - TLD" (what is .tld)
80
- # 0.838 "Lima" (capital of Peru)
81
- # 0.692 "How Does a Heat Pump Work"
82
- # 0.676 "Current World Population"
83
- # 0.522 "The Best Donuts In Seattle"
84
- # related topic, no answer 0.329 "Best Donuts San Francisco"
85
- # 0.321 "Will a Heat Pump Work in an Old House?"
86
- # unrelated 0.098 "peruse | Etymology of peruse"
87
- # 0.042 "Earliest Mysticete ... Peru"
88
- # 0.004 "Donald Trump - Wikipedia"
89
  #
90
- # The separation is between roughly 0.4 and 0.15, not at 0.5 — so 0.5 was
91
- # throwing away real answers (the 0.4 band) while the junk it was meant to catch
92
- # sits far below it anyway. 0.35 keeps the 0.4 band and still removes everything
93
- # under 0.15.
94
  #
95
- # What a threshold cannot fix, and did not try to: the model scores news and
96
- # retail homepages at 0.65-0.80 for questions they cannot answer ("population of
97
- # Ascension Island" -> "Current World Population", 0.676). The instructions
98
- # below already tell it to answer no for homepages and category listings and it
99
- # does not always. That is a model limitation, recorded rather than papered over
100
- # with a hand-written heuristic — and the honest response to it is better
101
- # engines, which is the race's job, not this stage's.
102
- DROP_BELOW = float(os.environ.get("AEL_RERANK_DROP", "0.35"))
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  # Never return an empty page. See the starvation note above — this is a floor of
105
  # one, not a target: a short page is fine, an empty one is not.
 
71
 
72
  # Drop a result the model thinks this unlikely to answer the query.
73
  #
74
+ # This went 0.5 -> 0.35 -> 0.15, and the direction is the finding: **the model is
75
+ # a good ranker of snippets and a bad dropper of them.** Measured on production,
76
+ # 2026-10-02:
 
77
  #
78
+ # Ranked correctly, repeatedly. "capital of Peru" put "Lima" (0.838) above a
79
+ # Nat Geo photo of a Peruvian mysticete (0.042); "who won the 1876 presidential
80
+ # election" put the Wikipedia election article above a Reddit thread about a
81
+ # video game achievement. Reordering is where it earns its keep.
 
 
 
 
 
 
82
  #
83
+ # Dropped answers it should not have. At 0.35 the threshold removed the correct
84
+ # result for four questions in a row and kept a generic page instead:
 
 
85
  #
86
+ # "Unix program that replaced man with compressed pages" -> mandb gone,
87
+ # "Linux/Unix Tutorial" kept
88
+ # "first artificial satellite to orbit a body other than Earth" -> Luna gone,
89
+ # a Hackaday post kept
90
+ # "TLD delegated to a donut shop" -> .donuts gone, ".radio" kept
91
+ # "IUPAC systematic name of caffeine" -> the chemistry pages kept, the
92
+ # answer-bearing ones dropped
93
+ #
94
+ # The cause is not a bad threshold, it is what the model is reading: a title and
95
+ # a snippet, never the page. A snippet about mandb does not contain the words
96
+ # "compressed manual pages", so the passage looks like a non-answer even when
97
+ # the page is the answer. No threshold fixes that — the useful behaviour is to
98
+ # *rank* on what the snippet says and let the reader open the page, which is
99
+ # what the tool prompt already tells the model to do.
100
+ #
101
+ # So: drop only what the model actively rejects, and let ordering do the rest.
102
+ # Measured unrelated results sit at 0.004-0.098, so 0.15 removes the clearly
103
+ # irrelevant while leaving the ambiguous ones for the reader. The result is
104
+ # deliberately a longer page than the 0.35 experiment produced — a research
105
+ # tool that returns one confident result is a worse research tool.
106
+ DROP_BELOW = float(os.environ.get("AEL_RERANK_DROP", "0.15"))
107
 
108
  # Never return an empty page. See the starvation note above — this is a floor of
109
  # one, not a target: a short page is fine, an empty one is not.