# Paired ratios still need a denominator

This is an exact constructed calculation, not a benchmark of 3L-Cache or any
other real cache policy. It extends the existing artifact review in README.md.

## Question and method

A mean over traces and the total elapsed time of a prescribed serial suite
answer different questions. Let n_i be completed requests and q_bi, q_ci the
average baseline/candidate requests per second over those same requests.
Then t_bi = n_i/q_bi and t_ci = n_i/q_ci. The paired ratio is r_i = t_ci/t_bi.

The arithmetic trace mean is sum(r_i)/k. The suite ratio is
sum(t_ci)/sum(t_bi) = sum(t_bi*r_i)/sum(t_bi).
Its weights are baseline elapsed times, not request counts.
The helper reports both, plus the request-weighted trace mean, raw time totals,
total requests and suite throughput. Every rational is serialized exactly.

Fleming and Wallace (1986), rule 3, distinguish meaningful totals of raw
benchmark times from averages of normalized measurements. Their geometric
mean argument addresses normalization-consistent multiplicative comparisons;
it does not turn a geometric mean into a serial-suite runtime.
https://cgi.cse.unsw.edu.au/~cs9242/19/papers/Fleming_Wallace_86.pdf

## Original new illustration

Two independent runs each complete 1000 requests at one fixed 100-byte cache
configuration and the same objective. Baseline rates 1000 and 10 requests/s
imply 1 and 100 seconds. Candidate X rates 1000 and 5 imply 1 and 200 seconds;
candidate Y rates 250 and 20 imply 4 and 50 seconds.

X has the lower trace mean: 3/2 versus Y's 9/4.
Y has the lower total-time ratio: 54/101 versus X's 201/101.
Request weighting does not rescue the trace mean here: the counts are equal.
No measured policy, hardware result, uncertainty estimate or winner is implied.

For the earlier synthetic panels, the unchanged trace means 3 and 3/2 coexist
with suite ratios 24/11 and 12/11. The old examples.json remains byte-identical.

## Input contract and correction

The previous mean_ratio accepted a mixture of the 100-byte and 10000-byte
panels and returned 9/4. It also trusted the stored ratio without checking its
rates. It now delegates to summarize_panel, which rejects mixed capacities or
objectives, repeated trace IDs even with different request counts, invalid
rates, inconsistent derived ratios and empty inputs. Accepted prior outputs
keep the same rational-string representation. One-shot iterables are accepted.
One pass retains counters plus a set of trace IDs, not a second list of rows.

By default, summarize_panel describes a fixed-byte panel. Its optional
capacity_by_trace map explicitly declares the selected byte capacity for every
trace, permitting footprint-relative designs. Missing/extra trace keys,
mismatched capacities and mixed objectives are rejected. A map documents a
selection; it does not prove that selection is scientifically appropriate.
aggregate in aggregation.py constructs this map from its caller-selected paired
cohort and retains exact per-trace durations and normalized baseline weights.
The pairing helper continues to match exact capacity within every trace pair.

## Boundaries

Rates must cover exactly the recorded completed work, with compatible warm-up,
measurement windows and units. This cannot be established from counts alone.
A sum over independent runs is not the makespan of concurrent requests, and
replaying concatenated traces can change cache state. No CPU-time conclusion
follows without appropriate utilization measurements. Trace selection defines
the suite; a synthetic panel says nothing about workload prevalence.

The split-invariance test only partitions arithmetic ledgers at unchanged
prescribed rates. It does not rerun a cache or assert workload equivalence.
All examples use complete, positive-rate runs. Failures/timeouts must be
handled under a separate explicit protocol, not silently dropped.

## Reproduce

Python 3 standard library only:
```sh
python3 -B -m unittest discover -s . -p 'test_*.py'
python3 -B -c 'import json; from ratios import aggregation_examples; print(json.dumps(aggregation_examples(), indent=2))'
```

aggregation.json is generated by publish.py from aggregation.examples().
Its ranking_comparison member comes from ratios.aggregation_examples().
test_aggregation.py checks 4096 independent raw-time controls, 256 reciprocal
and transitive comparisons, ranking reversal, partitioning, permutation,
invalid inputs and exact large-number arithmetic. This is mathematical
validation, not a cache-simulator replay or replication of the papers.
