Qyxo-Zhaenivoth-Guard / source /docs /PUBLIC_API_RESULTS.md
PureOne's picture
Publish Qyxo-Zhaenivoth Guard v1.0.0 research release
25c6e75 verified
|
Raw History Blame Contribute Delete
13.1 kB
# Public API v0.2 measured results
`PreparedBank.evaluate` preserves the useful prepared-bank speed advantage when
mass updates arrive as NumPy arrays. After specializing validation of builtin
numbers, four-output Python-list cells also meet the measured threefold gate;
scalar-list cells remain below it. The JSONL interface decodes updates to Python
lists; the array timings do not describe JSONL throughput.
These are measurements of one frozen implementation on one machine, not a new
mathematical novelty claim or a cross-platform performance guarantee. The
filter inherits the conditional IEEE/NumPy contract described in
[FILTER_THEORY.md](FILTER_THEORY.md): an accepted sign is guaranteed under those
premises, and unsafe or inconclusive signs use exact integer fallback. This
run's ordinary cases all used accepted signs. Existing hostile boundary tests
and measurements remain necessary evidence for the fallback path.
## Paired protocol and integrity
The protocol was fixed before timing: cells `(M,P) = (2048,1), (2048,4),
(8192,1), (8192,4)`; seeds 10–19; one policy per fresh mass box; five paired
fresh-box repeats after one excluded warmup. Static values are reused. All
methods see the same finite binary64 values, mass intervals and thresholds.
The policy sequence, both relations, and thresholds strictly inside the value
hull are inherited unchanged from the earlier heldout protocol. Numerical data
and generator/baseline source hashes match `results_holdout.json` for every
case. The two input containers have identical binary64 payloads.
There are ten independent seed groups within each cell. The same seeds are
reused across cells and containers; those groups are not 80 independent
datasets. Method order is shuffled separately for each paired fresh box. Each
method is timed around its whole public call, including mass conversion,
validation, native computation and result assembly. Input arrays or lists are
already supplied in the declared format; their caller-side conversion is not
charged to the operation. Installation, process startup, imports and file I/O
are outside the timing boundary.
The exact peers are prepared GMP rational direct support, prepared integer
sharp endpoint computation followed by the decision, and prepared Python
`Fraction` direct support. The integer endpoint peer stops at the first exactly
valid classical sorted switch; it does not needlessly materialize every vertex
as a rational. The fastest exact peer is chosen per seed using its complete
cost at 1000 updates. GMP won all 80 comparisons. This oracle frontier is a
conservative comparison for QZ, rather than a proposed deployable method
selector. An adaptive certified NumPy/C++ peer has not been measured. Ordinary
uncertified NumPy arithmetic is not an equivalent guarantee contract.
The run checked 7200 coordinate predicates across the five timed methods and
the CLI record path; all agree with integer sharp endpoint decisions. Public
and native filter route counts are each 1200 accepted coordinate decisions,
including excluded warmups, with zero exact fallbacks. No source file changed
during timing. Public constructor cost and every exact peer's static
preparation are charged once in the amortized comparison.
## Algorithm calls
Times are medians across ten seed-group medians. The speedup is the median of
paired seed-group ratios, **not** the ratio of the table's population medians.
Each ratio includes its method's static preparation divided by 1000 updates.
The bootstrap lower bounds use 10,000 resamples of seed groups, fixed bootstrap
seed 871 and one-sided alpha 0.0125, correcting four cells separately for each
declared container. This approximate bootstrap does not establish an eight-cell
joint guarantee or general performance on arbitrary inputs.
| NumPy arrays: M × P | Public call (ms) | Native call (ms) | GMP call (ms) | Paired speedup | Corrected lower bound | 3× gate |
|---|---:|---:|---:|---:|---:|---|
| 2048 × 1 | 0.226 | 0.195 | 2.105 | 9.59× | 7.76× | Pass |
| 2048 × 4 | 0.494 | 0.437 | 4.807 | 10.04× | 8.93× | Pass |
| 8192 × 1 | 0.329 | 0.340 | 8.195 | 24.18× | 20.90× | Pass |
| 8192 × 4 | 1.283 | 1.308 | 20.143 | 15.23× | 14.49× | Pass |
The smallest individual ndarray seed-group ratio was 6.61×. Minimum ratios by
cell were 6.61×, 8.64×, 19.35× and 14.26×. These cells reuse the previous heldout
numerical workloads; the results measure the new interface, rather than adding
new independent numerical validation datasets. The larger speedups than the
earlier tuple-input experiment reflect a different supplied container and its
conversion costs; they should not be treated as an algorithmic improvement.
| Python lists: M × P | Public call (ms) | Native call (ms) | GMP call (ms) | Paired speedup | Corrected lower bound | 3× gate |
|---|---:|---:|---:|---:|---:|---|
| 2048 × 1 | 0.806 | 0.350 | 1.912 | 2.38× | 2.23× | Fail |
| 2048 × 4 | 1.083 | 0.639 | 4.855 | 4.56× | 4.18× | Pass |
| 8192 × 1 | 2.830 | 0.994 | 7.877 | 2.78× | 2.65× | Fail |
| 8192 × 4 | 3.888 | 2.020 | 19.376 | 4.87× | 4.74× | Pass |
Lists pass through element-level public validation. The builtin-number
specialization reduces that cost, but scalar-list calls still fail the
threefold gate. Users seeking the strongest measured fast path should supply
numeric NumPy arrays. The following paired differences describe wrapper and
public validation costs together; they do not isolate a universal fixed
overhead. Differences between population and paired summaries reflect timing
noise and the order of aggregation, rather than negative computational work.
| M × P | Array public−native (µs) | Array public/native | List public−native (ms) | List public/native |
|---|---:|---:|---:|---:|
| 2048 × 1 | 43.0 | 1.33× | 0.461 | 2.36× |
| 2048 × 4 | 10.5 | 1.03× | 0.447 | 1.72× |
| 8192 × 1 | 19.0 | 1.08× | 1.823 | 2.85× |
| 8192 × 4 | 25.0 | 1.02× | 1.924 | 1.91× |
## Preserved initial revision
The initial complete 80-case run is retained as
[results_public_api_initial.json](../benchmarks/results_public_api_initial.json).
Its wrapper source is retained in
[history/public_initial.py](../benchmarks/history/public_initial.py), with
disposable-copy reconstruction instructions in
[history/README.md](../benchmarks/history/README.md).
All list cells failed its threefold gate, and its scalar-list calls were slower
than GMP. The final revision moves exact builtin `float`/`int` checks ahead of
NumPy dispatch and the `Real` abstract-base-class checks. Subclasses and
ambiguous inputs retain strict validation; mappings and unordered sets are
also explicitly rejected, and were absent from the benchmark inputs. Only
`qzguard/public.py` changed
between these runs; numerical kernels, harness, generated/serialized data and
shuffled method orders match. Source hashes and the initial negative evidence
are retained. The strengthening was selected after observing that initial
result, so the final list experiment is an engineering revision on the same
cases, not an independent confirmatory dataset.
| Python lists: M × P | Initial public call (ms) | Final public call (ms) | Initial paired speedup | Final paired speedup |
|---|---:|---:|---:|---:|
| 2048 × 1 | 2.593 | 0.806 | 0.80× | 2.38× |
| 2048 × 4 | 2.963 | 1.083 | 1.77× | 4.56× |
| 8192 × 1 | 9.927 | 2.830 | 0.82× | 2.78× |
| 8192 × 4 | 10.874 | 3.888 | 1.79× | 4.87× |
The initial ndarray paired speedups were 10.52×, 9.99×, 25.01× and 15.40×,
with all gates passing. Array validation takes the same dtype path in both
revisions. Variations in these repeated array timings demonstrate ordinary
measurement noise. The isolated validation microbenchmark is engineering
evidence and does not establish a universal fivefold application speedup.
## Construction, first use and retained state
The public constructor is timed separately, including static value validation
and template creation. First-box columns are static preparation plus the
measured group-median call; they do not include a fresh process or import.
Every table entry is a median over seed groups, so adding two table medians may
not equal the median of their sums.
| M × P | Array setup (ms) | Array first box (ms) | List setup (ms) | List first box (ms) | Estimated public payload (KiB) |
|---|---:|---:|---:|---:|---:|
| 2048 × 1 | 1.984 | 2.192 | 5.378 | 6.255 | 64.9 |
| 2048 × 4 | 1.998 | 2.459 | 7.029 | 8.102 | 160.9 |
| 8192 × 1 | 7.350 | 7.635 | 22.007 | 24.915 | 256.9 |
| 8192 × 4 | 7.770 | 9.122 | 29.498 | 33.319 | 640.9 |
Retained state is an estimate of reachable Python/NumPy payload, not peak RSS
or native allocator accounting. The public estimate counts its owned native
template and wrapper object, excluding the shared NumPy module handle. It is
72 bytes greater than the corresponding native estimate under this estimator.
Exact peer construction and payload estimates are available for every seed in
the raw JSON. GMP setup medians for array inputs were 5.34, 9.42, 21.42 and
39.70 ms, and its corresponding first-box totals were 7.51, 14.32, 29.60 and
59.88 ms. The scalar 2048-row list public first-box total remains above GMP's
5.36 ms, even though its warm call is faster.
## JSONL transport costs
The benchmark separately invokes the actual strict JSON decoder/schema
validation and CLI evaluation/record construction helpers. JSON numbers round
trip to the identical binary64 mass payloads; decoded updates are Python
lists. The JSONL path explicitly uses `backend="filtered"`; the CLI's ordinary
default backend is exact. This is an in-memory boundary: it excludes subprocess
startup, imports, file reads/writes and an OS pipe. It is therefore not a claim
about end-to-end executable throughput.
The table uses the list-input groups; equivalent JSONL payloads were also
measured in the array-input groups and are retained in the JSON. Encode timings
are separate from decode/evaluate and should not be subtracted from algorithm
timings. Output encoding includes the newline.
| M × P | Update size (kB) | Input encode (ms) | Strict decode/schema (ms) | Decode + CLI evaluate (ms) | Output encode (ms) |
|---|---:|---:|---:|---:|---:|
| 2048 × 1 | 77.18 | 1.512 | 1.318 | 2.100 | 0.013 |
| 2048 × 4 | 77.19 | 1.530 | 1.309 | 2.330 | 0.018 |
| 8192 × 1 | 308.47 | 6.252 | 5.355 | 8.077 | 0.021 |
| 8192 × 4 | 308.51 | 6.210 | 5.173 | 8.698 | 0.027 |
One-time static bank JSON decode medians were 2.41, 7.44, 9.96 and 25.88 ms for
payloads of approximately 88.7, 329.8, 354.4 and 1319.3 kB respectively. These
decode costs are separate from `PreparedBank` construction. Initial decode+
CLI-evaluate times were 3.953, 4.204, 14.849 and 15.573 ms; the specialization
improves that application boundary as well. This experiment does not establish
a JSONL speedup over an equivalent exact peer's complete JSONL pipeline.
## Reproduction and limits
From the package root, with benchmark-only dependencies installed:
```bash
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 \
python benchmarks/run_public_api.py
```
The run used Python 3.12.14, NumPy 2.3.5, gmpy2 2.3.1 and
Linux 6.18.44 x86-64/glibc 2.39. Nine logical CPUs were visible; thread
environment variables were each 1 and other agents did no CPU-heavy work
during the exclusive timing window. The measured invocation also supplied
`PYTHONPATH=/workspace/scratch/eb8f8ee30051/tmp/guard_benchmark_deps` for the
benchmark-only GMP installation. That machine-specific path is not required
for public installations.
Raw results: [results_public_api.json](../benchmarks/results_public_api.json).
Harness: [run_public_api.py](../benchmarks/run_public_api.py). The raw result
SHA-256 is
`475163c9b050fa709406493d16c9d87e083f66c6761adeac92108406048aa870`.
The file records source hashes, environment, shuffled method orders, every
paired sample, static construction costs, route counts and historical fixture
identities. Both the historical generator and exact baseline hashes match.
The initial result SHA-256 is
`f714161fa3546edc752a7984871f0b7678eb50de6d978d5c97ac1f6653ed0ded`.
Initial/final `public.py` hashes are respectively
`49fa14aea5f57c7e1b6077ecf72f4fa843fb09a767690fea61ccb6ebabac0567`
and `5cec1400e911977a7d6857e2692b69cccd55f63d37c63069f32050e8d67e42f0`.
The supported performance statement is limited to reused static values,
fresh mass intervals, one policy, these ordinary array-input workloads, this
running-process environment and the measured exact peers. It excludes exact
support margins and witnesses, which force exact work, and does not imply a
gain on cancellation-heavy inputs, tiny banks, many policies on an unchanged
box, repeated full-bank construction or specialized compiled certified peers.
For unchanged boxes with many thresholds, computing exact sharp endpoints
once and caching them remains a strong alternative. The previous negative
constructor, cached-endpoint, boundary-fallback and exploratory real-data
results remain part of the release evidence.