cazyundee commited on
Commit
cc68a12
·
1 Parent(s): be92d5f

sync: from ael backend/space/

Browse files
Files changed (1) hide show
  1. rerank.py +31 -4
rerank.py CHANGED
@@ -69,10 +69,37 @@ ENABLED = os.environ.get("AEL_RERANK", "1") not in ("0", "false", "no")
69
  # still scored correctly by it far more often than not.
70
  MODEL = os.environ.get("AEL_RERANK_MODEL", "english")
71
 
72
- # Drop a result when the model thinks it is more likely NOT to answer the query
73
- # than to answer it. Deliberately conservative: 0.5 is the neutral point of a
74
- # calibrated probability, so this only removes what the model actively rejects.
75
- DROP_BELOW = float(os.environ.get("AEL_RERANK_DROP", "0.5"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  # Never return an empty page. See the starvation note above — this is a floor of
78
  # one, not a target: a short page is fine, an empty one is not.
 
69
  # still scored correctly by it far more often than not.
70
  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.