/** * export/onnx.ts — export a trained {@link EvermindLM} to a runnable ONNX graph. * * Produces a standard causal-LM ONNX `ModelProto`: input `input_ids` [batch,seq] * (int64) → output `logits` [batch,seq,vocab] (float). No KV cache — the model is * stateless and recomputes the full context each step, so a host (onnxruntime-web, * onnxruntime-node, or transformers.js driving the generation loop) re-runs the * whole sequence per token. The graph reproduces the CPU reference forward * EXACTLY: * * • embedding → Gather(emb, input_ids) * • RMSNorm → Mul/ReduceMean/Add/Sqrt/Div/Mul (eps = 1e-5) * • causal → Transpose → Conv(group=D, pads=[K-1,0], kernel reversed) → Transpose * depthwise conv (so out[t] = Σⱼ ker[j]·x[t−j], matching the reference tap order) * • MoE → router MatMul → TopK → Softmax → ScatterElements (dense top-k mask) * → shared FFN + Σₑ combineₑ · expertₑ(x) (numerically identical to * the sparse reference: non-selected experts get combine 0) * • tied head → MatMul(x, embᵀ) * * Opset 18 / IR v8. Weights are emitted as raw little-endian f32 initializers that * are byte-identical to {@link namedTensors} (matmul weights are transposed by a * graph node at runtime, not duplicated on disk). * * Zero dependencies — the protobuf is hand-encoded by {@link ./protobuf}. */ import type { EvermindLM } from "../lm/evermind_lm.js"; /** Build the ONNX bytes for a trained LM. */ export declare function exportOnnx(lm: EvermindLM, opts?: { producerName?: string; producerVersion?: string; }): Uint8Array; //# sourceMappingURL=onnx.d.ts.map