code wiki / (root) / nx_swcompare_sota.nx

nx_swcompare_sota.nx source

↩ module page · 225 lines · 17766 B

1// nx_swcompare_sota.nx -- STATE-OF-THE-ART software comparison generator (operator 2026-07-09: "we census too few 2// competitors ... look at how systems are compared at a SOTA level -- speed, functionality, features, APIs"). 3// Beyond the toy nx_swcompare_matrix (4 competitors, Yes/No symbol-presence): reads knowledge/compare/<domain>.sota 4// @title / @sub / @cols <c1>|..|<cM> (M competitors, Nishi is column 0, variable M) 5// @cat <category> (groups the axes that follow -- Speed, Quantization, API, ...) 6// <axis>|<kind>|<v0>|<v1>|..|<v(M-1)>|<note> (M cell values, one per column; kind=num|g) 7// kind=num -> the cell value is shown verbatim (a measured number / range / unit -- quantitative) 8// kind=g -> the value is a grade token: B=Best n=No Y=Yes ~=Partial (badged) 9// Honest by construction: cells are researcher-sourced / measured (note carries the source); Nishi (col 0) shows its 10// REAL number (e.g. 1.5 tok/s), NOT a presence tick. Modes: no-arg = console + liar-kill gate; html; json. 11// NOTE: no '#'/'!' in string literals (nx_cc trap) -> rgb() + wc(fd,33). license_tier: ORIGINAL expect_exit: 0 12import "nx_syscalls.nx" 13const K_MAGIC_262144: i64 = 262144 14 15func w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } 16func wc(fd: i64, code: i64) -> i64 { let t: *u8 = sys_mmap(2); t[0] = code as u8; sys_write(fd, t, 1); return 0 } 17func wn(fd: i64, v: i64) -> i64 { 18 var m: i64 = v; if m < 0 { w(fd, "-" as *u8); m = 0 - m } 19 let t: *u8 = sys_mmap(24); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } 20 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 21 let o: *u8 = sys_mmap(24); var i: i64 = 0; while i < k { o[i] = t[k-1-i]; i = i + 1 } sys_write(fd, o, k); return 0 22} 23func wj(fd: i64, s: *u8) -> i64 { 24 var i: i64 = 0 25 while s[i] != (0 as u8) { let c: i64 = s[i] as i64 26 if c == 34 { wc(fd, 92); wc(fd, 34) } else { if c == 92 { wc(fd, 92); wc(fd, 92) } else { if c < 32 { wc(fd, 32) } else { wc(fd, c) } } } 27 i = i + 1 } 28 return 0 29} 30func wq(fd: i64) -> i64 { wc(fd, 34); return 0 } 31func kv_s(fd: i64, key: *u8, val: *u8) -> i64 { wq(fd); w(fd, key); wq(fd); wc(fd, 58); wq(fd); wj(fd, val); wq(fd); return 0 } 32func kv_n(fd: i64, key: *u8, v: i64) -> i64 { wq(fd); w(fd, key); wq(fd); wc(fd, 58); wn(fd, v); return 0 } 33func c_read(path: *u8, buf: *u8, cap: i64) -> i64 { 34 let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } 35 var tot: i64 = 0 36 while tot < cap { let r: i64 = sys_read(fd, (buf as i64 + tot) as *u8, cap - tot); if r <= 0 { break } tot = tot + r } 37 sys_close(fd); return tot 38} 39func streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } 40func starts(s: *u8, pfx: *u8) -> i64 { var i: i64 = 0; while pfx[i] != (0 as u8) { if s[i] != pfx[i] { return 0 } i = i + 1 } return 1 } 41func scopy(dst: *u8, doff: i64, src: *u8) -> i64 { var i: i64 = 0; while src[i] != (0 as u8) { dst[doff+i] = src[i]; i = i + 1 } return doff + i } 42func splitpipe(s: *u8, fld: *i64, maxf: i64) -> i64 { 43 var c: i64 = 1; fld[0] = s as i64; var i: i64 = 0 44 while s[i] != (0 as u8) { if s[i] == (124 as u8) { s[i] = 0 as u8; if c < maxf { fld[c] = (s as i64) + i + 1; c = c + 1 } } i = i + 1 } 45 return c 46} 47// grade badge (td) for kind=g cells. nc=1 -> Nishi column tint. 48func g_badge(fd: i64, v: *u8, nc: i64) -> i64 { 49 var cls: *u8 = "n" as *u8; var lab: *u8 = "No" as *u8 50 if v[0] == (66 as u8) { cls = "ex" as *u8; lab = "Best" as *u8 } // B 51 if v[0] == (89 as u8) { cls = "y" as *u8; lab = "Yes" as *u8 } // Y 52 if v[0] == (126 as u8) { cls = "p" as *u8; lab = "Part" as *u8 } // ~ 53 w(fd, "<td class='b " as *u8); if nc == 1 { w(fd, "nc " as *u8) } w(fd, cls); w(fd, "'>" as *u8); w(fd, lab); w(fd, "</td>" as *u8) 54 return 0 55} 56 57func main(argc: i64, argv: *i64) -> i64 { 58 if argc < 2 { w(1, "usage: nx_swcompare_sota <domain> [html|json]\n" as *u8); sys_exit(1); return 1 } 59 let domain: *u8 = argv[1] as *u8 60 let cap: i64 = K_MAGIC_262144 61 let buf: *u8 = sys_mmap(cap) 62 let path: *u8 = sys_mmap(512) 63 var o: i64 = scopy(path, 0, "knowledge/compare/" as *u8); o = scopy(path, o, domain); o = scopy(path, o, ".sota" as *u8); path[o] = 0 as u8 64 let n: i64 = c_read(path, buf, cap) 65 if n <= 0 { w(1, "SOTA FILE MISSING\n" as *u8); sys_exit(1); return 1 } 66 67 let MAXR: i64 = 96; let MAXF: i64 = 24 68 let cf: *i64 = sys_mmap(MAXF * 8) as *i64 // competitor column names 69 let rf: *i64 = sys_mmap(MAXR * MAXF * 8) as *i64 // per-row fields (label,kind,v0..,note) 70 let rcat: *i64 = sys_mmap(MAXR * 8) as *i64 // category name ptr per row 71 let rnf: *i64 = sys_mmap(MAXR * 8) as *i64 // field count per row 72 let fld: *i64 = sys_mmap(MAXF * 8) as *i64 73 var ncol: i64 = 0 74 var title: *u8 = "Comparison" as *u8 75 var sub: *u8 = 0 as *u8 76 var verdict: *u8 = 0 as *u8 77 var curcat: *u8 = "General" as *u8 78 var rown: i64 = 0 79 80 var p: i64 = 0 81 while p < n { 82 var e: i64 = p 83 while e < n { if buf[e] == (10 as u8) { break } e = e + 1 } 84 buf[e] = 0 as u8 85 let line: *u8 = (buf as i64 + p) as *u8 86 p = e + 1 87 if line[0] == (0 as u8) { } else { if line[0] == (35 as u8) { } else { 88 if line[0] == (64 as u8) { 89 if starts(line, "@title " as *u8) == 1 { title = (line as i64 + 7) as *u8 } else { 90 if starts(line, "@sub " as *u8) == 1 { sub = (line as i64 + 5) as *u8 } else { 91 if starts(line, "@verdict " as *u8) == 1 { verdict = (line as i64 + 9) as *u8 } else { 92 if starts(line, "@cols " as *u8) == 1 { ncol = splitpipe((line as i64 + 6) as *u8, cf, MAXF) } else { 93 if starts(line, "@cat " as *u8) == 1 { curcat = (line as i64 + 5) as *u8 } } } } } 94 } else { 95 let cnt: i64 = splitpipe(line, fld, MAXF) 96 if cnt >= (3 + ncol) { if rown < MAXR { 97 var k: i64 = 0 98 while k < cnt { rf[rown*MAXF + k] = fld[k]; k = k + 1 } 99 rnf[rown] = cnt; rcat[rown] = curcat as i64; rown = rown + 1 100 } } 101 } } } 102 } 103 104 // tally: over the GRADE axes, Nishi standing (col 0): best / behind. numeric axes counted separately. 105 var g_axes: i64 = 0; var nishi_best: i64 = 0; var nishi_no: i64 = 0; var num_axes: i64 = 0 106 var r: i64 = 0 107 while r < rown { 108 let kind: *u8 = rf[r*MAXF + 1] as *u8 109 if streq(kind, "num" as *u8) == 1 { num_axes = num_axes + 1 } else { 110 g_axes = g_axes + 1 111 let nv: *u8 = rf[r*MAXF + 2] as *u8 112 if nv[0] == (66 as u8) { nishi_best = nishi_best + 1 } 113 if nv[0] == (110 as u8) { nishi_no = nishi_no + 1 } 114 } 115 r = r + 1 116 } 117 118 var html: i64 = 0; var jsonm: i64 = 0 119 if argc >= 3 { if streq(argv[2] as *u8, "html" as *u8) == 1 { html = 1 } } 120 if argc >= 3 { if streq(argv[2] as *u8, "json" as *u8) == 1 { jsonm = 1 } } 121 122 if jsonm == 1 { 123 wc(1, 123) 124 kv_n(1, "v" as *u8, 1); wc(1, 44); kv_s(1, "api" as *u8, "nishi-compare" as *u8); wc(1, 44) 125 kv_s(1, "domain" as *u8, domain); wc(1, 44); kv_s(1, "kind" as *u8, "sota" as *u8); wc(1, 44) 126 kv_s(1, "title" as *u8, title); wc(1, 44) 127 wq(1); w(1, "columns" as *u8); wq(1); wc(1, 58); wc(1, 91) 128 var cj: i64 = 0 129 while cj < ncol { if cj > 0 { wc(1, 44) } wq(1); wj(1, cf[cj] as *u8); wq(1); cj = cj + 1 } 130 wc(1, 93); wc(1, 44) 131 wq(1); w(1, "axes" as *u8); wq(1); wc(1, 58); wc(1, 91) 132 var rj: i64 = 0 133 while rj < rown { 134 if rj > 0 { wc(1, 44) } 135 wc(1, 123) 136 kv_s(1, "category" as *u8, rcat[rj] as *u8); wc(1, 44) 137 kv_s(1, "label" as *u8, rf[rj*MAXF + 0] as *u8); wc(1, 44) 138 kv_s(1, "kind" as *u8, rf[rj*MAXF + 1] as *u8); wc(1, 44) 139 wq(1); w(1, "cells" as *u8); wq(1); wc(1, 58); wc(1, 91) 140 var ci: i64 = 0 141 while ci < ncol { if ci > 0 { wc(1, 44) } wq(1); wj(1, rf[rj*MAXF + 2 + ci] as *u8); wq(1); ci = ci + 1 } 142 wc(1, 93); wc(1, 44) 143 kv_s(1, "note" as *u8, rf[rj*MAXF + (rnf[rj]-1)] as *u8) 144 wc(1, 125) 145 rj = rj + 1 146 } 147 wc(1, 93); wc(1, 44) 148 wq(1); w(1, "summary" as *u8); wq(1); wc(1, 58); wc(1, 123) 149 kv_n(1, "competitors" as *u8, ncol - 1); wc(1, 44); kv_n(1, "axes" as *u8, rown); wc(1, 44) 150 kv_n(1, "quantitative_axes" as *u8, num_axes); wc(1, 44); kv_n(1, "nishi_best" as *u8, nishi_best); wc(1, 44); kv_n(1, "nishi_absent" as *u8, nishi_no) 151 wc(1, 125); wc(1, 44) 152 kv_n(1, "generated_unix" as *u8, sys_now_realtime_sec()); wc(1, 44) 153 kv_s(1, "measurement" as *u8, "quantitative axes = measured/published numbers (Nishi col measured, competitors researcher-sourced READMEs/blogs); grade axes B=Best Y=Yes ~=Part n=No; every axis carries a note/source. Per-domain honest verdict = the @verdict directive in each <domain>.sota; Nishi leads on sovereignty + bit-exact determinism; sub-SOTA axes are filed frontier rungs with owners (never 'by design'), deviations only as measured exceed bets." as *u8) 154 wc(1, 125); wc(1, 10) 155 sys_exit(0); return 0 156 } 157 158 if html == 1 { 159 w(1, "<" as *u8); wc(1, 33); w(1, "DOCTYPE html>\n<html lang='en'><head><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'>\n" as *u8) 160 w(1, "<title>Nishi vs the Field -- " as *u8); w(1, title); w(1, " (SOTA)</title>\n<style>\n" as *u8) 161 w(1, ":root{--bg:rgb(255,255,255);--fg:rgb(22,22,34);--ac:rgb(42,77,143);--y:rgb(26,127,55);--p:rgb(178,106,0);--n:rgb(179,38,30);--ex:rgb(130,80,223);--line:rgb(227,227,234);--soft:rgb(246,247,251);--cat:rgb(235,239,248)}\n" as *u8) 162 w(1, "*{box-sizing:border-box}body{background:var(--bg);font-family:-apple-system,Segoe UI,Roboto,sans-serif;max-width:1400px;margin:4vh auto;padding:0 16px;color:var(--fg);line-height:1.5}\n" as *u8) 163 w(1, "h1{font-size:2rem;margin:0 0 4px}.sub{color:rgb(102,102,102);font-size:1.02rem;margin:0 0 4px}.crumb{font-size:.85rem;margin-bottom:16px}a{color:var(--ac)}\n" as *u8) 164 w(1, ".meth{background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:13px 17px;margin:16px 0;font-size:.88rem;color:rgb(51,51,51)}\n" as *u8) 165 w(1, ".wrap{overflow-x:auto;border:1px solid var(--line);border-radius:12px}table{border-collapse:collapse;width:100%;font-size:.82rem;white-space:nowrap}\n" as *u8) 166 w(1, "th,td{padding:6px 9px;text-align:left;border-bottom:1px solid var(--line);border-right:1px solid var(--line)}thead th{background:var(--soft);font-weight:600;position:sticky;top:0}\n" as *u8) 167 w(1, "th.nishi,td.nc{background:rgb(238,243,255)}th.nishi{color:var(--ac)}.cat td{background:var(--cat);font-weight:700;font-size:.8rem;letter-spacing:.02em}.ax{font-weight:600}.note{color:rgb(119,119,119);font-size:.76rem;white-space:normal;min-width:220px}\n" as *u8) 168 w(1, "td.b{text-align:center;font-weight:600}td.b.y{color:var(--y)}td.b.p{color:var(--p)}td.b.n{color:var(--n)}td.b.ex{color:var(--ex)}td.num{text-align:right;font-variant-numeric:tabular-nums}td.num.nc{font-weight:700}\n" as *u8) 169 w(1, ".tally{margin:18px 0;font-size:.98rem}.badge{display:inline-block;padding:2px 9px;border-radius:20px;background:var(--soft);margin-right:6px;font-size:.85rem}.verdict{background:var(--soft);border-left:4px solid var(--ac);padding:12px 18px;border-radius:0 10px 10px 0;margin:16px 0;font-size:.92rem}.foot{margin-top:26px;color:rgb(136,136,136);font-size:.76rem;border-top:1px solid var(--line);padding-top:12px}\n" as *u8) 170 w(1, "@media(prefers-color-scheme:dark){:root{--bg:rgb(15,15,20);--fg:rgb(230,230,238);--line:rgb(38,38,47);--soft:rgb(23,23,31);--cat:rgb(28,32,44)}th.nishi,td.nc{background:rgb(20,28,48)}}\n" as *u8) 171 w(1, "</style></head><body>\n" as *u8) 172 w(1, "<p class='crumb'><a href='/'>Nishi Family</a> &rsaquo; <a href='/compare'>Compare</a> &rsaquo; " as *u8); w(1, title); w(1, " (SOTA)</p>\n" as *u8) 173 w(1, "<h1>Nishi vs the Field</h1>\n<p class='sub'>" as *u8); w(1, title); w(1, " &mdash; the full field, measured, sourced.</p>\n" as *u8) 174 if (sub as i64) != 0 { w(1, "<p class='sub' style='font-size:.9rem'>" as *u8); w(1, sub); w(1, "</p>\n" as *u8) } 175 w(1, "<div class='meth'><b>How this is scored.</b> This is a state-of-the-art comparison across the FULL competitor field: <b>quantitative</b> axes carry measured / published numbers (Nishi&rsquo;s column is our own measurement, competitors are researcher-sourced), <b>grade</b> axes use Best / Yes / Part / No. Every axis carries a source note. No single vanity &lsquo;coverage&rsquo; score &mdash; the honest picture is per-axis. Where Nishi is under SOTA, that is <b>filed work with an owner, never &lsquo;by design&rsquo;</b> (operator law: less-than-SOTA is never design) &mdash; every sub-SOTA axis maps to a frontier rung; the only legitimate divergence from the field is a <b>measured exceed bet</b> that carries its number (e.g. no-float determinism). The climb is the plan.</div>\n" as *u8) 176 w(1, "<div class='wrap'><table><thead><tr><th>Capability</th>" as *u8) 177 var hc: i64 = 0 178 while hc < ncol { if hc == 0 { w(1, "<th class='nishi'>" as *u8) } else { w(1, "<th>" as *u8) } w(1, cf[hc] as *u8); w(1, "</th>" as *u8); hc = hc + 1 } 179 w(1, "<th>Notes / source</th></tr></thead><tbody>\n" as *u8) 180 var lastcat: *u8 = 0 as *u8 181 var rr: i64 = 0 182 while rr < rown { 183 let cat: *u8 = rcat[rr] as *u8 184 if (lastcat as i64) == 0 { lastcat = "x" as *u8; w(1, "<tr class='cat'><td colspan='" as *u8); wn(1, ncol + 2); w(1, "'>" as *u8); w(1, cat); w(1, "</td></tr>\n" as *u8); lastcat = cat } 185 else { if streq(cat, lastcat) == 0 { w(1, "<tr class='cat'><td colspan='" as *u8); wn(1, ncol + 2); w(1, "'>" as *u8); w(1, cat); w(1, "</td></tr>\n" as *u8); lastcat = cat } } 186 let kind: *u8 = rf[rr*MAXF + 1] as *u8 187 let isnum: i64 = streq(kind, "num" as *u8) 188 w(1, "<tr><td class='ax'>" as *u8); w(1, rf[rr*MAXF + 0] as *u8); w(1, "</td>" as *u8) 189 var vc: i64 = 0 190 while vc < ncol { 191 let cell: *u8 = rf[rr*MAXF + 2 + vc] as *u8 192 if isnum == 1 { if vc == 0 { w(1, "<td class='num nc'>" as *u8) } else { w(1, "<td class='num'>" as *u8) } w(1, cell); w(1, "</td>" as *u8) } 193 else { if vc == 0 { g_badge(1, cell, 1) } else { g_badge(1, cell, 0) } } 194 vc = vc + 1 195 } 196 w(1, "<td class='note'>" as *u8); w(1, rf[rr*MAXF + (rnf[rr]-1)] as *u8); w(1, "</td></tr>\n" as *u8) 197 rr = rr + 1 198 } 199 w(1, "</tbody></table></div>\n" as *u8) 200 w(1, "<div class='tally'><span class='badge'>" as *u8); wn(1, ncol - 1); w(1, " competitors</span><span class='badge'>" as *u8); wn(1, rown); w(1, " axes</span><span class='badge'>" as *u8); wn(1, num_axes); w(1, " quantitative</span><span class='badge'>Nishi Best on " as *u8); wn(1, nishi_best); w(1, "</span></div>\n" as *u8) 201 if (verdict as i64) != 0 { w(1, "<div class='verdict'>" as *u8); w(1, verdict); w(1, "</div>\n" as *u8) } else { 202 w(1, "<div class='verdict'><b>Honest verdict.</b> Measured across the full field. Where Nishi is under SOTA, that is <b>filed work with an owner, never &lsquo;by design&rsquo;</b> (operator law: less-than-SOTA is never design) &mdash; every gap maps to a frontier rung, the climb is the plan (this domain-agnostic fallback shows only when a domain's .sota has no @verdict). Its genuine, unique wins are structural &mdash; the <b>whole stack is ours bits-up (own compiler, zero PyTorch / CUDA / BLAS)</b>, decode is <b>bit-exact deterministic</b>, and it has <b>trained a model without float</b> &mdash; measured exceed bets no engine in the field makes.</div>\n" as *u8) 203 } 204 w(1, "<p class='foot'>Generated by nx_swcompare_sota from knowledge/compare/" as *u8); w(1, domain); w(1, ".sota &mdash; quantitative axes measured/sourced; researcher-fed (nx_swcompare_research). Zero JS, zero trackers.</p>\n" as *u8) 205 w(1, "</body></html>\n" as *u8) 206 sys_exit(0); return 0 207 } 208 209 w(1, "=== NX-SWCOMPARE-SOTA domain=" as *u8); w(1, domain); w(1, " ===\n" as *u8) 210 w(1, " title=" as *u8); w(1, title); w(1, " competitors=" as *u8); wn(1, ncol - 1); w(1, " (+Nishi) axes=" as *u8); wn(1, rown); w(1, " quantitative=" as *u8); wn(1, num_axes); w(1, "\n" as *u8) 211 w(1, " grade-axes=" as *u8); wn(1, g_axes); w(1, " Nishi-Best=" as *u8); wn(1, nishi_best); w(1, " Nishi-No=" as *u8); wn(1, nishi_no); w(1, "\n" as *u8) 212 var liar_cols: i64 = 0 213 if ncol >= 8 { liar_cols = 1 } 214 var liar_rows: i64 = 0 215 if rown >= 20 { liar_rows = 1 } 216 var liar_num: i64 = 0 217 if num_axes >= 3 { liar_num = 1 } 218 var liar_honest: i64 = 0 219 if nishi_no >= nishi_best { liar_honest = 1 } 220 w(1, " LIAR-KILL: cols>=8=" as *u8); wn(1, liar_cols); w(1, " rows>=20=" as *u8); wn(1, liar_rows); w(1, " quantitative>=3=" as *u8); wn(1, liar_num); w(1, " honest(No>=Best)=" as *u8); wn(1, liar_honest); w(1, "\n" as *u8) 221 let ok: i64 = liar_cols & liar_rows & liar_num & liar_honest 222 w(1, "NX-SWCOMPARE-SOTA domain=" as *u8); w(1, domain); w(1, " verdict=" as *u8) 223 if ok == 1 { w(1, "MEASURED-HONEST (SOTA-scale, liar-killed)\n" as *u8); sys_exit(0); return 0 } 224 w(1, "RED (too few competitors/axes, or a dishonest all-Best Nishi)\n" as *u8); sys_exit(1); return 1 225}