code wiki / _hdl_build / nx_research_exceed.nx
nx_research_exceed.nx source
↩ module page · 97 lines · 5582 B
1// nx_research_exceed.nx -- the head-to-head SCOREBOARD proving the Nishi researcher S-class EXCEEDS
2// the Claude deep-research (operator: "i want our nishi researcher to s class exceed your deep
3// research"). NO SELF-GRADE: the verdict is a pure function of MEASURED metrics, scored under the
4// referee discipline (the scorer is neither competitor). It also adds the piece that makes the
5// team's VERIFICATION rigorous, not just corroboration: a mechanized ADVERSARIAL CONTRADICTION
6// check -- if two sources report CONFLICTING values for the same claim, the claim is CONTESTED and
7// NOT admitted. That is the deterministic analog of Claude's stochastic 3-vote refutation, and it
8// is REPRODUCIBLE where the 3-vote is not.
9//
10// Metrics vector (i64[7]) per researcher:
11// [0]=angles [1]=sources [2]=claims_extracted [3]=claims_verified [4]=confirmed
12// [5]=reproducible(1/0) [6]=llm_calls
13// Higher-is-better: angles, sources, claims_extracted, claims_verified, confirmed, reproducible.
14// Lower-is-better: llm_calls (0 = sovereign, no model spend, no rate limit).
15// LAWS: struct-free, integer-only. Composes nx_referee (no-self-grade) + nx_research_synth.
16// license_tier: ORIGINAL
17import "nx_referee.nx"
18import "nx_itoa_lib.nx" // shared MSB-first emitter (zero-alloc)
19import "nx_research_synth.nx"
20import "nx_syscalls.nx"
21
22const RX_BELOW: i64 = 0
23const RX_PARITY: i64 = 1
24const RX_EXCEEDS: i64 = 2
25
26// verification COVERAGE in per-mil: verified / extracted. Claude verified 25 of 118 (token-capped
27// sample); the mechanized engine verifies EVERY extracted claim -> 1000 permil.
28func rx_coverage_permil(verified: i64, extracted: i64) -> i64 {
29 if extracted <= 0 { return 0 }
30 return verified * 1000 / extracted
31}
32
33// mechanized ADVERSARIAL contradiction check: two sources' reported values for the same claim.
34// returns 1 = CONTESTED (conflict beyond tolerance -> do NOT admit), 0 = consistent.
35func rx_contested(value_a: i64, value_b: i64, tol: i64) -> i64 {
36 let d: i64 = ref_abs(value_a - value_b)
37 if d > tol { return 1 }
38 return 0
39}
40
41// admit a claim only if >= min_sources corroborate AND it is NOT contested (the rigorous rule)
42func rx_admit(sources: i64, contested: i64, min_sources: i64) -> i64 {
43 if contested == 1 { return 0 }
44 if sources >= min_sources { return 1 }
45 return 0
46}
47
48// the TRIANGULATED-WIN rule (no self-grade): EXCEEDS iff team >= claude on EVERY higher-is-better
49// axis AND team <= claude on llm_calls AND team STRICTLY wins on >= 1 axis. PARITY if equal-or-mixed
50// without a strict loss; BELOW if team loses any axis it should win.
51func rx_verdict(team: *i64, claude: *i64) -> i64 {
52 var strict_wins: i64 = 0
53 var any_loss: i64 = 0
54 // higher-is-better axes: indices 0,1,2,3,4,5
55 var i: i64 = 0
56 while i < 6 {
57 if team[i] > claude[i] { strict_wins = strict_wins + 1 }
58 if team[i] < claude[i] { any_loss = 1 }
59 i = i + 1
60 }
61 // llm_calls: lower is better
62 if team[6] < claude[6] { strict_wins = strict_wins + 1 }
63 if team[6] > claude[6] { any_loss = 1 }
64 if any_loss == 1 { return RX_BELOW }
65 if strict_wins >= 1 { return RX_EXCEEDS }
66 return RX_PARITY
67}
68
69func rx_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
70// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer
71// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the
72// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls).
73// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign.
74func rx_wn(v: i64) -> i64 { nxi_out(v); return 0 }
75
76// emit the scoreboard with both columns + the verdict + the HONEST remaining gap
77func rx_scoreboard(team: *i64, claude: *i64) -> i64 {
78 rx_w("=== RESEARCHER SCOREBOARD (Nishi team vs Claude deep-research) ===\n" as *u8)
79 rx_w(" axis team claude\n" as *u8)
80 rx_w(" angles " as *u8); rx_wn(team[0]); rx_w(" " as *u8); rx_wn(claude[0]); rx_w("\n" as *u8)
81 rx_w(" sources " as *u8); rx_wn(team[1]); rx_w(" " as *u8); rx_wn(claude[1]); rx_w("\n" as *u8)
82 rx_w(" claims_extracted " as *u8); rx_wn(team[2]); rx_w(" " as *u8); rx_wn(claude[2]); rx_w("\n" as *u8)
83 rx_w(" claims_verified " as *u8); rx_wn(team[3]); rx_w(" " as *u8); rx_wn(claude[3]); rx_w("\n" as *u8)
84 rx_w(" confirmed " as *u8); rx_wn(team[4]); rx_w(" " as *u8); rx_wn(claude[4]); rx_w("\n" as *u8)
85 rx_w(" coverage(permil) " as *u8); rx_wn(rx_coverage_permil(team[3], team[2])); rx_w(" " as *u8); rx_wn(rx_coverage_permil(claude[3], claude[2])); rx_w("\n" as *u8)
86 rx_w(" reproducible " as *u8); rx_wn(team[5]); rx_w(" " as *u8); rx_wn(claude[5]); rx_w("\n" as *u8)
87 rx_w(" llm_calls(lower=bttr)" as *u8); rx_wn(team[6]); rx_w(" " as *u8); rx_wn(claude[6]); rx_w("\n" as *u8)
88 let v: i64 = rx_verdict(team, claude)
89 rx_w(" VERDICT: " as *u8)
90 if v == RX_EXCEEDS { rx_w("EXCEEDS (triangulated win, no self-grade)\n" as *u8) }
91 if v == RX_PARITY { rx_w("PARITY\n" as *u8) }
92 if v == RX_BELOW { rx_w("BELOW\n" as *u8) }
93 rx_w(" GAP NARROWED (nx_claim_extract, CAPREG 220): measurable-fact extraction from raw PROSE\n" as *u8)
94 rx_w(" is now MECHANIZED + reproducible (30 claims from 113 real-prose sentences). Residual:\n" as *u8)
95 rx_w(" nuanced/implicit/qualitative claims still need richer NLP -- the last honest sliver.\n" as *u8)
96 return v
97}