@@ -23,6 +23,7 @@ import (
2323 "strings"
2424 "time"
2525
26+ "github.com/AccursedGalaxy/mneme"
2627 "github.com/AccursedGalaxy/mneme/bench"
2728 "github.com/AccursedGalaxy/mneme/provider"
2829 "github.com/AccursedGalaxy/mneme/provider/fake"
@@ -49,6 +50,8 @@ func run() error {
4950 k = flag .Int ("k" , 5 , "search top-k facts fed to the answer model" )
5051 strategy = flag .String ("strategy" , bench .StrategyAdditive , "write strategy: additive | consolidate" )
5152 cprompt = flag .String ("cprompt" , "" , "consolidation prompt version (e.g. v1 | v2); empty = library default. Only used with -strategy consolidate" )
53+ rerank = flag .Bool ("rerank" , false , "enable the LLM rerank pass in Search (over-retrieve, reorder, truncate to k)" )
54+ multiQ = flag .Int ("multiquery" , 0 , "if >1, expand each question into this many search phrasings and union the hits before reranking" )
5255 limit = flag .Int ("limit" , 0 , "if >0, run only the first N samples (smoke test)" )
5356 maxQ = flag .Int ("maxq" , 0 , "if >0, cap questions per sample (smoke/cost control)" )
5457 out = flag .String ("out" , "bench/RESULTS.md" , "results file to write (markdown); empty to skip" )
@@ -113,13 +116,20 @@ func run() error {
113116 ctx , cancel := context .WithTimeout (context .Background (), 2 * time .Hour )
114117 defer cancel ()
115118
119+ var reranker mneme.Reranker
120+ if * rerank {
121+ reranker = & openai.LLMReranker {LLM : llm }
122+ }
123+
116124 report , err := bench .Run (ctx , samples , bench.Config {
117125 LLM : llm ,
118126 Embedder : embedder ,
119127 Store : st ,
120128 K : * k ,
121129 Strategy : * strategy ,
122130 ConsolidationVersion : * cprompt ,
131+ Reranker : reranker ,
132+ MultiQuery : * multiQ ,
123133 Progress : func (done , total int ) {
124134 fmt .Fprintf (os .Stderr , "\r scored %d/%d samples" , done , total )
125135 if done == total {
@@ -144,6 +154,8 @@ func run() error {
144154 maxQ : * maxQ ,
145155 samples : len (samples ),
146156 cprompt : * cprompt ,
157+ rerank : * rerank ,
158+ multiQ : * multiQ ,
147159 })
148160 fmt .Print (md )
149161
@@ -211,6 +223,8 @@ type runMeta struct {
211223 dataset , path , model , embedder string
212224 limit , maxQ , samples int
213225 cprompt string // consolidation prompt version, if set
226+ rerank bool // rerank pass active in Search
227+ multiQ int // multi-query fan-out (0/1 = off)
214228}
215229
216230// render builds the human + markdown report: a per-category table (the lever
@@ -225,6 +239,12 @@ func render(report bench.Report, m runMeta) string {
225239 if m .cprompt != "" {
226240 fmt .Fprintf (& b , " · cprompt: `%s`" , m .cprompt )
227241 }
242+ if m .rerank {
243+ fmt .Fprintf (& b , " · rerank: `on`" )
244+ }
245+ if m .multiQ > 1 {
246+ fmt .Fprintf (& b , " · multiquery: `%d`" , m .multiQ )
247+ }
228248 b .WriteString ("\n \n " )
229249 fmt .Fprintf (& b , "Metrics: **EM** = normalized exact match, **F1** = token-overlap F1, **Judge** = LLM semantic match. n = question count.\n \n " )
230250
@@ -255,6 +275,12 @@ func render(report bench.Report, m runMeta) string {
255275 if m .cprompt != "" {
256276 fmt .Fprintf (& b , " -cprompt %s" , m .cprompt )
257277 }
278+ if m .rerank {
279+ fmt .Fprintf (& b , " -rerank" )
280+ }
281+ if m .multiQ > 1 {
282+ fmt .Fprintf (& b , " -multiquery %d" , m .multiQ )
283+ }
258284 if m .limit > 0 {
259285 fmt .Fprintf (& b , " -limit %d" , m .limit )
260286 }
0 commit comments