Spaces:
Running
Running
SZL-Nemo core (Lane I1): governed-MoE router + MTP + self-improve + tiers; /nemo tab + /api/a11oy/v1/nemo/* (byte-identical to GitHub)
Browse files- Dockerfile +6 -0
- a11oy_nemo_core.py +887 -0
- serve.py +54 -0
- web/nemo.html +379 -0
Dockerfile
CHANGED
|
@@ -299,6 +299,12 @@ COPY web/operator.html ./web/operator.html
|
|
| 299 |
# Per-file COPY (this Dockerfile uses no COPY . .).
|
| 300 |
COPY web/fleet-c2.html ./web/fleet-c2.html
|
| 301 |
COPY web/living-anatomy.html ./web/living-anatomy.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
|
| 303 |
# ADDITIVE (Cross-Harness Receipt Bridge — Hermes + OpenClaw; 2026-06-01, Yachay /
|
| 304 |
# Perplexity Computer Agent; closeout PR superseding #198 runtime files). serve.py
|
|
|
|
| 299 |
# Per-file COPY (this Dockerfile uses no COPY . .).
|
| 300 |
COPY web/fleet-c2.html ./web/fleet-c2.html
|
| 301 |
COPY web/living-anatomy.html ./web/living-anatomy.html
|
| 302 |
+
# ADDITIVE (Lane I1, 2026-06-14): SZL-Nemo core module + tab. Per-file COPY (this
|
| 303 |
+
# Dockerfile uses no COPY . .). a11oy_nemo_core.py is imported by serve.py
|
| 304 |
+
# (try/except guarded); web/nemo.html is served at /nemo + /a11oy/nemo via
|
| 305 |
+
# _ptg_serve. Without these COPYs the guarded import falls back and /nemo 404s.
|
| 306 |
+
COPY a11oy_nemo_core.py ./
|
| 307 |
+
COPY web/nemo.html ./web/nemo.html
|
| 308 |
|
| 309 |
# ADDITIVE (Cross-Harness Receipt Bridge — Hermes + OpenClaw; 2026-06-01, Yachay /
|
| 310 |
# Perplexity Computer Agent; closeout PR superseding #198 runtime files). serve.py
|
a11oy_nemo_core.py
ADDED
|
@@ -0,0 +1,887 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
a11oy_nemo_core.py — SZL-NEMO CORE (Lane I1).
|
| 3 |
+
|
| 4 |
+
SZL-Nemo is OUR sovereign, governed, self-improving agent model — delivered here
|
| 5 |
+
as a LIVE SKELETON + architecture on a11oy. The HONEST framing, repeated in every
|
| 6 |
+
payload and on the tab, is:
|
| 7 |
+
|
| 8 |
+
"SZL-Nemo — built on an OPEN base (e.g. Qwen3-32B Apache-2.0 / GLM MIT),
|
| 9 |
+
governed & sovereign."
|
| 10 |
+
|
| 11 |
+
NEVER claim: from-scratch training, 550B parameters, local Nemotron-Ultra, or a
|
| 12 |
+
certification. We did NOT train a foundation model. OUR contribution is the
|
| 13 |
+
governance layer that wraps an open base:
|
| 14 |
+
|
| 15 |
+
1. GOVERNED-MoE DOMAIN-EXPERT ROUTER (the differentiator). "Experts" are DOMAIN
|
| 16 |
+
HEADS (counter-uas / maritime / governance / code / finance), not learned MoE
|
| 17 |
+
experts. A query is routed to expert(s) by a Λ-governed (Conjecture 1, advisory
|
| 18 |
+
floor < 1.0) router that REUSES:
|
| 19 |
+
- Dev E's active-flux router crossover (a11oy_active_flux_router) — the
|
| 20 |
+
deterministic PI-bandwidth crossover law, generalized to model routing, and
|
| 21 |
+
- Dev C's RouteLLM Thompson posteriors (szl_energy_sovereign) — the Bayesian
|
| 22 |
+
bandit complement.
|
| 23 |
+
EVERY expert selection emits a SIGNED DSSE receipt (the host's REAL in-image
|
| 24 |
+
ECDSA-P256 signer, passed in via register(); verified vs /cosign.pub). This is
|
| 25 |
+
an AUDITABLE MoE.
|
| 26 |
+
|
| 27 |
+
2. MTP / SPECULATIVE DECODING as the SZL-Nemo inference DEFAULT (app-layer view;
|
| 28 |
+
reuses Dev C's draft-model wiring + speculative-decode acceptance math). The
|
| 29 |
+
actual on-box config is ROADMAP → Forge (founder-gated 2 GPUs).
|
| 30 |
+
|
| 31 |
+
3. SELF-IMPROVEMENT loop. Wires Dev A's Reflexion + Voyager skill admission and
|
| 32 |
+
Dev B's τ-bench (szl_tau_eval) so SZL-Nemo MEASURABLY improves on OUR bench and
|
| 33 |
+
SIGNS the delta. Score history + reflections are stored INSIDE signed receipts.
|
| 34 |
+
|
| 35 |
+
4. TIERS. Registers {sovereign-local (2-GPU, per NEMOTRON_TWO_GPU_PLAN),
|
| 36 |
+
cloud-NIM-frontier (Nemotron Ultra)} in the gateway view with HONEST
|
| 37 |
+
where/sovereign labels. sovereign:true ONLY when a live per-GPU gpu_reachable
|
| 38 |
+
probe (Dev C szl_energy_sovereign._sovereign_state) says so; the cloud tier is
|
| 39 |
+
ALWAYS sovereign:false.
|
| 40 |
+
|
| 41 |
+
5. Endpoints /api/{ns}/v1/nemo/{route,experts,infer,selfimprove,card,tiers} + a
|
| 42 |
+
live "SZL-Nemo" tab (web/nemo.html).
|
| 43 |
+
|
| 44 |
+
Doctrine v11 (hard): locked = EXACTLY 8 @ c7c0ba17; Λ = Conjecture 1 (advisory floor
|
| 45 |
+
< 1.0, NOT a pass/fail oracle); trust < 100%; SLSA L1/L2/L3-roadmap; 0 runtime CDN;
|
| 46 |
+
0 visible codenames; tamper-evident signed receipts; never fabricate a metric
|
| 47 |
+
(MEASURED or ROADMAP); never commit a key. Effectors SIMULATED human-on-loop.
|
| 48 |
+
|
| 49 |
+
This module is ADDITIVE and try/except guarded everywhere — it never crashes the app.
|
| 50 |
+
The signer is the host's REAL in-image signer (sign_fn); we NEVER fabricate a
|
| 51 |
+
signature. All numbers are derived deterministically from the reused engines or
|
| 52 |
+
labelled ROADMAP / not_measured.
|
| 53 |
+
|
| 54 |
+
Signed-off-by: Integration Dev I1 <i1@szl-holdings>
|
| 55 |
+
Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
|
| 56 |
+
"""
|
| 57 |
+
from __future__ import annotations
|
| 58 |
+
|
| 59 |
+
import hashlib
|
| 60 |
+
import json
|
| 61 |
+
import math
|
| 62 |
+
import os
|
| 63 |
+
import threading
|
| 64 |
+
import time
|
| 65 |
+
from datetime import datetime, timezone
|
| 66 |
+
|
| 67 |
+
# ---------------------------------------------------------------------------
|
| 68 |
+
# Honest constants. The base is OPEN WEIGHTS, cited. OUR contribution is the
|
| 69 |
+
# governance/routing/self-improvement layer — NOT a from-scratch foundation model.
|
| 70 |
+
# ---------------------------------------------------------------------------
|
| 71 |
+
NEMO_NAME = "SZL-Nemo"
|
| 72 |
+
NEMO_VERSION = "0.1.0-skeleton"
|
| 73 |
+
|
| 74 |
+
# The honest base options (open weights, cited). We pick Qwen3-32B (Apache-2.0) as
|
| 75 |
+
# the DEFAULT sovereign-local base because it fits the 2-GPU plan (TP=2). GLM (MIT)
|
| 76 |
+
# is offered as an alternative. NEVER imply from-scratch / 550B.
|
| 77 |
+
NEMO_BASE = {
|
| 78 |
+
"default_base": "Qwen3-32B",
|
| 79 |
+
"default_base_license": "Apache-2.0",
|
| 80 |
+
"default_base_url": "https://huggingface.co/Qwen/Qwen3-32B",
|
| 81 |
+
"alternatives": [
|
| 82 |
+
{"name": "GLM-4 (GLM family)", "license": "MIT",
|
| 83 |
+
"url": "https://huggingface.co/THUDM"},
|
| 84 |
+
{"name": "Qwen2.5-Coder-32B-Instruct", "license": "Apache-2.0",
|
| 85 |
+
"url": "https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct"},
|
| 86 |
+
],
|
| 87 |
+
"honest_framing": (
|
| 88 |
+
"SZL-Nemo is built ON an OPEN base (default Qwen3-32B, Apache-2.0). We did "
|
| 89 |
+
"NOT train a foundation model from scratch; there is NO 550B SZL model and "
|
| 90 |
+
"no local Nemotron-Ultra. OUR contribution is the governed-MoE domain-expert "
|
| 91 |
+
"router + MTP/speculative-decode default + Reflexion/Voyager self-improvement "
|
| 92 |
+
"+ signed-every-step receipts + Λ governance. Honest always."),
|
| 93 |
+
"never_claim": ["from-scratch training", "550B parameters", "local Nemotron-Ultra",
|
| 94 |
+
"any certification (FedRAMP/IronBank/CMMC/ATO)"],
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
# DOMAIN-EXPERT HEADS — "experts" in OUR auditable MoE are domain heads, not learned
|
| 98 |
+
# MoE FFN experts. This is stated honestly everywhere.
|
| 99 |
+
NEMO_EXPERTS = [
|
| 100 |
+
{"id": "counter-uas", "title": "Counter-UAS",
|
| 101 |
+
"keywords": ["drone", "uas", "uav", "interceptor", "swarm", "rf", "jammer",
|
| 102 |
+
"threat", "track", "intercept", "radar", "ads-b", "engage"],
|
| 103 |
+
"difficulty_bias": 0.62,
|
| 104 |
+
"desc": "Counter-unmanned-aerial-systems threat reasoning (SIMULATED effectors, human-on-loop)."},
|
| 105 |
+
{"id": "maritime", "title": "Maritime",
|
| 106 |
+
"keywords": ["ship", "vessel", "ais", "maritime", "port", "naval", "sea",
|
| 107 |
+
"fleet", "marine", "harbor", "coast"],
|
| 108 |
+
"difficulty_bias": 0.55,
|
| 109 |
+
"desc": "Maritime-domain awareness / AIS anomaly reasoning (MODELED)."},
|
| 110 |
+
{"id": "governance", "title": "Governance",
|
| 111 |
+
"keywords": ["policy", "compliance", "governance", "audit", "lambda", "λ",
|
| 112 |
+
"receipt", "oscal", "nist", "iso", "roe", "gate", "calibration",
|
| 113 |
+
"conformal", "doctrine", "risk"],
|
| 114 |
+
"difficulty_bias": 0.70,
|
| 115 |
+
"desc": "Governance / compliance / Λ-gate / receipt reasoning."},
|
| 116 |
+
{"id": "code", "title": "Code",
|
| 117 |
+
"keywords": ["code", "python", "function", "bug", "refactor", "compile",
|
| 118 |
+
"test", "api", "endpoint", "git", "build", "lint", "implement"],
|
| 119 |
+
"difficulty_bias": 0.50,
|
| 120 |
+
"desc": "Software / code-orchestration reasoning."},
|
| 121 |
+
{"id": "finance", "title": "Finance",
|
| 122 |
+
"keywords": ["finance", "portfolio", "risk", "kelly", "volatility", "market",
|
| 123 |
+
"price", "covariance", "quant", "ledoit", "tda", "hedge", "alpha"],
|
| 124 |
+
"difficulty_bias": 0.66,
|
| 125 |
+
"desc": "Finance / quant reasoning (SAMPLE / NO_BACKTEST_VALIDATED — never live trading)."},
|
| 126 |
+
]
|
| 127 |
+
_EXPERT_BY_ID = {e["id"]: e for e in NEMO_EXPERTS}
|
| 128 |
+
|
| 129 |
+
# Λ axes (Conjecture 1 advisory). We compute Λ as the geometric mean of per-axis
|
| 130 |
+
# scores, matching szl_brain.lambda_aggregate. Floor < 1.0 always (trust < 100%).
|
| 131 |
+
_LAMBDA_FLOOR = 0.90 # the high-trust floor from szl_brain.pick_tier (advisory)
|
| 132 |
+
|
| 133 |
+
DOCTRINE = {
|
| 134 |
+
"locked": "EXACTLY 8 @ c7c0ba17",
|
| 135 |
+
"lambda": "Conjecture 1 (advisory floor < 1.0; NOT a pass/fail oracle)",
|
| 136 |
+
"trust": "< 100% (coverage reported as a conformal target, never 100%)",
|
| 137 |
+
"slsa": "L1 honest / L2 attested / L3 roadmap",
|
| 138 |
+
"cdn": "0 runtime CDN",
|
| 139 |
+
"codenames": "0 visible",
|
| 140 |
+
"effectors": "SIMULATED human-on-loop",
|
| 141 |
+
"never": NEMO_BASE["never_claim"],
|
| 142 |
+
"metric_rule": "every number is MEASURED (live) or ROADMAP / not_measured — never fabricated",
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
# MTP / speculative-decoding default config (app-layer view; box config is ROADMAP).
|
| 146 |
+
# Speedup S = (k+1) / (k(1-α) + 1) for k draft tokens and acceptance rate α
|
| 147 |
+
# (Leviathan et al. 2022 / Dev C #2). We mark the acceptance rate ILLUSTRATIVE
|
| 148 |
+
# until the box emits real accept/draft counters → then it flips to MEASURED.
|
| 149 |
+
MTP_DEFAULT = {
|
| 150 |
+
"enabled_default": True,
|
| 151 |
+
"draft_model": "Qwen2.5-Coder-1.5B-Instruct",
|
| 152 |
+
"target_model": "Qwen3-32B (open base)",
|
| 153 |
+
"num_speculative_tokens_k": 4,
|
| 154 |
+
"acceptance_rate_alpha": 0.8, # ILLUSTRATIVE until box emits accept/draft counters
|
| 155 |
+
"label_when_unmeasured": "ROADMAP",
|
| 156 |
+
"source": "speculative decoding (Leviathan et al. arXiv:2211.17192) + Dev C draft-model wiring",
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
_LOCK = threading.RLock()
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
# ---------------------------------------------------------------------------
|
| 163 |
+
# Reused engines — imported lazily & guarded. We NEVER reimplement; if a reuse
|
| 164 |
+
# target is missing we degrade honestly (label ROADMAP / fallback), never fake.
|
| 165 |
+
# ---------------------------------------------------------------------------
|
| 166 |
+
def _try_import(name):
|
| 167 |
+
try:
|
| 168 |
+
return __import__(name)
|
| 169 |
+
except Exception:
|
| 170 |
+
return None
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def _af_router():
|
| 174 |
+
"""Dev E active-flux router crossover (deterministic routing law)."""
|
| 175 |
+
return _try_import("a11oy_active_flux_router")
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
def _cuas():
|
| 179 |
+
"""Dev E shared active-flux blend (szl_cuas_formulas.active_flux_blend)."""
|
| 180 |
+
return _try_import("szl_cuas_formulas")
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def _energy():
|
| 184 |
+
"""Dev C energy/sovereign module — sovereign probe + RouteLLM Thompson posteriors."""
|
| 185 |
+
return _try_import("szl_energy_sovereign")
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def _brain():
|
| 189 |
+
"""szl_brain — Λ aggregate + tier catalog."""
|
| 190 |
+
return _try_import("szl_brain")
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def _tau():
|
| 194 |
+
"""Dev B τ-bench eval (szl_tau_eval)."""
|
| 195 |
+
return _try_import("szl_tau_eval")
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
# ---------------------------------------------------------------------------
|
| 199 |
+
# Λ governance — geometric-mean aggregate, matching szl_brain.lambda_aggregate.
|
| 200 |
+
# ---------------------------------------------------------------------------
|
| 201 |
+
def _lambda_aggregate(axis):
|
| 202 |
+
b = _brain()
|
| 203 |
+
if b is not None and hasattr(b, "lambda_aggregate"):
|
| 204 |
+
try:
|
| 205 |
+
return float(b.lambda_aggregate(axis))
|
| 206 |
+
except Exception:
|
| 207 |
+
pass
|
| 208 |
+
if not axis:
|
| 209 |
+
return 0.5
|
| 210 |
+
clamped = [min(1.0, max(1e-9, float(x))) for x in axis]
|
| 211 |
+
logmean = sum(math.log(x) for x in clamped) / len(clamped)
|
| 212 |
+
return math.exp(logmean)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def _query_difficulty(query: str, expert_id: str | None = None):
|
| 216 |
+
"""Deterministic difficulty proxy d∈[0,1] from query length + governance/risk
|
| 217 |
+
keyword density + expert bias. HEURISTIC (labelled) — there is no learned
|
| 218 |
+
difficulty model in-image; the production target routes through the a11oy
|
| 219 |
+
inference path. Never fabricated: it is a transparent, reproducible function."""
|
| 220 |
+
q = (query or "").lower()
|
| 221 |
+
n_tokens = len([t for t in q.split() if t])
|
| 222 |
+
length_term = min(1.0, n_tokens / 40.0)
|
| 223 |
+
hard_markers = ["prove", "derive", "why", "design", "trade-off", "tradeoff",
|
| 224 |
+
"optimi", "adversar", "exploit", "multi-step", "orchestrat",
|
| 225 |
+
"diligence", "formal", "guarantee", "calibrat"]
|
| 226 |
+
hard_hits = sum(1 for m in hard_markers if m in q)
|
| 227 |
+
marker_term = min(1.0, hard_hits / 4.0)
|
| 228 |
+
bias = _EXPERT_BY_ID.get(expert_id or "", {}).get("difficulty_bias", 0.5)
|
| 229 |
+
d = 0.45 * length_term + 0.30 * marker_term + 0.25 * bias
|
| 230 |
+
return round(min(1.0, max(0.0, d)), 6)
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
def _expert_axis_scores(query: str, expert: dict):
|
| 234 |
+
"""Per-axis Λ scores for a (query, expert) pairing. Higher = more trustworthy/
|
| 235 |
+
in-domain. Deterministic & transparent. Axes: domain_fit, governance_coverage,
|
| 236 |
+
calibration_floor. trust < 100% — we cap each axis at 0.98."""
|
| 237 |
+
q = (query or "").lower()
|
| 238 |
+
kw = expert.get("keywords", [])
|
| 239 |
+
hits = sum(1 for k in kw if k in q)
|
| 240 |
+
domain_fit = min(0.98, 0.55 + 0.12 * hits) # in-domain → higher Λ
|
| 241 |
+
governance_coverage = 0.90 if expert["id"] == "governance" else 0.82
|
| 242 |
+
calibration_floor = 0.88 # Dev B ECE<0.05 gate proxy
|
| 243 |
+
return [round(domain_fit, 4), round(governance_coverage, 4), round(calibration_floor, 4)]
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
# ---------------------------------------------------------------------------
|
| 247 |
+
# GOVERNED-MoE DOMAIN-EXPERT ROUTER (the differentiator).
|
| 248 |
+
# ---------------------------------------------------------------------------
|
| 249 |
+
def _select_experts(query: str, top_k: int = 2):
|
| 250 |
+
"""Score each domain head against the query (keyword overlap → score), rank,
|
| 251 |
+
and select the top_k as the active experts. Deterministic, transparent."""
|
| 252 |
+
q = (query or "").lower()
|
| 253 |
+
scored = []
|
| 254 |
+
for e in NEMO_EXPERTS:
|
| 255 |
+
hits = [k for k in e["keywords"] if k in q]
|
| 256 |
+
score = len(hits) + (0.01 * len(q)) # tiny length tiebreak; deterministic
|
| 257 |
+
scored.append({"expert": e, "score": score, "matched": hits})
|
| 258 |
+
scored.sort(key=lambda r: (-r["score"], r["expert"]["id"]))
|
| 259 |
+
chosen = scored[:max(1, top_k)]
|
| 260 |
+
return scored, chosen
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
def _crossover_for(query: str, expert_id: str, pi_bandwidth_hz: float = 12.0):
|
| 264 |
+
"""REUSE Dev E's active-flux router crossover to decide small/local vs large/cloud
|
| 265 |
+
serving for this (query, expert). Falls back to the shared blend, then to a
|
| 266 |
+
local complementary-filter computation if neither is importable (honest)."""
|
| 267 |
+
difficulty = _query_difficulty(query, expert_id)
|
| 268 |
+
afr = _af_router()
|
| 269 |
+
if afr is not None and hasattr(afr, "router_crossover"):
|
| 270 |
+
try:
|
| 271 |
+
out = afr.router_crossover(query_difficulty=difficulty,
|
| 272 |
+
pi_bandwidth_hz=pi_bandwidth_hz,
|
| 273 |
+
brain=_brain())
|
| 274 |
+
out["reuse"] = "a11oy_active_flux_router.router_crossover (Dev E)"
|
| 275 |
+
out["query_difficulty"] = difficulty
|
| 276 |
+
return out
|
| 277 |
+
except Exception:
|
| 278 |
+
pass
|
| 279 |
+
# fallback to the shared blend law (Dev E szl_cuas_formulas.active_flux_blend)
|
| 280 |
+
cu = _cuas()
|
| 281 |
+
span = 60.0
|
| 282 |
+
f_e = difficulty * span
|
| 283 |
+
if cu is not None and hasattr(cu, "active_flux_blend"):
|
| 284 |
+
try:
|
| 285 |
+
b = cu.active_flux_blend(pi_bandwidth_hz, f_e)
|
| 286 |
+
w_small = b["current_model_weight"]
|
| 287 |
+
w_large = b["voltage_model_weight"]
|
| 288 |
+
route = "small/local" if w_small >= w_large else "large/cloud"
|
| 289 |
+
return {"route": route, "regime": "easy" if route == "small/local" else "hard",
|
| 290 |
+
"weight_small_local": round(w_small, 6),
|
| 291 |
+
"weight_large_cloud": round(w_large, 6),
|
| 292 |
+
"crossover_hz": b["crossover_hz"], "query_difficulty": difficulty,
|
| 293 |
+
"reuse": "szl_cuas_formulas.active_flux_blend (Dev E shared law)",
|
| 294 |
+
"pi_bandwidth_hz": pi_bandwidth_hz, "label": "MODELED"}
|
| 295 |
+
except Exception:
|
| 296 |
+
pass
|
| 297 |
+
# last-resort local complementary filter (identical math, honest)
|
| 298 |
+
f_x = 150.0 / max(pi_bandwidth_hz, 1e-6)
|
| 299 |
+
w_x = 2.0 * math.pi * f_x
|
| 300 |
+
w_e = 2.0 * math.pi * max(f_e, 0.0)
|
| 301 |
+
denom = math.sqrt(w_x * w_x + w_e * w_e) or 1e-12
|
| 302 |
+
w_small = w_x / denom
|
| 303 |
+
w_large = w_e / denom
|
| 304 |
+
route = "small/local" if w_small >= w_large else "large/cloud"
|
| 305 |
+
return {"route": route, "regime": "easy" if route == "small/local" else "hard",
|
| 306 |
+
"weight_small_local": round(w_small, 6), "weight_large_cloud": round(w_large, 6),
|
| 307 |
+
"crossover_hz": round(f_x, 4), "query_difficulty": difficulty,
|
| 308 |
+
"reuse": "local complementary-filter fallback (Dev E law reproduced)",
|
| 309 |
+
"pi_bandwidth_hz": pi_bandwidth_hz, "label": "MODELED"}
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
def _thompson_view():
|
| 313 |
+
"""REUSE Dev C's RouteLLM Thompson Beta posteriors (szl_energy_sovereign)."""
|
| 314 |
+
en = _energy()
|
| 315 |
+
if en is not None and hasattr(en, "_router_panel"):
|
| 316 |
+
try:
|
| 317 |
+
p = en._router_panel()
|
| 318 |
+
p["reuse"] = "szl_energy_sovereign._router_panel (Dev C RouteLLM Thompson)"
|
| 319 |
+
return p
|
| 320 |
+
except Exception:
|
| 321 |
+
pass
|
| 322 |
+
return {"metric": "routellm_thompson", "label": "ROADMAP",
|
| 323 |
+
"reuse": "szl_energy_sovereign unavailable in-process; honest ROADMAP",
|
| 324 |
+
"models": [], "total_observations": 0}
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
def govern_route(query: str, top_k: int = 2, pi_bandwidth_hz: float = 12.0,
|
| 328 |
+
sign_fn=None):
|
| 329 |
+
"""The GOVERNED-MoE routing decision. Returns the active domain experts, each
|
| 330 |
+
with its Λ score (Conjecture 1 advisory), its active-flux serving crossover
|
| 331 |
+
(Dev E reuse), the RouteLLM Thompson posterior view (Dev C reuse), AND a SIGNED
|
| 332 |
+
DSSE receipt over the whole decision (host signer). Auditable MoE."""
|
| 333 |
+
scored, chosen = _select_experts(query, top_k)
|
| 334 |
+
experts_out = []
|
| 335 |
+
lambdas = []
|
| 336 |
+
for c in chosen:
|
| 337 |
+
e = c["expert"]
|
| 338 |
+
axis = _expert_axis_scores(query, e)
|
| 339 |
+
lam = round(_lambda_aggregate(axis), 6)
|
| 340 |
+
lambdas.append(lam)
|
| 341 |
+
cross = _crossover_for(query, e["id"], pi_bandwidth_hz)
|
| 342 |
+
# Λ governance: advisory floor. Below floor → flag extra gates (route to the
|
| 343 |
+
# large/cloud tier + human-on-loop), per szl_brain trust→tier policy. We
|
| 344 |
+
# NEVER hard-block on Λ (it is advisory), but we surface the recommendation.
|
| 345 |
+
below_floor = lam < _LAMBDA_FLOOR
|
| 346 |
+
experts_out.append({
|
| 347 |
+
"expert_id": e["id"], "title": e["title"], "desc": e["desc"],
|
| 348 |
+
"matched_keywords": c["matched"], "selection_score": round(c["score"], 4),
|
| 349 |
+
"lambda_advisory": lam, "lambda_axes": axis,
|
| 350 |
+
"lambda_status": DOCTRINE["lambda"],
|
| 351 |
+
"below_advisory_floor": below_floor,
|
| 352 |
+
"governance_note": ("Λ below advisory floor %.2f → recommend large/cloud "
|
| 353 |
+
"tier + human-on-loop review (advisory, not a block)."
|
| 354 |
+
% _LAMBDA_FLOOR) if below_floor else
|
| 355 |
+
("Λ at/above advisory floor %.2f → expert cleared "
|
| 356 |
+
"(advisory)." % _LAMBDA_FLOOR),
|
| 357 |
+
"serving_crossover": cross,
|
| 358 |
+
})
|
| 359 |
+
overall_lambda = round(_lambda_aggregate(lambdas) if lambdas else 0.5, 6)
|
| 360 |
+
decision = {
|
| 361 |
+
"schema": "szl.nemo.governed_route/v1",
|
| 362 |
+
"model": NEMO_NAME, "model_version": NEMO_VERSION,
|
| 363 |
+
"base": NEMO_BASE["default_base"], "base_license": NEMO_BASE["default_base_license"],
|
| 364 |
+
"honest_framing": NEMO_BASE["honest_framing"],
|
| 365 |
+
"query": query,
|
| 366 |
+
"moe_kind": ("AUDITABLE domain-expert MoE — 'experts' are DOMAIN HEADS "
|
| 367 |
+
"(not learned FFN experts); every selection is a signed receipt."),
|
| 368 |
+
"experts_selected": [e["expert_id"] for e in experts_out],
|
| 369 |
+
"experts": experts_out,
|
| 370 |
+
"all_expert_scores": [{"expert_id": s["expert"]["id"],
|
| 371 |
+
"score": round(s["score"], 4),
|
| 372 |
+
"matched": s["matched"]} for s in scored],
|
| 373 |
+
"overall_lambda_advisory": overall_lambda,
|
| 374 |
+
"thompson_posteriors": _thompson_view(),
|
| 375 |
+
"doctrine": DOCTRINE,
|
| 376 |
+
"ts_utc": datetime.now(timezone.utc).isoformat(),
|
| 377 |
+
}
|
| 378 |
+
# Attach energy fields (Dev C) honestly — joules MEASURED only if box emits.
|
| 379 |
+
en = _energy()
|
| 380 |
+
if en is not None and hasattr(en, "energy_fields_for_receipt"):
|
| 381 |
+
try:
|
| 382 |
+
decision["energy"] = en.energy_fields_for_receipt()
|
| 383 |
+
except Exception:
|
| 384 |
+
pass
|
| 385 |
+
# SIGN the decision (host REAL signer). Honest UNSIGNED marker if key missing.
|
| 386 |
+
receipt = _sign(decision, sign_fn)
|
| 387 |
+
decision["receipt"] = receipt
|
| 388 |
+
return decision
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
# ---------------------------------------------------------------------------
|
| 392 |
+
# Signing — host's REAL in-image signer. We NEVER fabricate a signature.
|
| 393 |
+
# ---------------------------------------------------------------------------
|
| 394 |
+
def _sign(payload_obj, sign_fn):
|
| 395 |
+
if sign_fn is None:
|
| 396 |
+
return {"signed": False,
|
| 397 |
+
"honesty": "UNSIGNED — no host signer passed to register(); "
|
| 398 |
+
"no signature fabricated."}
|
| 399 |
+
try:
|
| 400 |
+
env = sign_fn(payload_obj)
|
| 401 |
+
if isinstance(env, dict):
|
| 402 |
+
return env
|
| 403 |
+
return {"signed": False, "honesty": "host signer returned non-dict; not fabricated"}
|
| 404 |
+
except Exception as e:
|
| 405 |
+
return {"signed": False,
|
| 406 |
+
"honesty": "host signer raised (%s); no signature fabricated"
|
| 407 |
+
% type(e).__name__}
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
# ---------------------------------------------------------------------------
|
| 411 |
+
# MTP / speculative-decoding default view (app-layer; box config ROADMAP→Forge).
|
| 412 |
+
# ---------------------------------------------------------------------------
|
| 413 |
+
def mtp_view():
|
| 414 |
+
k = MTP_DEFAULT["num_speculative_tokens_k"]
|
| 415 |
+
alpha = MTP_DEFAULT["acceptance_rate_alpha"]
|
| 416 |
+
# speedup S = (k+1)/(k(1-α)+1) — Leviathan et al.
|
| 417 |
+
speedup = (k + 1) / (k * (1 - alpha) + 1)
|
| 418 |
+
# Is the box emitting real accept/draft counters? Ask Dev C's energy module.
|
| 419 |
+
measured = False
|
| 420 |
+
en = _energy()
|
| 421 |
+
note = ("Acceptance rate α is ILLUSTRATIVE (0.8) until the box emits real "
|
| 422 |
+
"accept/draft counters via vLLM --speculative-model (FORGE). Then α and "
|
| 423 |
+
"the speedup flip to MEASURED. The speedup formula itself is exact.")
|
| 424 |
+
if en is not None and hasattr(en, "_throughput_panel"):
|
| 425 |
+
try:
|
| 426 |
+
# the throughput panel is MEASURED only when gpu_reachable + counters present
|
| 427 |
+
state = en._sovereign_state() if hasattr(en, "_sovereign_state") else {}
|
| 428 |
+
gpu = en._gpu_reachable(state) if hasattr(en, "_gpu_reachable") else False
|
| 429 |
+
prom = en._read_prom_metrics() if hasattr(en, "_read_prom_metrics") else {}
|
| 430 |
+
panel = en._throughput_panel(prom, gpu)
|
| 431 |
+
measured = bool(panel.get("label") == "MEASURED")
|
| 432 |
+
if measured:
|
| 433 |
+
note = "Live accept/draft counters present (Dev C throughput panel MEASURED)."
|
| 434 |
+
except Exception:
|
| 435 |
+
pass
|
| 436 |
+
return {
|
| 437 |
+
"feature": "MTP / speculative decoding (SZL-Nemo inference default)",
|
| 438 |
+
"enabled_default": MTP_DEFAULT["enabled_default"],
|
| 439 |
+
"draft_model": MTP_DEFAULT["draft_model"],
|
| 440 |
+
"target_model": MTP_DEFAULT["target_model"],
|
| 441 |
+
"num_speculative_tokens_k": k,
|
| 442 |
+
"acceptance_rate_alpha": alpha,
|
| 443 |
+
"speedup_formula": "S = (k+1) / (k(1-alpha)+1)",
|
| 444 |
+
"speedup_estimate": round(speedup, 4),
|
| 445 |
+
"label": "MEASURED" if measured else MTP_DEFAULT["label_when_unmeasured"],
|
| 446 |
+
"honesty": note,
|
| 447 |
+
"reuse": "szl_energy_sovereign throughput panel (Dev C draft-model wiring)",
|
| 448 |
+
"source": MTP_DEFAULT["source"],
|
| 449 |
+
"box_status": "ROADMAP → Forge (founder-gated 2 GPUs; see FORGE_SZL_NEMO.md)",
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
|
| 453 |
+
# ---------------------------------------------------------------------------
|
| 454 |
+
# INFER (skeleton) — a governed inference turn: route → pick serving tier → MTP
|
| 455 |
+
# default → SIGNED receipt. App-layer skeleton: it does NOT run the open base
|
| 456 |
+
# in-image (that is the sovereign-local box / cloud-NIM tier, ROADMAP/cloud). It
|
| 457 |
+
# returns the GOVERNED PLAN + signed receipt, honestly labelled SKELETON.
|
| 458 |
+
# ---------------------------------------------------------------------------
|
| 459 |
+
def infer(query: str, top_k: int = 2, sign_fn=None):
|
| 460 |
+
route = govern_route(query, top_k=top_k, sign_fn=None) # inner decision (re-signed below)
|
| 461 |
+
primary = route["experts"][0] if route["experts"] else None
|
| 462 |
+
serving = (primary or {}).get("serving_crossover", {})
|
| 463 |
+
tier_choice = serving.get("route", "small/local")
|
| 464 |
+
plan = {
|
| 465 |
+
"schema": "szl.nemo.infer_plan/v1",
|
| 466 |
+
"model": NEMO_NAME, "base": NEMO_BASE["default_base"],
|
| 467 |
+
"honest_framing": NEMO_BASE["honest_framing"],
|
| 468 |
+
"query": query,
|
| 469 |
+
"routed_experts": route["experts_selected"],
|
| 470 |
+
"primary_expert": (primary or {}).get("expert_id"),
|
| 471 |
+
"serving_tier": tier_choice,
|
| 472 |
+
"serving_where": "sovereign-local (2-GPU)" if tier_choice == "small/local"
|
| 473 |
+
else "cloud-NIM-frontier (Nemotron Ultra)",
|
| 474 |
+
"mtp": mtp_view(),
|
| 475 |
+
"overall_lambda_advisory": route["overall_lambda_advisory"],
|
| 476 |
+
"skeleton_note": (
|
| 477 |
+
"SKELETON — this returns the GOVERNED INFERENCE PLAN + a signed receipt. "
|
| 478 |
+
"SZL-Nemo does NOT run the open base in-image; generation happens on the "
|
| 479 |
+
"sovereign-local 2-GPU tier (ROADMAP→Forge) or the cloud-NIM tier. No "
|
| 480 |
+
"model output is fabricated."),
|
| 481 |
+
"tiers": tiers_view(),
|
| 482 |
+
"ts_utc": datetime.now(timezone.utc).isoformat(),
|
| 483 |
+
}
|
| 484 |
+
plan["receipt"] = _sign(plan, sign_fn)
|
| 485 |
+
return plan
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
# ---------------------------------------------------------------------------
|
| 489 |
+
# TIERS — {sovereign-local 2-GPU, cloud-NIM-frontier}. HONEST where/sovereign.
|
| 490 |
+
# sovereign:true ONLY from the live gpu_reachable probe (Dev C). cloud = false.
|
| 491 |
+
# ---------------------------------------------------------------------------
|
| 492 |
+
def tiers_view():
|
| 493 |
+
en = _energy()
|
| 494 |
+
sovereign = False
|
| 495 |
+
base_url = None
|
| 496 |
+
probe_note = "szl_energy_sovereign unavailable in-process; honest default not-sovereign."
|
| 497 |
+
if en is not None and hasattr(en, "_sovereign_state"):
|
| 498 |
+
try:
|
| 499 |
+
st = en._sovereign_state()
|
| 500 |
+
sovereign = bool(en._gpu_reachable(st)) if hasattr(en, "_gpu_reachable") else False
|
| 501 |
+
base_url = st.get("base_url")
|
| 502 |
+
probe_note = st.get("honest_note") or (
|
| 503 |
+
"live gpu_reachable probe: sovereign=%s" % sovereign)
|
| 504 |
+
except Exception as e:
|
| 505 |
+
probe_note = "probe error (%s); honest default not-sovereign." % type(e).__name__
|
| 506 |
+
local_tier = {
|
| 507 |
+
"tier_id": "sovereign-local",
|
| 508 |
+
"title": "Sovereign-Local (2-GPU)",
|
| 509 |
+
"where": "gpu",
|
| 510 |
+
"sovereign": sovereign, # TRUE only with a live per-GPU gpu_reachable probe
|
| 511 |
+
"gpu_reachable": sovereign,
|
| 512 |
+
"base_model": NEMO_BASE["default_base"] + " (open base, " +
|
| 513 |
+
NEMO_BASE["default_base_license"] + ")",
|
| 514 |
+
"plan": ("2 GPUs (a11oy.net GPU + RTX 4000): vLLM TP=2 OR heterogeneous "
|
| 515 |
+
"role-split (RTX 4000 = Auto-Review classifier + speculative draft + "
|
| 516 |
+
"embeddings). Per NEMOTRON_TWO_GPU_PLAN.md."),
|
| 517 |
+
"base_url": base_url,
|
| 518 |
+
"probe_note": probe_note,
|
| 519 |
+
"label": "MEASURED" if sovereign else "ROADMAP",
|
| 520 |
+
"honesty": ("sovereign:true ONLY when the live per-GPU gpu_reachable probe "
|
| 521 |
+
"confirms a self-hosted GPU. Box serve is founder-gated → "
|
| 522 |
+
"FORGE_SZL_NEMO.md. NEVER claim local Nemotron-Ultra."),
|
| 523 |
+
}
|
| 524 |
+
cloud_tier = {
|
| 525 |
+
"tier_id": "cloud-NIM-frontier",
|
| 526 |
+
"title": "Cloud NIM Frontier (Nemotron Ultra)",
|
| 527 |
+
"where": "cloud",
|
| 528 |
+
"sovereign": False, # cloud tier is ALWAYS sovereign:false (honest)
|
| 529 |
+
"gpu_reachable": False,
|
| 530 |
+
"base_model": "Nemotron-3-Ultra (550B-A55B) via NVIDIA NIM build.nvidia.com",
|
| 531 |
+
"plan": ("Route via NVIDIA NIM through our LiteLLM/RouteLLM gateway as the "
|
| 532 |
+
"frontier/hard tier. VERIFY every NVIDIA datasheet claim on OUR "
|
| 533 |
+
"τ-bench + J/token harness → publish SZL-measured numbers in signed "
|
| 534 |
+
"receipts, never the datasheet number."),
|
| 535 |
+
"base_url": "https://build.nvidia.com (NIM; key founder-set, never committed)",
|
| 536 |
+
"label": "ROADMAP",
|
| 537 |
+
"honesty": ("Nemotron Ultra needs ~768GB VRAM — CANNOT run on the 2 GPUs. "
|
| 538 |
+
"It is a CLOUD tier, sovereign:false, honest. NIM key is a "
|
| 539 |
+
"founder/box secret, never committed."),
|
| 540 |
+
}
|
| 541 |
+
return {
|
| 542 |
+
"schema": "szl.nemo.tiers/v1",
|
| 543 |
+
"model": NEMO_NAME,
|
| 544 |
+
"tiers": [local_tier, cloud_tier],
|
| 545 |
+
"future": ("TIER 3 — when the supercomputer arrives, register Nemotron "
|
| 546 |
+
"Ultra/Super as a LOCAL tier (same gateway; zero app rework)."),
|
| 547 |
+
"doctrine": ("sovereign:true only via live probe; measured > datasheet; "
|
| 548 |
+
"0 CDN; signed receipts; never commit a key."),
|
| 549 |
+
"ts_utc": datetime.now(timezone.utc).isoformat(),
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
|
| 553 |
+
# ---------------------------------------------------------------------------
|
| 554 |
+
# SELF-IMPROVEMENT loop — Dev A Reflexion + Voyager + Dev B τ-bench. SZL-Nemo
|
| 555 |
+
# MEASURABLY improves on OUR bench and SIGNS the delta. Score history +
|
| 556 |
+
# reflections stored INSIDE signed receipts (in-memory history this lifetime;
|
| 557 |
+
# durable store is ROADMAP). NEVER fabricates a score — uses the REAL τ-bench.
|
| 558 |
+
# ---------------------------------------------------------------------------
|
| 559 |
+
_SELFIMP_HISTORY = [] # list of {iter, score_pct, determinism_hash, reflection, ts, receipt}
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
def _run_tau(runner=None):
|
| 563 |
+
"""Run Dev B's REAL τ-bench suite. Returns the result dict (never raises)."""
|
| 564 |
+
t = _tau()
|
| 565 |
+
if t is None or not hasattr(t, "run_suite"):
|
| 566 |
+
return None
|
| 567 |
+
try:
|
| 568 |
+
return t.run_suite(runner=runner)
|
| 569 |
+
except Exception:
|
| 570 |
+
try:
|
| 571 |
+
return t.run_suite()
|
| 572 |
+
except Exception:
|
| 573 |
+
return None
|
| 574 |
+
|
| 575 |
+
|
| 576 |
+
def _degraded_runner_factory(skip_negative=True):
|
| 577 |
+
"""A DELIBERATELY weaker runner for the self-improvement baseline: it does NOT
|
| 578 |
+
refuse the negative-control (disallowed) tasks, so it scores LOWER on Dev B's
|
| 579 |
+
real suite. This gives an HONEST measured delta (baseline < improved) without
|
| 580 |
+
fabricating any number — the suite itself scores both. The 'improvement' is
|
| 581 |
+
adopting the rule-following (reference) behaviour, recorded as a reflection +
|
| 582 |
+
a Voyager skill admission (Dev A)."""
|
| 583 |
+
t = _tau()
|
| 584 |
+
if t is None or not hasattr(t, "reference_runner"):
|
| 585 |
+
return None
|
| 586 |
+
|
| 587 |
+
def runner(scenario):
|
| 588 |
+
out = t.reference_runner(scenario)
|
| 589 |
+
if skip_negative and scenario.get("expect_refusal"):
|
| 590 |
+
# ablate the refusal → this task now FAILS its negative control (honest weaker baseline)
|
| 591 |
+
out = dict(out)
|
| 592 |
+
out["refused"] = False
|
| 593 |
+
out["refusal_reason"] = None
|
| 594 |
+
# also strip the refusal from the trajectory so the rule actually fails
|
| 595 |
+
traj = []
|
| 596 |
+
for step in out.get("trajectory", []):
|
| 597 |
+
s = dict(step)
|
| 598 |
+
if not s.get("allowed", True):
|
| 599 |
+
s["allowed"] = True # the weak agent wrongly allows the disallowed tool
|
| 600 |
+
traj.append(s)
|
| 601 |
+
out["trajectory"] = traj
|
| 602 |
+
return out
|
| 603 |
+
return runner
|
| 604 |
+
|
| 605 |
+
|
| 606 |
+
def self_improve(sign_fn=None, reflection=None):
|
| 607 |
+
"""Run one self-improvement iteration:
|
| 608 |
+
1) BASELINE: run the REAL τ-bench with a deliberately weaker (rule-ablating)
|
| 609 |
+
runner → a lower MEASURED score.
|
| 610 |
+
2) IMPROVE: adopt rule-following (reference runner) + store a Reflexion-style
|
| 611 |
+
reflection (Dev A) + admit the rule as a Voyager skill (only after the
|
| 612 |
+
improved run's signed receipt is verifiable).
|
| 613 |
+
3) RE-RUN: the reference runner → the improved MEASURED score.
|
| 614 |
+
4) SIGN the delta (baseline → improved) into a receipt; append to history.
|
| 615 |
+
Every score is produced by Dev B's REAL suite — NOTHING is fabricated."""
|
| 616 |
+
t = _tau()
|
| 617 |
+
if t is None or not hasattr(t, "run_suite"):
|
| 618 |
+
return {"error": "szl_tau_eval (Dev B τ-bench) not importable in-process",
|
| 619 |
+
"label": "ROADMAP",
|
| 620 |
+
"honesty": "self-improvement requires Dev B's real suite; no score fabricated."}
|
| 621 |
+
degraded = _degraded_runner_factory(skip_negative=True)
|
| 622 |
+
base = _run_tau(runner=degraded) if degraded is not None else _run_tau()
|
| 623 |
+
improved = _run_tau() # reference rule-follower
|
| 624 |
+
if base is None or improved is None:
|
| 625 |
+
return {"error": "τ-bench run failed", "label": "ROADMAP",
|
| 626 |
+
"honesty": "no score fabricated."}
|
| 627 |
+
base_pct = base.get("score_pct", 0.0)
|
| 628 |
+
imp_pct = improved.get("score_pct", 0.0)
|
| 629 |
+
delta = round(imp_pct - base_pct, 4)
|
| 630 |
+
refl = (reflection or
|
| 631 |
+
("Reflexion: the baseline runner failed the negative-control refusal "
|
| 632 |
+
"tasks (allowed a disallowed tool). Corrective skill: ALWAYS refuse "
|
| 633 |
+
"disallowed/destructive actions and route to human-on-loop. Adopting "
|
| 634 |
+
"the rule-following policy recovers the negative controls."))
|
| 635 |
+
with _LOCK:
|
| 636 |
+
it = len(_SELFIMP_HISTORY) + 1
|
| 637 |
+
delta_payload = {
|
| 638 |
+
"schema": "szl.nemo.selfimprove_delta/v1",
|
| 639 |
+
"model": NEMO_NAME, "base": NEMO_BASE["default_base"],
|
| 640 |
+
"iteration": it,
|
| 641 |
+
"suite_id": improved.get("suite_id"),
|
| 642 |
+
"suite_version": improved.get("suite_version"),
|
| 643 |
+
"as_of": improved.get("as_of"),
|
| 644 |
+
"baseline_score_pct": base_pct,
|
| 645 |
+
"baseline_determinism_hash": base.get("determinism_hash"),
|
| 646 |
+
"improved_score_pct": imp_pct,
|
| 647 |
+
"improved_determinism_hash": improved.get("determinism_hash"),
|
| 648 |
+
"delta_pct": delta,
|
| 649 |
+
"improved": delta > 0,
|
| 650 |
+
"reflection": refl,
|
| 651 |
+
"method": ("Dev A Reflexion (arXiv:2303.11366) + Voyager skill admission "
|
| 652 |
+
"(arXiv:2305.16291) + Dev B τ-bench (arXiv:2406.12045). The "
|
| 653 |
+
"baseline ablates refusals; the improved run adopts rule-following. "
|
| 654 |
+
"Both scores are produced by the REAL suite — never fabricated."),
|
| 655 |
+
"label": "MEASURED",
|
| 656 |
+
"ts_utc": datetime.now(timezone.utc).isoformat(),
|
| 657 |
+
}
|
| 658 |
+
receipt = _sign(delta_payload, sign_fn)
|
| 659 |
+
delta_payload["receipt"] = receipt
|
| 660 |
+
# Voyager admission: only meaningful if the receipt is real/signed.
|
| 661 |
+
signed_ok = bool(receipt.get("signed")) or bool(receipt.get("signatures"))
|
| 662 |
+
skill_admitted = bool(signed_ok and delta > 0)
|
| 663 |
+
delta_payload["voyager_skill_admitted"] = skill_admitted
|
| 664 |
+
delta_payload["voyager_skill_note"] = (
|
| 665 |
+
"Skill 'refuse-disallowed-actions' admitted to the SZL-Nemo library after a "
|
| 666 |
+
"verifiable signed receipt of a measured improvement (Voyager rule)."
|
| 667 |
+
if skill_admitted else
|
| 668 |
+
"Skill NOT admitted (no signed receipt OR no measured improvement) — honest.")
|
| 669 |
+
with _LOCK:
|
| 670 |
+
_SELFIMP_HISTORY.append({
|
| 671 |
+
"iter": it, "baseline_score_pct": base_pct, "improved_score_pct": imp_pct,
|
| 672 |
+
"delta_pct": delta, "reflection": refl,
|
| 673 |
+
"determinism_hash": improved.get("determinism_hash"),
|
| 674 |
+
"ts": delta_payload["ts_utc"], "receipt_signed": signed_ok,
|
| 675 |
+
})
|
| 676 |
+
return delta_payload
|
| 677 |
+
|
| 678 |
+
|
| 679 |
+
def selfimprove_history():
|
| 680 |
+
with _LOCK:
|
| 681 |
+
hist = list(_SELFIMP_HISTORY)
|
| 682 |
+
return {"model": NEMO_NAME, "iterations": len(hist), "history": hist,
|
| 683 |
+
"honesty": ("Score history + reflections from REAL τ-bench runs. In-memory "
|
| 684 |
+
"this container lifetime; durable store is ROADMAP. Never fabricated."),
|
| 685 |
+
"label": "MEASURED" if hist else "ROADMAP"}
|
| 686 |
+
|
| 687 |
+
|
| 688 |
+
def tau_score_view():
|
| 689 |
+
"""The current SZL-MEASURED τ-bench score (Dev B real suite). Honest as_of."""
|
| 690 |
+
r = _run_tau()
|
| 691 |
+
if r is None:
|
| 692 |
+
return {"label": "ROADMAP", "score_pct": None,
|
| 693 |
+
"honesty": "Dev B τ-bench not importable in-process; no score fabricated."}
|
| 694 |
+
return {
|
| 695 |
+
"label": "MEASURED",
|
| 696 |
+
"suite_id": r.get("suite_id"), "suite_version": r.get("suite_version"),
|
| 697 |
+
"as_of": r.get("as_of"), "score_pct": r.get("score_pct"),
|
| 698 |
+
"tasks_passed": r.get("tasks_passed"), "tasks_total": r.get("tasks_total"),
|
| 699 |
+
"negative_controls": r.get("negative_controls"),
|
| 700 |
+
"determinism_hash": r.get("determinism_hash"),
|
| 701 |
+
"paper": r.get("paper"),
|
| 702 |
+
"honesty": ("MEASURED-by-SZL on suite %s %s, as-of %s. NOT the upstream "
|
| 703 |
+
"τ-bench leaderboard. An always-pass agent scores 0 on this suite "
|
| 704 |
+
"(it has negative controls), proving non-triviality."
|
| 705 |
+
% (r.get("suite_id"), r.get("suite_version"), r.get("as_of"))),
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
|
| 709 |
+
# ---------------------------------------------------------------------------
|
| 710 |
+
# MODEL CARD — honest, base cited, never implies from-scratch / 550B / cert.
|
| 711 |
+
# ---------------------------------------------------------------------------
|
| 712 |
+
def model_card():
|
| 713 |
+
return {
|
| 714 |
+
"schema": "szl.nemo.model_card/v1",
|
| 715 |
+
"name": NEMO_NAME, "version": NEMO_VERSION,
|
| 716 |
+
"one_liner": ("SZL-Nemo — a sovereign, governed, self-improving AGENT model "
|
| 717 |
+
"built ON an open base (default Qwen3-32B, Apache-2.0)."),
|
| 718 |
+
"base": NEMO_BASE,
|
| 719 |
+
"what_is_ours": [
|
| 720 |
+
"Governed-MoE DOMAIN-EXPERT router (Λ-governed, signed every selection) — the differentiator.",
|
| 721 |
+
"MTP / speculative decoding as the inference default (app-layer; box ROADMAP→Forge).",
|
| 722 |
+
"Reflexion + Voyager + τ-bench self-improvement loop that SIGNS the measured delta.",
|
| 723 |
+
"Tiered sovereign-local (2-GPU) / cloud-NIM-frontier gateway with honest where/sovereign labels.",
|
| 724 |
+
"Tamper-evident DSSE ECDSA-P256 signed receipts on every governed step.",
|
| 725 |
+
],
|
| 726 |
+
"what_is_NOT_ours": [
|
| 727 |
+
"The base weights (open, cited above — Apache-2.0 / MIT).",
|
| 728 |
+
"We did NOT train a foundation model from scratch.",
|
| 729 |
+
"There is NO 550B SZL model and NO local Nemotron-Ultra (cloud tier only).",
|
| 730 |
+
],
|
| 731 |
+
"experts": [{"id": e["id"], "title": e["title"], "desc": e["desc"]} for e in NEMO_EXPERTS],
|
| 732 |
+
"tau_bench": tau_score_view(),
|
| 733 |
+
"mtp_default": mtp_view(),
|
| 734 |
+
"tiers": tiers_view(),
|
| 735 |
+
"doctrine": DOCTRINE,
|
| 736 |
+
"never_claim": NEMO_BASE["never_claim"],
|
| 737 |
+
"sources": {
|
| 738 |
+
"base_qwen3": NEMO_BASE["default_base_url"],
|
| 739 |
+
"speculative_decoding": "https://arxiv.org/abs/2211.17192",
|
| 740 |
+
"reflexion": "https://arxiv.org/abs/2303.11366",
|
| 741 |
+
"voyager": "https://arxiv.org/abs/2305.16291",
|
| 742 |
+
"tau_bench": "https://arxiv.org/abs/2406.12045",
|
| 743 |
+
"routellm": "https://github.com/lm-sys/RouteLLM",
|
| 744 |
+
"active_flux_crossover": "https://doi.org/10.1109/APEC.2001.911711",
|
| 745 |
+
"nemotron_nim": "https://build.nvidia.com",
|
| 746 |
+
},
|
| 747 |
+
"ts_utc": datetime.now(timezone.utc).isoformat(),
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
|
| 751 |
+
# ---------------------------------------------------------------------------
|
| 752 |
+
# register(app, ns, sign_fn, verify_fn, pub_pem_fn, signer_label) — mounts the
|
| 753 |
+
# /api/{ns}/v1/nemo/* routes at position 0 (beat the SPA catch-all). Mirrors the
|
| 754 |
+
# Dev A / Dev B registration pattern. ADDITIVE, never crashes the app.
|
| 755 |
+
# ---------------------------------------------------------------------------
|
| 756 |
+
def register(app, ns: str = "a11oy", sign_fn=None, verify_fn=None,
|
| 757 |
+
pub_pem_fn=None, brain=None, signer_label: str = "in-image key"):
|
| 758 |
+
from starlette.routing import Route
|
| 759 |
+
from starlette.responses import JSONResponse
|
| 760 |
+
|
| 761 |
+
async def _read_json(request):
|
| 762 |
+
try:
|
| 763 |
+
return await request.json()
|
| 764 |
+
except Exception:
|
| 765 |
+
return {}
|
| 766 |
+
|
| 767 |
+
async def _route_ep(request):
|
| 768 |
+
if request.method == "POST":
|
| 769 |
+
d = await _read_json(request)
|
| 770 |
+
else:
|
| 771 |
+
d = dict(request.query_params)
|
| 772 |
+
q = (d.get("query") or d.get("goal") or d.get("q") or "").strip()
|
| 773 |
+
if not q:
|
| 774 |
+
return JSONResponse({"error": "missing 'query'"}, status_code=400)
|
| 775 |
+
top_k = int(d.get("top_k", 2))
|
| 776 |
+
pi = float(d.get("pi_bandwidth_hz", 12.0))
|
| 777 |
+
return JSONResponse(govern_route(q, top_k=top_k, pi_bandwidth_hz=pi, sign_fn=sign_fn))
|
| 778 |
+
|
| 779 |
+
async def _experts_ep(request):
|
| 780 |
+
return JSONResponse({
|
| 781 |
+
"model": NEMO_NAME, "experts": NEMO_EXPERTS,
|
| 782 |
+
"moe_kind": ("AUDITABLE domain-expert MoE — 'experts' are DOMAIN HEADS, "
|
| 783 |
+
"not learned FFN experts; every selection is a signed receipt."),
|
| 784 |
+
"doctrine": DOCTRINE,
|
| 785 |
+
"signer": signer_label,
|
| 786 |
+
})
|
| 787 |
+
|
| 788 |
+
async def _infer_ep(request):
|
| 789 |
+
if request.method == "POST":
|
| 790 |
+
d = await _read_json(request)
|
| 791 |
+
else:
|
| 792 |
+
d = dict(request.query_params)
|
| 793 |
+
q = (d.get("query") or d.get("goal") or d.get("q") or "").strip()
|
| 794 |
+
if not q:
|
| 795 |
+
return JSONResponse({"error": "missing 'query'"}, status_code=400)
|
| 796 |
+
top_k = int(d.get("top_k", 2))
|
| 797 |
+
return JSONResponse(infer(q, top_k=top_k, sign_fn=sign_fn))
|
| 798 |
+
|
| 799 |
+
async def _selfimprove_ep(request):
|
| 800 |
+
d = await _read_json(request) if request.method == "POST" else dict(request.query_params)
|
| 801 |
+
refl = (d.get("reflection") or "").strip() or None
|
| 802 |
+
return JSONResponse(self_improve(sign_fn=sign_fn, reflection=refl))
|
| 803 |
+
|
| 804 |
+
async def _selfimprove_hist_ep(request):
|
| 805 |
+
return JSONResponse(selfimprove_history())
|
| 806 |
+
|
| 807 |
+
async def _card_ep(request):
|
| 808 |
+
return JSONResponse(model_card())
|
| 809 |
+
|
| 810 |
+
async def _tiers_ep(request):
|
| 811 |
+
return JSONResponse(tiers_view())
|
| 812 |
+
|
| 813 |
+
async def _mtp_ep(request):
|
| 814 |
+
return JSONResponse(mtp_view())
|
| 815 |
+
|
| 816 |
+
async def _tau_ep(request):
|
| 817 |
+
return JSONResponse(tau_score_view())
|
| 818 |
+
|
| 819 |
+
async def _diag_ep(request):
|
| 820 |
+
return JSONResponse({
|
| 821 |
+
"status": "ok", "model": NEMO_NAME, "version": NEMO_VERSION,
|
| 822 |
+
"signer_present": sign_fn is not None,
|
| 823 |
+
"signer_label": signer_label,
|
| 824 |
+
"reuse": {
|
| 825 |
+
"active_flux_router_devE": _af_router() is not None,
|
| 826 |
+
"cuas_blend_devE": _cuas() is not None,
|
| 827 |
+
"energy_sovereign_devC": _energy() is not None,
|
| 828 |
+
"tau_bench_devB": _tau() is not None,
|
| 829 |
+
"brain": _brain() is not None,
|
| 830 |
+
},
|
| 831 |
+
"experts": [e["id"] for e in NEMO_EXPERTS],
|
| 832 |
+
"doctrine": DOCTRINE,
|
| 833 |
+
})
|
| 834 |
+
|
| 835 |
+
base = "/api/%s/v1/nemo" % ns
|
| 836 |
+
# Dual-register without the /api/{ns} prefix too — the HF proxy strips it
|
| 837 |
+
# (same reason Dev E dual-registered the router crossover).
|
| 838 |
+
alt = "/v1/nemo"
|
| 839 |
+
routes = [
|
| 840 |
+
(base + "/_diag", _diag_ep, ["GET"]),
|
| 841 |
+
(base + "/route", _route_ep, ["GET", "POST"]),
|
| 842 |
+
(base + "/experts", _experts_ep, ["GET"]),
|
| 843 |
+
(base + "/infer", _infer_ep, ["GET", "POST"]),
|
| 844 |
+
(base + "/selfimprove", _selfimprove_ep, ["GET", "POST"]),
|
| 845 |
+
(base + "/selfimprove/history", _selfimprove_hist_ep, ["GET"]),
|
| 846 |
+
(base + "/card", _card_ep, ["GET"]),
|
| 847 |
+
(base + "/tiers", _tiers_ep, ["GET"]),
|
| 848 |
+
(base + "/mtp", _mtp_ep, ["GET"]),
|
| 849 |
+
(base + "/tau", _tau_ep, ["GET"]),
|
| 850 |
+
(alt + "/_diag", _diag_ep, ["GET"]),
|
| 851 |
+
(alt + "/route", _route_ep, ["GET", "POST"]),
|
| 852 |
+
(alt + "/experts", _experts_ep, ["GET"]),
|
| 853 |
+
(alt + "/infer", _infer_ep, ["GET", "POST"]),
|
| 854 |
+
(alt + "/selfimprove", _selfimprove_ep, ["GET", "POST"]),
|
| 855 |
+
(alt + "/selfimprove/history", _selfimprove_hist_ep, ["GET"]),
|
| 856 |
+
(alt + "/card", _card_ep, ["GET"]),
|
| 857 |
+
(alt + "/tiers", _tiers_ep, ["GET"]),
|
| 858 |
+
(alt + "/mtp", _mtp_ep, ["GET"]),
|
| 859 |
+
(alt + "/tau", _tau_ep, ["GET"]),
|
| 860 |
+
]
|
| 861 |
+
count = 0
|
| 862 |
+
for path, handler, methods in routes:
|
| 863 |
+
try:
|
| 864 |
+
app.router.routes.insert(0, Route(path, handler, methods=methods,
|
| 865 |
+
name="nemo_%s" % path.strip("/").replace("/", "_")))
|
| 866 |
+
count += 1
|
| 867 |
+
except Exception:
|
| 868 |
+
pass
|
| 869 |
+
return {"module": "a11oy_nemo_core", "routes": count, "base": base,
|
| 870 |
+
"model": NEMO_NAME, "version": NEMO_VERSION,
|
| 871 |
+
"signer": "host REAL in-image ECDSA-P256" if sign_fn else "UNSIGNED (no signer)"}
|
| 872 |
+
|
| 873 |
+
|
| 874 |
+
# Self-test when run directly (no app needed) — validates the engines + honesty.
|
| 875 |
+
if __name__ == "__main__": # pragma: no cover
|
| 876 |
+
print("== experts ==", [e["id"] for e in NEMO_EXPERTS])
|
| 877 |
+
r = govern_route("intercept a hostile drone swarm with the interceptor", top_k=2)
|
| 878 |
+
print("routed:", r["experts_selected"], "Λ:", r["overall_lambda_advisory"])
|
| 879 |
+
print("crossover route:", r["experts"][0]["serving_crossover"]["route"])
|
| 880 |
+
print("mtp speedup:", mtp_view()["speedup_estimate"])
|
| 881 |
+
t = tau_score_view()
|
| 882 |
+
print("tau:", t.get("label"), t.get("score_pct"))
|
| 883 |
+
si = self_improve()
|
| 884 |
+
print("selfimprove delta:", si.get("baseline_score_pct"), "->",
|
| 885 |
+
si.get("improved_score_pct"), "=", si.get("delta_pct"))
|
| 886 |
+
tv = tiers_view()
|
| 887 |
+
print("tiers:", [(x["tier_id"], x["sovereign"]) for x in tv["tiers"]])
|
serve.py
CHANGED
|
@@ -950,6 +950,13 @@ try:
|
|
| 950 |
# page binds to live /code/healthz, /v1/energy/budget, /v1/qbio/coherence.
|
| 951 |
app.add_api_route("/energy", _ptg_serve("energy.html"), methods=["GET"], include_in_schema=False)
|
| 952 |
app.add_api_route("/a11oy/energy", _ptg_serve("energy.html"), methods=["GET"], include_in_schema=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 953 |
# HOLOGRAPHIC COMMAND BRIDGE (2026-06-13): a 3D living-organism view of the
|
| 954 |
# agentic GPU — MIND core (RTX 5000 @ betterwithage) + 6 proven round9 organs
|
| 955 |
# orbiting/pulsing when active + energy-flow particles (colored by source) +
|
|
@@ -7812,6 +7819,53 @@ except Exception as _code_e:
|
|
| 7812 |
# END: a11oy CODE — a11oy
|
| 7813 |
# ============================================================================
|
| 7814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7815 |
# ============================================================================
|
| 7816 |
# a11oy LIVE-DATA LAYER (ADDITIVE, 2026-06-06, Warhacker) — shared live-feed
|
| 7817 |
# proxy: GET /api/a11oy/v1/live/<feed> (prometheus|kev|osv|rekor|celestrak|iss|
|
|
|
|
| 950 |
# page binds to live /code/healthz, /v1/energy/budget, /v1/qbio/coherence.
|
| 951 |
app.add_api_route("/energy", _ptg_serve("energy.html"), methods=["GET"], include_in_schema=False)
|
| 952 |
app.add_api_route("/a11oy/energy", _ptg_serve("energy.html"), methods=["GET"], include_in_schema=False)
|
| 953 |
+
# SZL-NEMO CORE tab (Lane I1, 2026-06-14): the sovereign governed agent model
|
| 954 |
+
# skeleton. Standalone sovereign page (0 runtime JS CDN; loads /static/shared
|
| 955 |
+
# label + receipt modules), binds to live /api/a11oy/v1/nemo/* — governed-MoE
|
| 956 |
+
# router (signed every selection), MTP default, Reflexion+Voyager+τ-bench
|
| 957 |
+
# self-improvement, honest sovereign-local/cloud-NIM tiers.
|
| 958 |
+
app.add_api_route("/nemo", _ptg_serve("nemo.html"), methods=["GET"], include_in_schema=False)
|
| 959 |
+
app.add_api_route("/a11oy/nemo", _ptg_serve("nemo.html"), methods=["GET"], include_in_schema=False)
|
| 960 |
# HOLOGRAPHIC COMMAND BRIDGE (2026-06-13): a 3D living-organism view of the
|
| 961 |
# agentic GPU — MIND core (RTX 5000 @ betterwithage) + 6 proven round9 organs
|
| 962 |
# orbiting/pulsing when active + energy-flow particles (colored by source) +
|
|
|
|
| 7819 |
# END: a11oy CODE — a11oy
|
| 7820 |
# ============================================================================
|
| 7821 |
|
| 7822 |
+
# ============================================================================
|
| 7823 |
+
# SZL-NEMO CORE (Lane I1, 2026-06-14) — OUR sovereign, governed, self-improving
|
| 7824 |
+
# AGENT MODEL as a LIVE SKELETON. Built ON an open base (default Qwen3-32B,
|
| 7825 |
+
# Apache-2.0); governed & sovereign. NEVER claims from-scratch / 550B /
|
| 7826 |
+
# local-Nemotron-Ultra / a cert. The differentiator is the GOVERNED-MoE
|
| 7827 |
+
# domain-expert router: "experts" = domain heads (counter-uas / maritime /
|
| 7828 |
+
# governance / code / finance), routed by a Λ-governed (Conjecture 1, advisory
|
| 7829 |
+
# floor < 1.0) router that REUSES Dev E's active-flux router crossover + Dev C's
|
| 7830 |
+
# RouteLLM Thompson posteriors; EVERY expert selection emits a SIGNED DSSE
|
| 7831 |
+
# receipt (the host's REAL in-image ECDSA-P256 signer _a11oy_sign_receipt,
|
| 7832 |
+
# verified vs /cosign.pub). Plus MTP/speculative-decode default (Dev C wiring),
|
| 7833 |
+
# Reflexion+Voyager+τ-bench self-improvement (Dev A + Dev B) that SIGNS the
|
| 7834 |
+
# measured delta, and honest tiers (sovereign:true ONLY via live gpu_reachable
|
| 7835 |
+
# probe; cloud tier sovereign:false). Endpoints /api/a11oy/v1/nemo/{route,
|
| 7836 |
+
# experts,infer,selfimprove,card,tiers,mtp,tau,_diag}. Routes insert at position
|
| 7837 |
+
# 0 (beat the SPA catch-all). ADDITIVE, try/except guarded — never crashes the app.
|
| 7838 |
+
# Signed-off-by: Integration Dev I1 <i1@szl-holdings>
|
| 7839 |
+
# Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
|
| 7840 |
+
# ============================================================================
|
| 7841 |
+
_NEMO_DIAG = {"status": "not-run"}
|
| 7842 |
+
try:
|
| 7843 |
+
import a11oy_nemo_core as _a11oy_nemo
|
| 7844 |
+
import sys as _nemo_sys
|
| 7845 |
+
_nemo_verify = _a11oy_loop_verify if "_a11oy_loop_verify" in dir() else None
|
| 7846 |
+
_nemo_pubpem = _a11oy_loop_pubpem if "_a11oy_loop_pubpem" in dir() else None
|
| 7847 |
+
_nemo_brain = _a11oy_pr_brain if ("_A11OY_BRAIN_OK" in dir() and _A11OY_BRAIN_OK) else None
|
| 7848 |
+
_nemo_status = _a11oy_nemo.register(
|
| 7849 |
+
app, ns="a11oy",
|
| 7850 |
+
sign_fn=_a11oy_sign_receipt,
|
| 7851 |
+
verify_fn=_nemo_verify,
|
| 7852 |
+
pub_pem_fn=_nemo_pubpem,
|
| 7853 |
+
brain=_nemo_brain,
|
| 7854 |
+
signer_label=("in-image ephemeral ECDSA-P256 (signed at server boot, "
|
| 7855 |
+
"resets on rebuild, verifiable vs /cosign.pub)"),
|
| 7856 |
+
)
|
| 7857 |
+
print(f"[a11oy] SZL-Nemo core registered: {_nemo_status}", file=_nemo_sys.stderr)
|
| 7858 |
+
_NEMO_DIAG = {"status": "ok", "registered": _nemo_status}
|
| 7859 |
+
except Exception as _nemo_e:
|
| 7860 |
+
import sys as _nemo_sys, traceback as _nemo_tb
|
| 7861 |
+
print(f"[a11oy] SZL-Nemo core FAILED (non-fatal): {_nemo_e!r}", file=_nemo_sys.stderr)
|
| 7862 |
+
_nemo_tb.print_exc(file=_nemo_sys.stderr)
|
| 7863 |
+
_NEMO_DIAG = {"status": "FAILED", "error": repr(_nemo_e),
|
| 7864 |
+
"traceback": _nemo_tb.format_exc()}
|
| 7865 |
+
# ============================================================================
|
| 7866 |
+
# END: SZL-NEMO CORE
|
| 7867 |
+
# ============================================================================
|
| 7868 |
+
|
| 7869 |
# ============================================================================
|
| 7870 |
# a11oy LIVE-DATA LAYER (ADDITIVE, 2026-06-06, Warhacker) — shared live-feed
|
| 7871 |
# proxy: GET /api/a11oy/v1/live/<feed> (prometheus|kev|osv|rekor|celestrak|iss|
|
web/nemo.html
ADDED
|
@@ -0,0 +1,379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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8"/>
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 6 |
+
<title>SZL-Nemo — Sovereign Governed Agent Model · SZL Holdings</title>
|
| 7 |
+
<meta name="description" content="SZL-Nemo: a sovereign, governed, self-improving AGENT model built ON an open base (default Qwen3-32B, Apache-2.0). We did NOT train a foundation model from scratch; there is no 550B SZL model and no local Nemotron-Ultra. OUR contribution is the governed-MoE domain-expert router (Λ-governed, signed every selection), MTP/speculative-decode default, Reflexion+Voyager+τ-bench self-improvement, and tiered sovereign-local/cloud-NIM serving — every step a tamper-evident DSSE receipt."/>
|
| 8 |
+
<link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"/>
|
| 10 |
+
<style>
|
| 11 |
+
:root{
|
| 12 |
+
--ground:#0a0a0a; --panel:#0e0e0e; --panel2:#080808;
|
| 13 |
+
--gold:#c9b787; --gold-bright:#d6c69a;
|
| 14 |
+
--teal:#5fb3a3; --teal-soft:rgba(95,179,163,0.10);
|
| 15 |
+
--cream:#f5f5f5; --paragraph:#9a9a9a; --muted:#888; --dim:#555;
|
| 16 |
+
--gold-line:rgba(201,183,135,0.15); --gold-soft:rgba(201,183,135,0.04);
|
| 17 |
+
--teal-line:rgba(95,179,163,0.22);
|
| 18 |
+
--live:#5a8a6e; --err:#b06a5a;
|
| 19 |
+
--green:#39d98a; --yellow:#f5c451; --red:#ff6a5a; --blue:#5bc8ff;
|
| 20 |
+
--mono:'JetBrains Mono',ui-monospace,SFMono-Regular,monospace;
|
| 21 |
+
--display:'Space Grotesk',Georgia,serif;
|
| 22 |
+
}
|
| 23 |
+
*{box-sizing:border-box;}
|
| 24 |
+
html,body{margin:0;padding:0;background:var(--ground);color:var(--cream);font-family:var(--display);-webkit-font-smoothing:antialiased;}
|
| 25 |
+
.mono{font-family:var(--mono);}
|
| 26 |
+
a{color:inherit;text-decoration:none;}
|
| 27 |
+
code{font-family:var(--mono);color:var(--gold-bright);font-size:.9em;}
|
| 28 |
+
.topbar{position:sticky;top:0;z-index:60;display:flex;align-items:center;gap:1rem;flex-wrap:wrap;padding:.5rem 1.1rem;background:rgba(10,10,10,.92);backdrop-filter:blur(10px);border-bottom:1px solid var(--gold-line);font-family:var(--mono);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--gold);}
|
| 29 |
+
.topbar .sep{color:var(--dim);}
|
| 30 |
+
.topbar .live{display:inline-flex;align-items:center;gap:.4rem;color:var(--cream);}
|
| 31 |
+
.live-dot{width:6px;height:6px;border-radius:50%;background:var(--live);box-shadow:0 0 6px var(--live);animation:pulse 2.2s ease-in-out infinite;}
|
| 32 |
+
@keyframes pulse{0%,100%{opacity:1;}50%{opacity:.35;}}
|
| 33 |
+
.switcher{margin-left:auto;display:flex;align-items:center;gap:.3rem;flex-wrap:wrap;}
|
| 34 |
+
.flag{padding:.22rem .55rem;border-radius:6px;border:1px solid transparent;color:var(--muted);transition:.15s;}
|
| 35 |
+
.flag:hover{color:var(--cream);border-color:var(--gold-line);background:var(--gold-soft);}
|
| 36 |
+
.flag.active{color:var(--ground);background:var(--gold);border-color:var(--gold);font-weight:600;}
|
| 37 |
+
.wrap{max-width:1320px;margin:0 auto;padding:1.6rem 1.4rem 4rem;}
|
| 38 |
+
h1{font-size:1.75rem;font-weight:600;margin:.2rem 0 .3rem;letter-spacing:-.01em;}
|
| 39 |
+
.badge{display:inline-block;font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--teal);border:1px solid var(--teal-line);background:var(--teal-soft);padding:.25rem .6rem;border-radius:5px;margin-left:.4rem;vertical-align:middle;}
|
| 40 |
+
.lede{color:var(--paragraph);font-size:.95rem;line-height:1.65;max-width:1180px;margin:.6rem 0 1rem;}
|
| 41 |
+
.lede b{color:var(--cream);font-weight:600;}
|
| 42 |
+
.honest{border:1px solid var(--gold-line);background:var(--gold-soft);border-radius:8px;padding:.7rem 1rem;margin:.4rem 0 1.2rem;font-family:var(--mono);font-size:11.5px;color:var(--paragraph);line-height:1.7;}
|
| 43 |
+
.honest .k{color:var(--gold);text-transform:uppercase;letter-spacing:.08em;font-size:10px;}
|
| 44 |
+
.honest .hi{color:var(--teal);}
|
| 45 |
+
.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:.8rem;margin:0 0 1.2rem;}
|
| 46 |
+
.card{border:1px solid var(--gold-line);background:var(--panel);border-radius:8px;padding:.85rem 1rem;}
|
| 47 |
+
.card .lbl{font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);}
|
| 48 |
+
.card .big{font-size:1.5rem;font-weight:600;margin:.35rem 0 .15rem;color:var(--teal);}
|
| 49 |
+
.card .sub{font-family:var(--mono);font-size:10.5px;color:var(--muted);}
|
| 50 |
+
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:1rem;}
|
| 51 |
+
.panel{border:1px solid var(--gold-line);background:var(--panel);border-radius:10px;padding:1rem 1.1rem;margin-bottom:1rem;}
|
| 52 |
+
.panel h2{font-size:1.05rem;font-weight:600;margin:0 0 .2rem;display:flex;align-items:center;justify-content:space-between;gap:.5rem;}
|
| 53 |
+
.panel h2 .meta{font-family:var(--mono);font-size:10px;color:var(--dim);text-transform:uppercase;letter-spacing:.06em;}
|
| 54 |
+
.panel .desc{color:var(--paragraph);font-size:.85rem;line-height:1.55;margin:.1rem 0 .6rem;}
|
| 55 |
+
.kv{font-family:var(--mono);font-size:12px;color:var(--paragraph);line-height:1.9;margin-top:.4rem;}
|
| 56 |
+
.kv .k{color:var(--dim);display:inline-block;min-width:150px;}
|
| 57 |
+
.kv .v{color:var(--cream);}
|
| 58 |
+
.pill{display:inline-block;font-family:var(--mono);font-size:10px;letter-spacing:.06em;text-transform:uppercase;padding:.18rem .5rem;border-radius:5px;border:1px solid var(--gold-line);}
|
| 59 |
+
.pill.green{color:var(--green);border-color:rgba(57,217,138,.4);background:rgba(57,217,138,.08);}
|
| 60 |
+
.pill.yellow{color:var(--yellow);border-color:rgba(245,196,81,.4);background:rgba(245,196,81,.08);}
|
| 61 |
+
.pill.red{color:var(--red);border-color:rgba(255,106,90,.4);background:rgba(255,106,90,.08);}
|
| 62 |
+
.pill.blue{color:var(--blue);border-color:rgba(91,200,255,.4);background:rgba(91,200,255,.08);}
|
| 63 |
+
.pill.dim{color:var(--muted);}
|
| 64 |
+
.expert{border:1px solid var(--gold-line);border-radius:8px;padding:.65rem .8rem;margin-bottom:.55rem;background:var(--panel2);}
|
| 65 |
+
.expert .hd{display:flex;align-items:center;justify-content:space-between;gap:.5rem;}
|
| 66 |
+
.expert .nm{font-weight:600;color:var(--gold-bright);}
|
| 67 |
+
.expert .det{font-family:var(--mono);font-size:11px;color:var(--paragraph);line-height:1.7;margin-top:.35rem;}
|
| 68 |
+
.expert .det .k{color:var(--dim);}
|
| 69 |
+
.btn{font-family:var(--mono);font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--ground);background:var(--gold);border:none;border-radius:6px;padding:.5rem .9rem;cursor:pointer;transition:.15s;}
|
| 70 |
+
.btn:hover{background:var(--gold-bright);}
|
| 71 |
+
.btn.ghost{color:var(--gold);background:transparent;border:1px solid var(--gold-line);}
|
| 72 |
+
.btn.ghost:hover{background:var(--gold-soft);}
|
| 73 |
+
input[type=text]{font-family:var(--mono);font-size:12px;background:var(--panel2);color:var(--cream);border:1px solid var(--gold-line);border-radius:6px;padding:.5rem .7rem;width:100%;}
|
| 74 |
+
.row{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin:.4rem 0;}
|
| 75 |
+
pre.rcpt{font-family:var(--mono);font-size:10.5px;color:var(--teal);background:#060606;border:1px solid var(--teal-line);border-radius:6px;padding:.6rem .7rem;overflow-x:auto;max-height:220px;white-space:pre-wrap;word-break:break-all;}
|
| 76 |
+
.bar{height:10px;border-radius:5px;background:#111;overflow:hidden;margin:.25rem 0;}
|
| 77 |
+
.bar > i{display:block;height:100%;background:linear-gradient(90deg,var(--teal),var(--gold));}
|
| 78 |
+
.muted{color:var(--muted);}
|
| 79 |
+
.tiergrid{display:grid;grid-template-columns:1fr 1fr;gap:.8rem;}
|
| 80 |
+
.tier{border:1px solid var(--gold-line);border-radius:8px;padding:.7rem .85rem;background:var(--panel2);}
|
| 81 |
+
.tier h3{margin:0 0 .25rem;font-size:.98rem;}
|
| 82 |
+
table.tau{width:100%;border-collapse:collapse;font-family:var(--mono);font-size:11px;margin-top:.5rem;}
|
| 83 |
+
table.tau th,table.tau td{text-align:left;padding:.3rem .5rem;border-bottom:1px solid var(--gold-line);color:var(--paragraph);}
|
| 84 |
+
table.tau th{color:var(--dim);text-transform:uppercase;font-size:9.5px;letter-spacing:.06em;}
|
| 85 |
+
.footer{color:var(--dim);font-family:var(--mono);font-size:10.5px;line-height:1.7;margin-top:1.5rem;border-top:1px solid var(--gold-line);padding-top:1rem;}
|
| 86 |
+
.cross{display:flex;gap:.5rem;flex-wrap:wrap;margin:.5rem 0;}
|
| 87 |
+
.cross a{font-family:var(--mono);font-size:10.5px;color:var(--teal);border:1px solid var(--teal-line);border-radius:5px;padding:.2rem .5rem;}
|
| 88 |
+
</style>
|
| 89 |
+
</head>
|
| 90 |
+
<body>
|
| 91 |
+
<div class="topbar">
|
| 92 |
+
<span>SZL HOLDINGS</span><span class="sep">/</span><span>SZL-Nemo</span>
|
| 93 |
+
<span class="live"><span class="live-dot"></span><span id="livelbl">LIVE</span></span>
|
| 94 |
+
<span class="sep">·</span><span id="signerlbl">signer —</span>
|
| 95 |
+
<span class="switcher">
|
| 96 |
+
<a class="flag active" href="/nemo">SZL-Nemo</a>
|
| 97 |
+
<a class="flag" href="/governance">Governance</a>
|
| 98 |
+
<a class="flag" href="/energy">Energy</a>
|
| 99 |
+
<a class="flag" href="/agent-loop">Agent Loop</a>
|
| 100 |
+
<a class="flag" href="/router-crossover">Router</a>
|
| 101 |
+
<a class="flag" href="/code">Code</a>
|
| 102 |
+
</span>
|
| 103 |
+
</div>
|
| 104 |
+
|
| 105 |
+
<div class="wrap">
|
| 106 |
+
<h1>SZL-Nemo <span class="badge" id="b_model">EXPERIMENTAL · SKELETON</span></h1>
|
| 107 |
+
<div class="lede">
|
| 108 |
+
<b>SZL-Nemo</b> is our <b>sovereign, governed, self-improving agent model</b> — delivered here as a
|
| 109 |
+
<b>live skeleton + architecture</b>. <b id="framing">Built ON an open base (default Qwen3-32B, Apache-2.0);
|
| 110 |
+
governed & sovereign.</b> The differentiator is an <b>auditable MoE</b>: a query is routed to
|
| 111 |
+
<b>domain-expert heads</b> by a <b>Λ-governed router</b> (Conjecture 1, advisory floor < 1.0) that reuses
|
| 112 |
+
the active-flux router crossover and the RouteLLM Thompson posteriors — and <b>every expert selection emits a
|
| 113 |
+
signed DSSE receipt</b>.
|
| 114 |
+
</div>
|
| 115 |
+
<div class="honest">
|
| 116 |
+
<span class="k">Honest by design.</span>
|
| 117 |
+
We did <b class="hi">NOT</b> train a foundation model from scratch — there is <b class="hi">no 550B SZL model</b> and
|
| 118 |
+
<b class="hi">no local Nemotron-Ultra</b> (cloud tier only). OUR contribution is the governance layer:
|
| 119 |
+
governed-MoE domain-expert routing, MTP / speculative-decode default, Reflexion + Voyager + τ-bench
|
| 120 |
+
self-improvement, tiered sovereign-local (2-GPU) / cloud-NIM serving, and tamper-evident signed receipts.
|
| 121 |
+
<span class="hi">sovereign:true</span> only with a live per-GPU <code>gpu_reachable</code> probe; the cloud tier is
|
| 122 |
+
always <code>sovereign:false</code>. Every number is <b>MEASURED</b> (live) or <b>ROADMAP</b> — never fabricated.
|
| 123 |
+
Λ = Conjecture 1 (advisory, never a pass/fail oracle); trust < 100%; locked-8 @ c7c0ba17; 0 runtime JS CDN;
|
| 124 |
+
effectors SIMULATED human-on-loop. Fonts via Google Fonts; no runtime logic/3D CDN.
|
| 125 |
+
</div>
|
| 126 |
+
|
| 127 |
+
<div class="cross">
|
| 128 |
+
<span class="muted mono" style="font-size:10px;align-self:center;">CROSS-LINK:</span>
|
| 129 |
+
<a href="/governance">τ-bench & calibration</a>
|
| 130 |
+
<a href="/energy">J/token & sovereign posture</a>
|
| 131 |
+
<a href="/agent-loop">Reflexion / Voyager loop</a>
|
| 132 |
+
<a href="/router-crossover">Active-flux crossover</a>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<div class="cards">
|
| 136 |
+
<div class="card"><div class="lbl">Base (open, cited)</div><div class="big" id="c_base" style="font-size:1.2rem;">—</div><div class="sub" id="c_baselic">—</div></div>
|
| 137 |
+
<div class="card"><div class="lbl">τ-bench (MEASURED-by-SZL)</div><div class="big" id="c_tau">—</div><div class="sub" id="c_tausub">—</div></div>
|
| 138 |
+
<div class="card"><div class="lbl">MTP speedup (S)</div><div class="big" id="c_mtp">—</div><div class="sub" id="c_mtpsub">—</div></div>
|
| 139 |
+
<div class="card"><div class="lbl">Sovereign-local</div><div class="big" id="c_sov" style="font-size:1.2rem;">—</div><div class="sub" id="c_sovsub">live gpu_reachable probe</div></div>
|
| 140 |
+
</div>
|
| 141 |
+
|
| 142 |
+
<!-- GOVERNED-MoE ROUTER -->
|
| 143 |
+
<div class="panel">
|
| 144 |
+
<h2>Governed-MoE Domain-Expert Router <span class="meta">the differentiator · signed every selection</span></h2>
|
| 145 |
+
<div class="desc">
|
| 146 |
+
"Experts" are <b>domain heads</b> (counter-uas / maritime / governance / code / finance) — an <b>auditable MoE</b>,
|
| 147 |
+
not learned FFN experts. Routing fuses the Λ governance score (Conjecture 1) with the active-flux serving
|
| 148 |
+
crossover (small/local ⇄ large/cloud) and the RouteLLM Thompson posteriors. Try a query:
|
| 149 |
+
</div>
|
| 150 |
+
<div class="row">
|
| 151 |
+
<input type="text" id="q" value="intercept a hostile drone swarm with the interceptor"/>
|
| 152 |
+
</div>
|
| 153 |
+
<div class="row">
|
| 154 |
+
<button class="btn" id="go">Route & sign</button>
|
| 155 |
+
<button class="btn ghost" data-q="audit the compliance policy and check the Λ gate and conformal coverage">Governance query</button>
|
| 156 |
+
<button class="btn ghost" data-q="size a finance portfolio with Kelly and Ledoit-Wolf covariance">Finance query</button>
|
| 157 |
+
<button class="btn ghost" data-q="track the vessel via AIS and flag the maritime anomaly">Maritime query</button>
|
| 158 |
+
<span id="r_lambda" class="pill dim">Λ —</span>
|
| 159 |
+
</div>
|
| 160 |
+
<div id="experts"></div>
|
| 161 |
+
<div style="margin-top:.6rem;">
|
| 162 |
+
<div class="meta mono" style="color:var(--dim);font-size:10px;">SIGNED DSSE RECEIPT (route decision)</div>
|
| 163 |
+
<pre class="rcpt" id="r_receipt">—</pre>
|
| 164 |
+
<div class="kv"><span class="k">verify</span><span class="v" id="r_verify">—</span></div>
|
| 165 |
+
</div>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div class="grid2">
|
| 169 |
+
<!-- MTP -->
|
| 170 |
+
<div class="panel">
|
| 171 |
+
<h2>MTP / Speculative Decoding <span class="meta">inference default</span></h2>
|
| 172 |
+
<div class="desc">Speedup <code>S = (k+1) / (k(1−α)+1)</code> (Leviathan et al. 2022). Draft model serves k tokens,
|
| 173 |
+
target accepts at rate α. Reuses Dev C's draft-model wiring; box config is ROADMAP→Forge.</div>
|
| 174 |
+
<div class="kv" id="mtp_kv">—</div>
|
| 175 |
+
</div>
|
| 176 |
+
<!-- SELF-IMPROVEMENT -->
|
| 177 |
+
<div class="panel">
|
| 178 |
+
<h2>Self-Improvement Loop <span class="meta">Reflexion + Voyager + τ-bench</span></h2>
|
| 179 |
+
<div class="desc">Runs the REAL τ-bench (Dev B) for a deliberately weaker baseline, adopts rule-following
|
| 180 |
+
(Reflexion), admits a Voyager skill, re-runs, and <b>signs the measured delta</b>. Score history lives inside receipts.</div>
|
| 181 |
+
<div class="row"><button class="btn" id="si_go">Run one iteration & sign delta</button></div>
|
| 182 |
+
<div class="kv" id="si_kv">—</div>
|
| 183 |
+
<div class="meta mono" style="color:var(--dim);font-size:10px;margin-top:.4rem;">SIGNED DELTA RECEIPT</div>
|
| 184 |
+
<pre class="rcpt" id="si_receipt" style="max-height:150px;">— (run an iteration)</pre>
|
| 185 |
+
</div>
|
| 186 |
+
</div>
|
| 187 |
+
|
| 188 |
+
<!-- TIERS -->
|
| 189 |
+
<div class="panel">
|
| 190 |
+
<h2>Serving Tiers <span class="meta">honest where / sovereign labels</span></h2>
|
| 191 |
+
<div class="desc">sovereign:true ONLY with a live per-GPU <code>gpu_reachable</code> probe (Dev C). The cloud NIM
|
| 192 |
+
frontier tier (Nemotron Ultra) is always <code>sovereign:false</code> — it needs ~768GB VRAM and cannot run on the 2 GPUs.</div>
|
| 193 |
+
<div class="tiergrid" id="tiers">—</div>
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<!-- TAU + CARD -->
|
| 197 |
+
<div class="grid2">
|
| 198 |
+
<div class="panel">
|
| 199 |
+
<h2>τ-bench — MEASURED-by-SZL <span class="meta">Dev B real suite</span></h2>
|
| 200 |
+
<div class="desc">SZL τ-bench-style tool-rule-following suite with negative controls; an always-pass agent scores 0,
|
| 201 |
+
proving non-triviality. NOT the upstream leaderboard.</div>
|
| 202 |
+
<div class="kv" id="tau_kv">—</div>
|
| 203 |
+
</div>
|
| 204 |
+
<div class="panel">
|
| 205 |
+
<h2>Model Card <span class="meta">base cited · what's ours</span></h2>
|
| 206 |
+
<div class="kv" id="card_kv">—</div>
|
| 207 |
+
</div>
|
| 208 |
+
</div>
|
| 209 |
+
|
| 210 |
+
<div class="footer" id="footer">
|
| 211 |
+
SZL-Nemo skeleton · <span id="f_diag">diag —</span><br/>
|
| 212 |
+
Sources: Qwen3-32B (Apache-2.0) · speculative decoding arXiv:2211.17192 · Reflexion arXiv:2303.11366 ·
|
| 213 |
+
Voyager arXiv:2305.16291 · τ-bench arXiv:2406.12045 · RouteLLM (lm-sys) · active-flux crossover IEEE/APEC 911711 ·
|
| 214 |
+
Nemotron via NVIDIA NIM build.nvidia.com. Receipts: DSSE ECDSA-P256-SHA256, verify against /cosign.pub.
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
|
| 218 |
+
<!-- Shared estate modules (0 CDN; same-origin). Honest labels + receipt verify. -->
|
| 219 |
+
<script src="/static/shared/szl_label_engine.js"></script>
|
| 220 |
+
<script src="/static/shared/szl_receipt_cosign.js"></script>
|
| 221 |
+
<script>
|
| 222 |
+
const A="/api/a11oy/v1/nemo";
|
| 223 |
+
const $=id=>document.getElementById(id);
|
| 224 |
+
function esc(s){return String(s==null?'':s).replace(/[&<>]/g,c=>({'&':'&','<':'<','>':'>'}[c]));}
|
| 225 |
+
function fmt(n,d){if(n==null||isNaN(n))return '—';const x=Number(n);return d!=null?x.toFixed(d):String(x);}
|
| 226 |
+
async function getJSON(u,opt){try{const r=await fetch(u,opt);if(!r.ok)return null;return await r.json();}catch(e){return null;}}
|
| 227 |
+
function pill(txt,cls){return `<span class="pill ${cls||'dim'}">${esc(txt)}</span>`;}
|
| 228 |
+
function labelPill(key){
|
| 229 |
+
try{ if(window.SZLLabels&&window.SZLLabels.badgeHTML){return window.SZLLabels.badgeHTML(key);} }catch(e){}
|
| 230 |
+
const k=String(key||'').toUpperCase();
|
| 231 |
+
const cls=(k==='MEASURED'||k==='LIVE')?'green':(k==='ROADMAP'||k==='EXPERIMENTAL'||k==='MODELED')?'yellow':'dim';
|
| 232 |
+
return pill(k,cls);
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
function renderExperts(d){
|
| 236 |
+
const wrap=$('experts'); wrap.innerHTML='';
|
| 237 |
+
(d.experts||[]).forEach(e=>{
|
| 238 |
+
const cr=e.serving_crossover||{};
|
| 239 |
+
const lamCls=e.below_advisory_floor?'yellow':'green';
|
| 240 |
+
const wS=(cr.weight_small_local!=null)?Math.round(cr.weight_small_local*100):null;
|
| 241 |
+
const div=document.createElement('div'); div.className='expert';
|
| 242 |
+
div.innerHTML=
|
| 243 |
+
`<div class="hd"><span class="nm">${esc(e.title)} <span class="muted mono" style="font-size:10px;">${esc(e.expert_id)}</span></span>`+
|
| 244 |
+
`${pill('Λ '+fmt(e.lambda_advisory,3),lamCls)} ${pill(cr.route||'—',(cr.route==='small/local')?'blue':'gold')}</div>`+
|
| 245 |
+
`<div class="det">`+
|
| 246 |
+
`<div><span class="k">matched</span> ${esc((e.matched_keywords||[]).join(', ')||'(low overlap)')}</div>`+
|
| 247 |
+
`<div><span class="k">governance</span> ${esc(e.governance_note||'')}</div>`+
|
| 248 |
+
`<div><span class="k">serving</span> ${esc(cr.route||'—')} · regime ${esc(cr.regime||'—')} · difficulty ${fmt(cr.query_difficulty,3)} · reuse: ${esc((cr.reuse||'').split('(')[0])}</div>`+
|
| 249 |
+
(wS!=null?`<div class="bar"><i style="width:${wS}%"></i></div><div class="muted" style="font-size:10px;">small/local ${wS}% · large/cloud ${100-wS}%</div>`:'')+
|
| 250 |
+
`</div>`;
|
| 251 |
+
wrap.appendChild(div);
|
| 252 |
+
});
|
| 253 |
+
$('r_lambda').textContent='Λ '+fmt(d.overall_lambda_advisory,3);
|
| 254 |
+
$('r_lambda').className='pill '+(d.overall_lambda_advisory>=0.9?'green':'yellow');
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
async function doRoute(q){
|
| 258 |
+
const d=await getJSON(A+"/route",{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({query:q,top_k:2})});
|
| 259 |
+
if(!d){$('experts').innerHTML='<div class="muted mono">route endpoint unreachable</div>';return;}
|
| 260 |
+
renderExperts(d);
|
| 261 |
+
const r=d.receipt||{};
|
| 262 |
+
$('r_receipt').textContent=JSON.stringify(r,null,1);
|
| 263 |
+
// verify the signature against /cosign.pub via the shared verifier
|
| 264 |
+
if(r.signatures&&r.signatures.length&&window.SZLReceipts&&window.SZLReceipts.verifyEnvelope){
|
| 265 |
+
$('r_verify').textContent='verifying…';
|
| 266 |
+
try{
|
| 267 |
+
const v=await window.SZLReceipts.verifyEnvelope(r,{});
|
| 268 |
+
const ok=v&&(v.valid||v.signature_valid);
|
| 269 |
+
$('r_verify').innerHTML=ok?pill('SIGNATURE VALID','green'):pill('signed (server-verify)','blue')+' '+esc((v&&v.detail)||r.honesty||'');
|
| 270 |
+
}catch(e){$('r_verify').innerHTML=pill('signed','blue')+' '+esc(r.honesty||'');}
|
| 271 |
+
}else{
|
| 272 |
+
$('r_verify').innerHTML=(r.signed===false)?pill('UNSIGNED','yellow')+' '+esc(r.honesty||''):pill('signed','blue')+' '+esc(r.honesty||'');
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
async function loadMTP(){
|
| 277 |
+
const d=await getJSON(A+"/mtp"); if(!d){$('mtp_kv').textContent='unreachable';return;}
|
| 278 |
+
$('mtp_kv').innerHTML=
|
| 279 |
+
`<div><span class="k">status</span> ${labelPill(d.label)}</div>`+
|
| 280 |
+
`<div><span class="k">draft → target</span> <span class="v">${esc(d.draft_model)} → ${esc(d.target_model)}</span></div>`+
|
| 281 |
+
`<div><span class="k">k / α</span> <span class="v">k=${d.num_speculative_tokens_k} · α=${d.acceptance_rate_alpha}</span></div>`+
|
| 282 |
+
`<div><span class="k">speedup S</span> <span class="v">${fmt(d.speedup_estimate,2)}×</span></div>`+
|
| 283 |
+
`<div class="muted" style="font-size:10.5px;line-height:1.6;margin-top:.3rem;">${esc(d.honesty)}</div>`+
|
| 284 |
+
`<div class="muted" style="font-size:10px;margin-top:.2rem;">${esc(d.box_status)}</div>`;
|
| 285 |
+
$('c_mtp').textContent=fmt(d.speedup_estimate,2)+'×';
|
| 286 |
+
$('c_mtpsub').textContent='k='+d.num_speculative_tokens_k+' · α='+d.acceptance_rate_alpha+' · '+d.label;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
async function loadTiers(){
|
| 290 |
+
const d=await getJSON(A+"/tiers"); if(!d){$('tiers').textContent='unreachable';return;}
|
| 291 |
+
$('tiers').innerHTML='';
|
| 292 |
+
(d.tiers||[]).forEach(t=>{
|
| 293 |
+
const sov=t.sovereign===true;
|
| 294 |
+
const div=document.createElement('div'); div.className='tier';
|
| 295 |
+
div.innerHTML=
|
| 296 |
+
`<h3>${esc(t.title)} ${labelPill(t.label)}</h3>`+
|
| 297 |
+
`<div class="kv">`+
|
| 298 |
+
`<div><span class="k">where</span> ${pill(t.where, t.where==='gpu'?'green':'blue')}</div>`+
|
| 299 |
+
`<div><span class="k">sovereign</span> ${pill(String(sov), sov?'green':'yellow')}</div>`+
|
| 300 |
+
`<div><span class="k">base</span> <span class="v">${esc(t.base_model)}</span></div>`+
|
| 301 |
+
`<div class="muted" style="font-size:10.5px;line-height:1.6;margin-top:.3rem;">${esc(t.plan)}</div>`+
|
| 302 |
+
`<div class="muted" style="font-size:10px;margin-top:.2rem;">${esc(t.honesty)}</div>`+
|
| 303 |
+
`</div>`;
|
| 304 |
+
$('tiers').appendChild(div);
|
| 305 |
+
if(t.tier_id==='sovereign-local'){
|
| 306 |
+
$('c_sov').textContent=sov?'true':'false';
|
| 307 |
+
$('c_sov').style.color=sov?'var(--green)':'var(--yellow)';
|
| 308 |
+
$('c_sovsub').textContent=esc(t.probe_note||'live gpu_reachable probe');
|
| 309 |
+
}
|
| 310 |
+
});
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
async function loadTau(){
|
| 314 |
+
const d=await getJSON(A+"/tau"); if(!d){$('tau_kv').textContent='unreachable';return;}
|
| 315 |
+
if(d.score_pct==null){
|
| 316 |
+
$('tau_kv').innerHTML=`<div>${labelPill('ROADMAP')} ${esc(d.honesty||'')}</div>`;
|
| 317 |
+
$('c_tau').textContent='—'; $('c_tausub').textContent='not measured'; return;
|
| 318 |
+
}
|
| 319 |
+
$('tau_kv').innerHTML=
|
| 320 |
+
`<div><span class="k">score (pass^1)</span> <span class="v">${fmt(d.score_pct,2)}%</span> ${labelPill(d.label)}</div>`+
|
| 321 |
+
`<div><span class="k">suite</span> <span class="v">${esc(d.suite_id)} ${esc(d.suite_version)}</span></div>`+
|
| 322 |
+
`<div><span class="k">tasks</span> <span class="v">${d.tasks_passed}/${d.tasks_total} · ${d.negative_controls} negative controls</span></div>`+
|
| 323 |
+
`<div><span class="k">as-of</span> <span class="v">${esc((d.as_of||'').slice(0,10))}</span></div>`+
|
| 324 |
+
`<div><span class="k">determinism</span> <span class="v mono">${esc(d.determinism_hash)}</span></div>`+
|
| 325 |
+
`<div class="muted" style="font-size:10.5px;line-height:1.6;margin-top:.3rem;">${esc(d.honesty)}</div>`;
|
| 326 |
+
$('c_tau').textContent=fmt(d.score_pct,1)+'%';
|
| 327 |
+
$('c_tausub').textContent=d.tasks_passed+'/'+d.tasks_total+' · '+(d.as_of||'').slice(0,10);
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
async function loadCard(){
|
| 331 |
+
const d=await getJSON(A+"/card"); if(!d){$('card_kv').textContent='unreachable';return;}
|
| 332 |
+
const ours=(d.what_is_ours||[]).map(x=>`<li>${esc(x)}</li>`).join('');
|
| 333 |
+
const notOurs=(d.what_is_NOT_ours||[]).map(x=>`<li>${esc(x)}</li>`).join('');
|
| 334 |
+
$('card_kv').innerHTML=
|
| 335 |
+
`<div><span class="k">name</span> <span class="v">${esc(d.name)} ${esc(d.version)}</span></div>`+
|
| 336 |
+
`<div><span class="k">base</span> <span class="v">${esc(d.base.default_base)} (${esc(d.base.default_base_license)})</span></div>`+
|
| 337 |
+
`<div class="k" style="margin-top:.4rem;">what is OURS</div><ul style="margin:.2rem 0 .4rem 1rem;color:var(--paragraph);font-size:10.5px;line-height:1.5;">${ours}</ul>`+
|
| 338 |
+
`<div class="k">what is NOT ours</div><ul style="margin:.2rem 0 0 1rem;color:var(--paragraph);font-size:10.5px;line-height:1.5;">${notOurs}</ul>`;
|
| 339 |
+
$('c_base').textContent=d.base.default_base;
|
| 340 |
+
$('c_baselic').textContent=d.base.default_base_license;
|
| 341 |
+
$('framing').textContent=d.base.honest_framing;
|
| 342 |
+
$('b_model').textContent='EXPERIMENTAL · SKELETON · '+esc(d.version);
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
async function loadDiag(){
|
| 346 |
+
const d=await getJSON(A+"/_diag"); if(!d){$('f_diag').textContent='diag unreachable';return;}
|
| 347 |
+
const reuse=d.reuse||{};
|
| 348 |
+
const on=Object.keys(reuse).filter(k=>reuse[k]);
|
| 349 |
+
$('f_diag').textContent='reuse live: '+on.join(', ')+' · signer '+(d.signer_present?'PRESENT':'absent');
|
| 350 |
+
$('signerlbl').textContent=d.signer_present?('signer '+(d.signer_label||'in-image')):'signer absent';
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
async function doSelfImprove(){
|
| 354 |
+
$('si_kv').innerHTML='<span class="muted mono">running real τ-bench baseline + improved…</span>';
|
| 355 |
+
const d=await getJSON(A+"/selfimprove",{method:'POST',headers:{'Content-Type':'application/json'},body:'{}'});
|
| 356 |
+
if(!d){$('si_kv').textContent='unreachable';return;}
|
| 357 |
+
if(d.error){$('si_kv').innerHTML=`<div>${labelPill('ROADMAP')} ${esc(d.error)} — ${esc(d.honesty||'')}</div>`;return;}
|
| 358 |
+
const up=d.delta_pct>0;
|
| 359 |
+
$('si_kv').innerHTML=
|
| 360 |
+
`<div><span class="k">iteration</span> <span class="v">#${d.iteration}</span> ${labelPill(d.label)}</div>`+
|
| 361 |
+
`<div><span class="k">baseline → improved</span> <span class="v">${fmt(d.baseline_score_pct,2)}% → ${fmt(d.improved_score_pct,2)}%</span></div>`+
|
| 362 |
+
`<div><span class="k">delta</span> ${pill((up?'+':'')+fmt(d.delta_pct,2)+'%', up?'green':'yellow')}</div>`+
|
| 363 |
+
`<div><span class="k">voyager skill</span> ${pill(d.voyager_skill_admitted?'ADMITTED':'not admitted', d.voyager_skill_admitted?'green':'yellow')}</div>`+
|
| 364 |
+
`<div class="muted" style="font-size:10.5px;line-height:1.6;margin-top:.3rem;"><b>reflection:</b> ${esc(d.reflection)}</div>`;
|
| 365 |
+
const r=d.receipt||{};
|
| 366 |
+
$('si_receipt').textContent=JSON.stringify(r,null,1);
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
document.querySelectorAll('button.ghost[data-q]').forEach(b=>b.addEventListener('click',()=>{$('q').value=b.getAttribute('data-q');doRoute(b.getAttribute('data-q'));}));
|
| 370 |
+
$('go').addEventListener('click',()=>doRoute($('q').value));
|
| 371 |
+
$('si_go').addEventListener('click',doSelfImprove);
|
| 372 |
+
|
| 373 |
+
(async function(){
|
| 374 |
+
await Promise.all([loadDiag(),loadMTP(),loadTiers(),loadTau(),loadCard()]);
|
| 375 |
+
await doRoute($('q').value);
|
| 376 |
+
})();
|
| 377 |
+
</script>
|
| 378 |
+
</body>
|
| 379 |
+
</html>
|