21d3516426
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.
31 lines
1.4 KiB
Python
31 lines
1.4 KiB
Python
exec(open('sim6.py').read().split('if __name__')[0])
|
|
HASSTRUCT=set(adj.keys())
|
|
import json as _j
|
|
d2=_j.load(open('/Users/timlingo/neuron-memory-backups/snapshot-pre-repair-20260806.json',encoding='utf-8',errors='surrogateescape'))
|
|
ANYEDGE=set()
|
|
for e in d2['edges']: ANYEDGE.add(e['from_id']); ANYEDGE.add(e['to_id'])
|
|
del d2
|
|
print("struct=%d anyedge=%d"%(len(HASSTRUCT),len(ANYEDGE)),file=sys.stderr)
|
|
def run4(pool, nlegs, lim=10):
|
|
P = HASSTRUCT if pool=='struct' else ANYEDGE
|
|
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[:3000] if PRINT.match(eids[j] or '')]
|
|
S=cand[:10]
|
|
G=[x for x in cand if x in P][:10]
|
|
seeds=[x for x in L[:3] if x in N]
|
|
seeds=seeds+[eids[j] for j in ordr[:8] if eids[j] in N and eids[j] not in seeds and PRINT.match(eids[j] or '')]
|
|
A=assoc(seeds,s,False,'cos') if seeds else []
|
|
legs=[L,S,G,A] if nlegs==4 else [L,G,A]
|
|
res[qid]=inter(legs)
|
|
return res
|
|
b,_=run(True,False,False,'cos'); base=score(b,'BASE bm25lex replica')
|
|
score(run4('struct',4),'I 4leg L,S,G(struct),A',base)
|
|
score(run4('any',4), 'J 4leg L,S,G(anyedge),A',base)
|
|
score(run4('struct',3),'K 3leg L,G(struct),A',base)
|
|
score(run4('any',3), 'L 3leg L,G(anyedge),A',base)
|