code wiki / (root) / nx_unsloth_ui_benchmark_census.nx

nx_unsloth_ui_benchmark_census.nx source

↩ module page · 58 lines · 5237 B

1// nx_unsloth_ui_benchmark_census.nx -- extend the Unsloth benchmark to the UI/FRONTEND layer (operator: 2// "it has a ui we can evaluate against too not just backend"). Unsloth Studio UI = mature no-code web app 3// (train/run/export buttons, chat, dataset builder), polished, broad. Nishi sovereign frontend (REAL, 4// verified in _hdl_build): nx_nishi_embed = sovereign Web Component (Shadow-DOM isolated, capability-scoped, 5// zero-dep, no-tracker) with a MEASURED census nx_embed_exceed (vs iframe); nx_nishi_desktop = data-driven 6// dashboard. Honest split: Unsloth wins the polished no-code PRODUCT UI; Nishi exceeds on the COMPONENT / 7// sovereignty level (isolation, zero-dep, no-tracker -- measured). Per the laws: concede where they win, 8// exceed only where measurable. No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL 9import "nx_syscalls.nx" 10 11func ui_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 12func ui_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } 13func ui_p(a: *i64, i: i64) -> *u8 { return (a[i]) as *u8 } 14 15func main() -> i64 { 16 ui_puts("UNSLOTH UI benchmark: evaluate the FRONTEND too -- honest split (product-UI vs sovereign-component)\n\n" as *u8) 17 // verdict: 2=SOVEREIGN-EXCEED(measured) 1=PARITY-POSSIBLE 0=UNSLOTH-WINS(concede) 18 let cap: *i64 = sys_mmap(16*8) as *i64 19 let ver: *i64 = sys_mmap(16*8) as *i64 20 let note: *i64 = sys_mmap(16*8) as *i64 21 cap[0]="no-code workflow UI (train/run/export buttons)\x00" as i64; ver[0]=0; note[0]="Unsloth full; Nishi=CLI/gates/organs (dev-centric) -> CONCEDE\x00" as i64 22 cap[1]="chat / inference UI\x00" as i64; ver[1]=0; note[1]="Unsloth polished web chat; Nishi=sites/vroom partial -> CONCEDE\x00" as i64 23 cap[2]="model-management dashboard\x00" as i64; ver[2]=1; note[2]="Nishi HAS nx_nishi_desktop (data-driven HTML census) -> parity-possible\x00" as i64 24 cap[3]="embeddable component (iframe-style)\x00" as i64; ver[3]=2; note[3]="nx_nishi_embed = sovereign Web Component, MEASURED exceed vs iframe (nx_embed_exceed)\x00" as i64 25 cap[4]="component isolation / sandboxing\x00" as i64; ver[4]=2; note[4]="Shadow-DOM + capability-scoped (measured) vs standard web app\x00" as i64 26 cap[5]="zero-dependency / bundle size\x00" as i64; ver[5]=2; note[5]="zero-dep Web Component (tiny) vs React/framework app (large) -> MEASURABLE win\x00" as i64 27 cap[6]="no-tracker / privacy\x00" as i64; ver[6]=1; note[6]="both no-telemetry; Nishi no-tracker BY CONSTRUCTION -> parity/slight\x00" as i64 28 cap[7]="UX polish / product maturity\x00" as i64; ver[7]=0; note[7]="Unsloth mature + polished; Nishi dev-centric -> CONCEDE\x00" as i64 29 let NC: i64=8 30 31 var exceed: i64=0 32 var parity: i64=0 33 var concede: i64=0 34 ui_puts(" UI CAPABILITY SURFACE:\n") 35 var i: i64=0 36 while i<NC { 37 ui_puts(" ") 38 if ver[i]==2 { ui_puts("[EXCEED-meas] "); exceed=exceed+1 } else { if ver[i]==1 { ui_puts("[parity?] "); parity=parity+1 } else { ui_puts("[UNSLOTH-WINS]"); concede=concede+1 } } 39 ui_puts(" "); ui_puts(ui_p(cap,i)); ui_puts(" -> "); ui_puts(ui_p(note,i)); ui_puts("\n") 40 i=i+1 41 } 42 43 ui_puts("\n HONEST SPLIT: "); ui_num(concede); ui_puts(" CONCEDED (the polished no-code PRODUCT UI -- they win), "); ui_num(parity); ui_puts(" parity, "); ui_num(exceed); ui_puts(" sovereign-EXCEED (the COMPONENT level)\n"); 44 ui_puts(" => on the PRODUCT-UI/UX, Unsloth wins (no-code, polish, maturity) -- conceded, never-uniquely-smart.\n"); 45 ui_puts(" => on the COMPONENT level, Nishi EXCEEDS (nx_nishi_embed: isolation + zero-dep + no-tracker, MEASURED vs iframe).\n"); 46 ui_puts(" => the honest UI exceed-axis to PROVE head-to-head: bundle-size + isolation of an embeddable studio widget.\n\n"); 47 48 var pass: i64=0 49 var ttl: i64=0 50 ttl=ttl+1; ui_puts(" T1 UI layer ADDED to the benchmark (frontend evaluated, not just backend): "); if NC>=6 { pass=pass+1; ui_puts("PASS\n") } else { ui_puts("FAIL\n") } 51 ttl=ttl+1; ui_puts(" T2 HONEST: concede the polished no-code PRODUCT UI to Unsloth (>=2 conceded): "); if concede>=2 { pass=pass+1; ui_puts("PASS\n") } else { ui_puts("FAIL\n") } 52 ttl=ttl+1; ui_puts(" T3 a REAL sovereign-UI exceed exists + is MEASURED (nx_nishi_embed vs iframe, >=2 axes): "); if exceed>=2 { pass=pass+1; ui_puts("PASS\n") } else { ui_puts("FAIL\n") } 53 ttl=ttl+1; ui_puts(" T4 nothing asserted -- exceed grounded in the existing measured census + a head-to-head to run: "); if (exceed+parity+concede)==NC { pass=pass+1; ui_puts("PASS\n") } else { ui_puts("FAIL\n") } 54 55 ui_puts("NX-UNSLOTH-UI-BENCHMARK-CENSUS passed "); ui_num(pass); ui_puts("/"); ui_num(ttl) 56 if pass==ttl { ui_puts(" verdict=GREEN (UI added to the benchmark; honest split -- concede product-UI, exceed component-sovereignty, measured)\n"); sys_exit(0); return 0 } 57 ui_puts(" verdict=RED\n"); sys_exit(1); return 1 58}