code wiki / _hdl_build / nx_meet_trust_gate.nx

nx_meet_trust_gate.nx source

↩ module page · 90 lines · 6324 B

1// nx_meet_trust_gate.nx -- liar-kill, MEASURED gate for R6 (the anti-fake engine). Runs the scorer over a labeled 2// fixture set (4 AI-slop resumes + 4 real, 4 ghost postings + 4 real) and proves a MEASURED exceed over the 3// status-quo "accept-all" baseline (incumbents largely DON'T screen for AI-slop/ghost = accept everything). Teeth: 4// (a) our accuracy must be near-perfect AND catch every fake, (b) the accept-all baseline must do far worse, AND 5// (c) the scorer must NOT trivially flag everything (real samples must pass) -- so neither trivial extreme passes. 6// expect_exit: 0 7import "nx_syscalls.nx" 8import "nx_meet_lib.nx" 9import "nx_meet_trust.nx" 10import "nx_gate_verdict.nx" 11 12func main() -> i64 { 13 mputs("=== nx_meet_trust_gate: R6 anti-fake detection -- MEASURED vs accept-all baseline ===\n" as *u8) 14 15 let rf: *i64 = sys_mmap(64) as *i64 16 rf[0] = "As an AI language model, I am a results-driven professional with synergy and a proven track record. Detail-oriented go-getter who can hit the ground running." as *u8 as i64 17 rf[1] = "Passionate team player and self-starter. I think outside the box and bring synergy to every results-driven team. Detail-oriented professional." as *u8 as i64 18 rf[2] = "A go-getter with a proven track record. Results-driven professional, detail-oriented, ready to hit the ground running and think outside the box." as *u8 as i64 19 rf[3] = "Dynamic results-driven professional. Passionate team player with synergy. As an AI, I leverage detail-oriented skills." as *u8 as i64 20 let rr: *i64 = sys_mmap(64) as *i64 21 rr[0] = "Built payment service handling 12000 req/s at Acme; cut latency 38 percent. Contact jane@example.com, github.com/jane. 6 years Go and Rust." as *u8 as i64 22 rr[1] = "Registered Nurse, 8 years ICU at Plano Medical. TX license 12345. References on request, sam@example.com." as *u8 as i64 23 rr[2] = "CNC machinist, 5-axis, 3 yrs at Local Tool Co. Portfolio http://example.com/work. Reduced scrap 22 percent." as *u8 as i64 24 rr[3] = "Staff accountant; closed books in 4 days at Frisco LLC; managed a 2M general ledger. dana@example.com" as *u8 as i64 25 let pf: *i64 = sys_mmap(64) as *i64 26 pf[0] = "Competitive salary in a fast-paced environment. Be your own boss with unlimited earning potential! We are always hiring rockstars and ninjas who wear many hats." as *u8 as i64 27 pf[1] = "Work hard play hard, we are like a family! Fast-paced environment, competitive salary, always hiring. Wear many hats, be a rockstar." as *u8 as i64 28 pf[2] = "Unlimited earning potential, be your own boss! Competitive salary, fast-paced environment. Ninjas and rockstars wanted." as *u8 as i64 29 pf[3] = "We are like a family in a fast-paced environment. Always hiring. Competitive salary, wear many hats." as *u8 as i64 30 let pr: *i64 = sys_mmap(64) as *i64 31 pr[0] = "Senior Engineer at Acme (https://acme.com), McKinney TX. Salary range 140,000 to 170,000 USD. Build our payments platform. Contact careers@acme.com." as *u8 as i64 32 pr[1] = "ICU RN, Plano Medical Center, Plano TX. Pay 38 to 48 per hour, nights. Apply https://planomed.org/jobs. TX license required." as *u8 as i64 33 pr[2] = "CNC Machinist, Local Tool Co, McKinney TX. 28 dollars per hour, contract-to-hire. 5-axis. http://localtool.com" as *u8 as i64 34 pr[3] = "Staff Accountant, Frisco LLC, remote. 70,000 to 85,000 USD. Month-end close. https://friscollc.com/careers" as *u8 as i64 35 36 var our: i64 = 0; var naive: i64 = 0; var total: i64 = 0 37 var fakes_caught: i64 = 0; var total_fakes: i64 = 0 38 var i: i64 = 0 39 while i < 4 { 40 total = total + 1; total_fakes = total_fakes + 1 41 if trust_is_fake_resume(rf[i] as *u8) == 1 { our = our + 1; fakes_caught = fakes_caught + 1 } 42 i = i + 1 43 } 44 i = 0 45 while i < 4 { 46 total = total + 1 47 if trust_is_fake_resume(rr[i] as *u8) == 0 { our = our + 1 } 48 naive = naive + 1 49 i = i + 1 50 } 51 i = 0 52 while i < 4 { 53 total = total + 1; total_fakes = total_fakes + 1 54 if trust_is_ghost_posting(pf[i] as *u8) == 1 { our = our + 1; fakes_caught = fakes_caught + 1 } 55 i = i + 1 56 } 57 i = 0 58 while i < 4 { 59 total = total + 1 60 if trust_is_ghost_posting(pr[i] as *u8) == 0 { our = our + 1 } 61 naive = naive + 1 62 i = i + 1 63 } 64 65 mputs(" our_correct=" as *u8); mnum(our); mputs("/" as *u8); mnum(total) 66 mputs(" accept-all=" as *u8); mnum(naive); mputs("/" as *u8); mnum(total) 67 mputs(" fakes_caught=" as *u8); mnum(fakes_caught); mputs("/" as *u8); mnum(total_fakes); mputs("\n" as *u8) 68 69 var pass: i64 = 0; var fail: i64 = 0 70 if our >= 15 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL low-accuracy\n" as *u8) } 71 if fakes_caught == total_fakes { pass=pass+1 } else { fail=fail+1; mputs(" FAIL missed-a-fake\n" as *u8) } 72 if naive <= 9 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL naive-too-good\n" as *u8) } 73 if (our - naive) >= 6 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL no-measured-exceed\n" as *u8) } 74 // liar-kill teeth (neither trivial extreme can pass: catch a known fake/ghost, pass a known real) 75 if trust_is_fake_resume(rf[0] as *u8) == 1 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL teeth-fake-not-caught\n" as *u8) } 76 if trust_is_fake_resume(rr[0] as *u8) == 0 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL teeth-real-flagged\n" as *u8) } 77 if trust_is_ghost_posting(pf[0] as *u8) == 1 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL teeth-ghost-not-caught\n" as *u8) } 78 if trust_is_ghost_posting(pr[0] as *u8) == 0 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL teeth-realpost-flagged\n" as *u8) } 79 80 mputs("MEET-TRUST-GATE pass=" as *u8); mnum(pass); mputs(" fail=" as *u8); mnum(fail) 81 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check 82 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled 83 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify. 84 let ctr__dry: *i64 = gv_ctr() 85 ctr__dry[0] = pass 86 ctr__dry[1] = pass + fail 87 let rc__dry: i64 = gv_verdict("MEET-TRUST-GATE" as *u8, ctr__dry, "MEASURED anti-fake: our " as *u8) 88 sys_exit(rc__dry) 89 return rc__dry 90}