code wiki / _hdl_build / nx_meet_trust_gate.nx
nx_meet_trust_gate.nx source
↩ module page · 82 lines · 6054 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"
10
11func main() -> i64 {
12 mputs("=== nx_meet_trust_gate: R6 anti-fake detection -- MEASURED vs accept-all baseline ===\n" as *u8)
13
14 let rf: *i64 = sys_mmap(64) as *i64
15 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
16 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
17 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
18 rf[3] = "Dynamic results-driven professional. Passionate team player with synergy. As an AI, I leverage detail-oriented skills." as *u8 as i64
19 let rr: *i64 = sys_mmap(64) as *i64
20 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
21 rr[1] = "Registered Nurse, 8 years ICU at Plano Medical. TX license 12345. References on request, sam@example.com." as *u8 as i64
22 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
23 rr[3] = "Staff accountant; closed books in 4 days at Frisco LLC; managed a 2M general ledger. dana@example.com" as *u8 as i64
24 let pf: *i64 = sys_mmap(64) as *i64
25 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
26 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
27 pf[2] = "Unlimited earning potential, be your own boss! Competitive salary, fast-paced environment. Ninjas and rockstars wanted." as *u8 as i64
28 pf[3] = "We are like a family in a fast-paced environment. Always hiring. Competitive salary, wear many hats." as *u8 as i64
29 let pr: *i64 = sys_mmap(64) as *i64
30 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
31 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
32 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
33 pr[3] = "Staff Accountant, Frisco LLC, remote. 70,000 to 85,000 USD. Month-end close. https://friscollc.com/careers" as *u8 as i64
34
35 var our: i64 = 0; var naive: i64 = 0; var total: i64 = 0
36 var fakes_caught: i64 = 0; var total_fakes: i64 = 0
37 var i: i64 = 0
38 while i < 4 {
39 total = total + 1; total_fakes = total_fakes + 1
40 if trust_is_fake_resume(rf[i] as *u8) == 1 { our = our + 1; fakes_caught = fakes_caught + 1 }
41 i = i + 1
42 }
43 i = 0
44 while i < 4 {
45 total = total + 1
46 if trust_is_fake_resume(rr[i] as *u8) == 0 { our = our + 1 }
47 naive = naive + 1
48 i = i + 1
49 }
50 i = 0
51 while i < 4 {
52 total = total + 1; total_fakes = total_fakes + 1
53 if trust_is_ghost_posting(pf[i] as *u8) == 1 { our = our + 1; fakes_caught = fakes_caught + 1 }
54 i = i + 1
55 }
56 i = 0
57 while i < 4 {
58 total = total + 1
59 if trust_is_ghost_posting(pr[i] as *u8) == 0 { our = our + 1 }
60 naive = naive + 1
61 i = i + 1
62 }
63
64 mputs(" our_correct=" as *u8); mnum(our); mputs("/" as *u8); mnum(total)
65 mputs(" accept-all=" as *u8); mnum(naive); mputs("/" as *u8); mnum(total)
66 mputs(" fakes_caught=" as *u8); mnum(fakes_caught); mputs("/" as *u8); mnum(total_fakes); mputs("\n" as *u8)
67
68 var pass: i64 = 0; var fail: i64 = 0
69 if our >= 15 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL low-accuracy\n" as *u8) }
70 if fakes_caught == total_fakes { pass=pass+1 } else { fail=fail+1; mputs(" FAIL missed-a-fake\n" as *u8) }
71 if naive <= 9 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL naive-too-good\n" as *u8) }
72 if (our - naive) >= 6 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL no-measured-exceed\n" as *u8) }
73 // liar-kill teeth (neither trivial extreme can pass: catch a known fake/ghost, pass a known real)
74 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) }
75 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) }
76 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) }
77 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) }
78
79 mputs("MEET-TRUST-GATE pass=" as *u8); mnum(pass); mputs(" fail=" as *u8); mnum(fail)
80 if fail == 0 { mputs(" verdict=GREEN (MEASURED anti-fake: our " as *u8); mnum(our); mputs("/16 vs accept-all " as *u8); mnum(naive); mputs("/16, every fake caught, reals pass)\n" as *u8); sys_exit(0); return 0 }
81 mputs(" verdict=RED\n" as *u8); sys_exit(1); return 1
82}