Spaces:
Running on Zero
Running on Zero
sync: from ael backend/space/
Browse files
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
|
| 75 |
-
#
|
| 76 |
-
#
|
| 77 |
-
# production on 2026-10-02 (`?racerDetails=1`):
|
| 78 |
#
|
| 79 |
-
#
|
| 80 |
-
#
|
| 81 |
-
#
|
| 82 |
-
#
|
| 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 |
-
#
|
| 91 |
-
#
|
| 92 |
-
# sits far below it anyway. 0.35 keeps the 0.4 band and still removes everything
|
| 93 |
-
# under 0.15.
|
| 94 |
#
|
| 95 |
-
#
|
| 96 |
-
#
|
| 97 |
-
#
|
| 98 |
-
#
|
| 99 |
-
#
|
| 100 |
-
#
|
| 101 |
-
#
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.
|