measure: claim-24 unfloored semantic leg vs bm25lex baseline - net +0, NOT-SHOWN
gains q14,q25 (gold at global cosine rank 1, previously discarded by the 0.60 floor); losses q15,q28 (the semantic leg was EMPTY on those queries under the floor, so filling it turns a 2-leg rotation into a 3-leg one and halves the associative leg's share of the top 5). Guards held: exact_rare 6/6, phrase 7/7, nonsense 2/3, superseded 2/3 outranks. recall@10 61.8->65.4pp, latency 0.99x. Baseline reproduced from source (results-bm25base-rerun.json is byte-identical to the committed results-bm25lex.json), candidate deterministic across 2 runs.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
exec(open('sim6.py').read().split('if __name__')[0])
|
||||
HASSTRUCT=set(adj.keys())
|
||||
print("nodes with >=1 structural edge:",len(HASSTRUCT),file=sys.stderr)
|
||||
def run2(sfilter, seedout, lim=10):
|
||||
res={}
|
||||
for qid,q in gold.items():
|
||||
v=emb(q['query']); s=M@v; s[~np.isfinite(s)]=-1
|
||||
L,nmatch=lexleg(qid,q['query'])
|
||||
if nmatch==0: res[qid]=[]; continue
|
||||
ordr=np.argsort(-s)
|
||||
cand=[eids[j] for j in ordr[:200] if PRINT.match(eids[j] or '')]
|
||||
S=[x for x in cand if (not sfilter or x in HASSTRUCT)][:10]
|
||||
seeds=[x for x in L[:3] if x in N]
|
||||
semseeds=[eids[j] for j in ordr[:8] if eids[j] in N and eids[j] not in seeds and PRINT.match(eids[j] or '')]
|
||||
seeds=seeds+semseeds
|
||||
A=assoc(seeds,s,False,'cos') if seeds else []
|
||||
if seedout:
|
||||
extra=[(float(s[eidx[x]]),x) for x in semseeds if x in HASSTRUCT and x in eidx]
|
||||
merged=[(float(s[eidx[x]]),x) for x in A if x in eidx]+extra
|
||||
merged.sort(reverse=True)
|
||||
seen=set(); A=[]
|
||||
for c,x in merged:
|
||||
if x in seen: continue
|
||||
seen.add(x); A.append(x)
|
||||
A=A[:ASSOC_MAX]
|
||||
res[qid]=inter([L,S,A])
|
||||
return res
|
||||
b,_=run(True,False,False,'cos'); base=score(b,'BASE bm25lex replica')
|
||||
a,_=run(False,True,False,'cos'); score(a,'A floor-off+vocabgate',base)
|
||||
score(run2(False,True),'E A+struct-seeds-in-graphleg',base)
|
||||
score(run2(True,False),'F A+S-restricted-to-graph',base)
|
||||
score(run2(True,True),'G E+F',base)
|
||||
Reference in New Issue
Block a user