Bounded quantum kernels and QAOA
Build checked fidelity kernels and weighted MaxCut QAOA runs with finite inputs, deterministic Worker parity, exact evaluation accounting, and explicit local workload limits.
Quantum kernel and QAOA 0.1 contracts
The two bounded local algorithms publish separate versioned contracts, reject malformed direct API inputs before expensive state work, and expose deterministic numeric and evaluation evidence.
Checked fidelity-kernel pipeline
Angle and IQP encodings cache one finite state per labeled row, build a symmetric bounded Gram matrix, solve a positive-ridge classifier, and provide a checked prediction API instead of losing failures as NaN.
const model = trainNMKernelClassifier(rows, {
encoding: "iqp", qubits: 2, ridge: 1e-3
});
const prediction = predictNMKernelClassifierChecked(model, rows, [0.2, -0.1], {
encoding: "iqp", qubits: 2
});Bounded weighted MaxCut QAOA
QAOA accepts unique weighted edges, one to three layers, GD or seeded SPSA, and a strict step budget. Generated N/M source and runtime results share the same validated ordered graph.
Accepted finite edge weight: 0.000001 through 1000.
const result = executeNMQAOA(
{ nodes: 3, edges: [[0, 1], [1, 2], [2, 0]] },
{ layers: 1, steps: 40, optimizer: "spsa", seed: 19 }
);Fail-closed numeric invariants
Empty or malformed rows, invalid labels, NaN/Infinity, bad ridge/model/query values, invalid graph tuples, duplicate undirected edges, unknown optimizers, and unsafe steps or seeds return structured errors.
Exact evaluation accounting
A kernel records N state encodings and N(N-1)/2 fidelities. GD QAOA records steps×(1+4×layers)+1 circuit evaluations; SPSA records 2×steps+1.
Declared edge-order compatibility
Contract 0.1 preserves declared edge execution order for runtime/source compatibility while rejecting duplicate edges regardless of endpoint direction. Reordering is not silently imposed.
Core, Worker, and package parity
The browser Worker protocol has a first-class qaoa operation; kernel and QAOA results retain the same contract fields through Core, Worker, and clean packed-core consumption.
Stable algorithm guardrails
Kernel and QAOA failures preserve NM-QML-401 and NM-QML-402 while adding structured error kinds for input, encoding/optimization, model, linear-system, and invariant failures.
NM-QML-401NM-QML-402These local simulations do not prove quantum advantage, generalization, optimality on larger graphs, or hardware performance. The contracts intentionally stop at 32 kernel rows, five qubits/nodes, three QAOA layers, and 100 optimization steps.
Hostile direct inputs, analytic kernel properties, XOR/circles classification, approximation targets, seeded determinism, exact Worker equality, clean tarballs, and a maximum 32-row/5-node performance ratchet are automated.