Native p-means measurements
Compare measured e-means, o-means and p-means on matched native inputs, seeds and execution settings.
Development APIsLater evidence: the three host study adds actual L40 CPU/CUDA measurements and its separate strict Lloyd CPU supplement. The numbers and two host manifest below are retained; statements that L40 was pending describe this earlier study's cutoff.
This study measures native e-means, o-means and experimental p-means using Aner 0.0.10-dev.6. The M2 Max campaign contains 216 configurations and 1,080 timed fits; the V100 PCIe 32 GB campaign adds 324 configurations and 1,620 timed fits. Each configuration has one additional untimed warm up. The public M2 evidence, V100 evidence and comparison manifest retain timings, repeated losses, resolved recipes and input/source/executable fingerprints. These are measured Aner results, separate from upstream H100 claims. New L40 execution remains pending.
Main M2 observation
At 65,536 rows, 32 features, 4,096 centers and three epochs, the median across seeds 42, 43 and 44 is:
| Method | CPU budget: 12 workers | Metal, CPU budget: 4 workers | Final MSE |
|---|---|---|---|
e-means | 735.496 ms | 139.082 ms | 14.584420 |
o-means | 765.864 ms | 211.817 ms | 14.468577 |
p-means | 378.403 ms | 137.278 ms | 14.009819 |
Each timing is the median of three per seed medians, each based on five repeated fits. MSE is the median final per seed loss divided by rows; CPU and Metal losses agree for these observations. The table summarizes several runs, not a single model. The website chart keeps individual seeds separate.
On this case, p-means has approximately the same Metal time as e-means and lower median distortion. It is about 1.54× faster than o-means on Metal and about 2.02× faster with a 12 worker CPU budget. These are fixed budget comparisons of complete default recipes, not speedups at a matched loss. P-means changes probes and closing together; the observations do not isolate the effect of its closing policy.
The advantage is not universal. At 16,384 rows and 4,096 centers, p-means reduces time relative to o-means but has higher distortion. At 8,192 rows, 1,024 features and 128 centers, e-means is both faster and lower in median distortion than p-means. Small inputs favor CPU execution. Keep all three methods available and evaluate the relevant quality/time tradeoff.
Matched M2 and V100 GPU observations
Both platforms use the same compiled source fingerprint, input hashes, Float32 arithmetic policy and resolved controls. Every one of the 54 matched Metal/CUDA configurations records exactly the same final loss. Within each V100 configuration, all five fits also produce the same loss. These observed agreements do not establish a general bitwise guarantee across arbitrary hardware and inputs.
Shape (N,D,k) | Method | M2 Metal milliseconds | V100 CUDA milliseconds | Median final MSE |
|---|---|---|---|---|
(2048,16,32) | e-means | 86.822 | 18.672 | 5.788248 |
(2048,16,32) | o-means | 15.561 | 4.805 | 8.412811 |
(2048,16,32) | p-means | 18.284 | 5.814 | 8.681518 |
(65536,32,4096) | e-means | 139.082 | 69.647 | 14.584420 |
(65536,32,4096) | o-means | 211.817 | 200.991 | 14.468577 |
(65536,32,4096) | p-means | 137.278 | 148.183 | 14.009819 |
(8192,512,128) | e-means | 28.934 | 9.518 | 303.186332 |
(8192,512,128) | o-means | 103.266 | 112.654 | 299.329242 |
(8192,512,128) | p-means | 71.780 | 60.247 | 262.388272 |
(8192,1024,128) | e-means | 40.687 | 15.409 | 612.110170 |
(8192,1024,128) | o-means | 180.966 | 220.088 | 649.485679 |
(8192,1024,128) | p-means | 119.905 | 129.765 | 670.013864 |
Each entry is the median of the three per seed medians; both GPU paths use a four worker host CPU budget. Fit includes host coordination, so this compares complete M2 and V100 systems, not isolated GPU silicon. On the large case, p-means is about 1.36× faster than o-means on V100 with lower median distortion, while e-means is faster than both. At 512 features p-means has lower median distortion than e-means, but needs more time; at 1,024 features e-means is faster and lower in distortion. The retained results do not support a universal method or device winner.
V100's host has 24 reported guest logical CPUs on an Intel Xeon Gold 6248. Its campaign measures CPU budgets 1/4/8/12/24 on every shape, plus CUDA4. These are additional configurations, not an assertion that every phase uses all requested workers. For the large case, median CPU24 fit times are 1,912.623 ms e-means, 1,310.050 ms o-means and 754.355 ms p-means. The portable generic x86 to 64 build is deliberately not a host tuned AVX2/AVX512 result. More workers also add overhead on small inputs; retain the complete curves rather than assuming the largest budget wins.
Separate Lloyd K-means observation
A fresh strict Lloyd supplement uses the same dev.6 benchmark executable and the same small input hash: 2,048 rows, 16 features and 32 centers. It records seeds 42/43/44, one warm up and five timed fits per configuration, for 12 configurations and 60 timed fits. It runs after the e/o/p campaign, with no concurrent website builds or browser tests.
| Requested CPU workers | Median of per seed fit medians | Median final MSE |
|---|---|---|
| 1 | 28.864 ms | 10.983158 |
| 4 | 8.028 ms | 10.983158 |
| 8 | 5.769 ms | 10.983158 |
| 12 | 4.997 ms | 10.983158 |
The matching V100 host CPU supplement adds 15 configurations and 75 timed fits, with the same input, seeds and numerical/iteration contract:
| Requested CPU workers | V100 host median of per seed fit medians | Median final MSE |
|---|---|---|
| 1 | 87.464 ms | 10.983158 |
| 4 | 23.529 ms | 10.983158 |
| 8 | 12.541 ms | 10.983158 |
| 12 | 9.883 ms | 10.983158 |
| 24 | 9.149 ms | 10.983158 |
These are host CPU measurements; there is no Lloyd GPU implementation in this study. The portable x86 build and M2 build have distinct executable identities. Equal displayed MSE does not establish a general cross platform numerical guarantee.
This Lloyd configuration has a three iteration cap, zero movement tolerance and a 64 MiB workspace cap. It materializes the Float32 generated observations as Float64 and uses coordinate ordered hypot distances, exact means and exact accumulated squared computed distances. Its initialization and numerical contract differ from the stochastic methods. The times are therefore a separate execution observation, not an equal quality algorithm speedup. Requested worker budgets do not establish physical core affinity.
The frozen harness does not record Lloyd's completed iteration count or actual charged workspace. Its raw updates=0 and workspace_bytes=0 are placeholders; its max_workspace_bytes field echoes unused stochastic options. The supplement retains those original records and explicitly corrects their interpretation in metadata. Larger shared cases exceed Lloyd's existing 50 million coordinate work admission cap at this iteration budget; wide cases also exceed its one million input element limit. These limits were retained. See the full Lloyd study for serial versus parallel fits, prediction, completed iterations and their separate historical identity.
Measurement design
| Case | Rows | Features | Centers | CPU worker budgets |
|---|---|---|---|---|
| small | 2,048 | 16 | 32 | 1, 4, 8, 12 |
| medium | 8,192 | 32 | 64 | 1, 4, 8, 12 |
| large k | 16,384 | 32 | 4,096 | 1, 4, 8, 12 |
| large | 65,536 | 32 | 4,096 | 1, 4, 8, 12 |
| wide 512 | 8,192 | 512 | 128 | 4 |
| wide 1024 | 8,192 | 1,024 | 128 | 4 |
Every M2 case uses e/o/p-means, seeds 42/43/44 and Metal with a four worker host budget. V100 uses those same shapes/seeds/algorithms with CPU budgets 1/4/8/12/24 and CUDA4 on each shape. Worker numbers are requested budgets; smaller jobs can use fewer workers. Each configuration runs serially in its own process, with one warm up and five measured fits. No website builds or browser tests were run on M2 during its accepted timing window. V100 correctness, sanitizer work and compilation completed before its serial timing phase.
Input is the existing seeded-uniform-blobs-v1 synthetic generator, with canonical row major little endian Float32 SHA256 hashes. Generation and input upload occur before timing. The original four shapes retain their previous input hashes; wide cases add dimensions without claiming to reproduce the original high cluster count H100 workloads.
Total fit timing includes initialization, index maintenance, training, closing, exhaustive final assignment, output construction and backend/scratch destruction. It excludes generation, input hashing/upload and returned model destruction. The evidence retains individual times rather than only a speedup. MSE means inertia / rows, not error divided by the number of coordinates. Feature scale and dimension affect its magnitude.
All methods use the same native Float32 engine and seeded initialization/permutation policy. Each retains its documented automatic batch and step recipe. P-means defaults to four probes, capped by cells, and a closing length of 0.5; o-means uses its own probe policy and last pass closing at this three epoch budget. No validation search or dataset specific tuning was performed for this comparison.
Every repeated fit in each configuration produced the same loss. All 54 paired CPU-four-worker/Metal configurations produced identical recorded final losses in this campaign. These observed agreements are not a general bitwise portability guarantee for arbitrary inputs or future hardware.
Numerical correction and historical evidence
The multi seed investigation exposed a rounding policy mismatch: Metal safe math permitted fused multiply/add expressions, while the CPU and CUDA paths disabled contraction. A separate GPU update evaluated an interpolation even when its rounded occupancy fraction was one, where CPU used the exact batch mean. Both can affect near ties and later training trajectories.
Dev.6 explicitly disables Metal contraction using #pragma METAL fp contract(off) and aligns the unit fraction GPU shortcut with CPU. Exact regression fixtures distinguish a one ULP distance tie from a fused winner and a batch mean of one from cancellation to zero. The previously divergent small e-means seed 44 now matches the CPU loss. Apple Metal specification, section 1.6.3.
The interrupted preliminary dev.5 observations were preserved separately and excluded from this report. Historical dev.4 M2/V100 evidence and the existing dev.4 L40 package retain their original bytes and identities. Their original no contraction description overstates the Metal policy; the comparison guide carries a dated correction. Historical CUDA results are not qualification of the new dev.6 executable.
Build and validation
The measured machine has 12 CPU cores and 64 GiB unified memory. The Release build uses Apple clang 21.0.0, the compatible apple-m1 CPU baseline, native Metal Float32 and LTO disabled. Input, package and host discovery are outside the timed interval. Public evidence excludes private host/user paths without changing numeric observations.
| Identity | Value |
|---|---|
| Runtime | 0.0.10-dev.6 |
| Compiled source SHA256 | 648fe42e52ea5c6f62857fcb10aa416a832147e374bf3af03b156b383e601db3 |
| Benchmark executable SHA256 | 78ad933df0fb3f3ac3dff0cdf9a332e6899a87387522391d5d976ce1dd1ea127 |
Validation passed 15,724 public CPU/Metal clustering checks, 152 additional dedicated p-means Metal oracle checks, exact GPU arithmetic fixtures and 11 selected native CTest suites. Validation also includes language controls, existing K-means and Tensor regressions, 21 final offline runner lifecycle/packaging tests and 16 recorder tests. Nine guide/example programs ran successfully, including both p-means examples, both standalone p-means snippets and both all method execution snippets. The model reference, editor suite and explicit CLI source/guide review passed.
The recorder rejects mismatched builds, inputs, recipe controls and malformed observations; it preserves failed or interrupted cases rather than silently omitting them. These correctness and tooling tests do not constitute V100/L40 execution evidence.
Actual V100 qualification
The public qualification receipt records the separate successful V100 campaign, with phase dates, return codes and original log fingerprints. Both the original build and the final portable stage passed CPU/CUDA correctness, the language suite, an explicit p-means CUDA program and NVIDIA Compute Sanitizer memcheck, racecheck and synccheck. No sanitizer errors were reported. The exact final shared CUDA example and three method Iris workflow also ran successfully afterward.
The measured portable stage was audited for its ELF dependency closure, relative runtime search path, glibc compatibility and both sm70/sm89 code. It uses GCC 13.4, CUDA 12.9.86, Release, no LTO and a generic x86 to 64 CPU baseline. Its benchmark SHA256 is 9fa07bb8e94f9eaf16a6f679adebad2de252f2f05053444afe92fb3198812104. The measured GPU is a V100 PCIe 32 GB with driver 580.178.04. GPU identity and idle state were checked around the serial benchmark. Native compilation and sanitizer instrumentation were outside the measured fits.
All six main cases succeeded; the largest case took 1,435.658 seconds of campaign wall time, including warm ups and recorder overhead. The new L40 package therefore uses a 3,600 second per case limit and a 14,400 second campaign limit. Those are bounded execution allowances, not predicted L40 timings. It includes six e/o/p cases and a separate optional small Lloyd CPU phase. The existing dev.4 L40 artifacts retain their original bytes and limits.
Reproduce and prepare other GPUs
Use tools/run_clustering_comparison.py with the matching native benchmark executable. The default four shapes use --case all; wide shapes are explicit cases. Select --algorithms e-means o-means p-means, --seeds 42 43 44, three epochs and five repetitions. Choose a fresh output path; the recorder refuses to overwrite earlier evidence. The compiled identity must match the source snapshot.
V100 and L40 comparisons require CUDA binaries qualified from this source. The source only comparison kit supplies the frozen source, M2 reference, hashes and an offline build procedure targeting CUDA 12.9 with sm70/sm89. A source only kit contains no prequalified Linux binaries. The separate prebuilt kit builder packages exact qualified binaries with their runtime libraries, notices, build provenance and a detached runner. Add each target's full admitted CPU allocation as a separate configuration while retaining the common worker budget subset. The portable Linux build uses a generic x86 to 64 CPU baseline; it does not measure the maximum throughput of a host tuned Xeon build.
Use fresh campaign paths and preserve the existing dev.4 L40 batch. New dev.6 L40 execution remains pending; preparing an sm89 binary does not qualify it on L40 hardware. No driver replacement is required by the package. Paper scale inputs remain subject to the documented Tensor, coordinate work and workspace admission limits.
See the Machine learning module reference for the shared API.
Time and quality, side by side
These observations come from the retained native run on Apple M2 Max with Aner 0.0.10-dev.6. Select a workload to compare the same dimensions, cluster count, epoch budget and seed.
2,048 rows · 16 dimensions · 32 clusters · 3 epochs · seed 42 · Float32 input
| Configuration | MSE | Inertia | Timing runs |
|---|---|---|---|
| e-means · Metal + CPU budget: 4 workers · Float32 | 6.72130 | 13765.2 | 5 |
| o-means · Metal + CPU budget: 4 workers · Float32 | 11.1275 | 22789.0 | 5 |
| p-means · Metal + CPU budget: 4 workers · Float32 | 11.1406 | 22816.0 | 5 |
MSE: inertia / n; sum of backend precision squared coordinate distances per observation. Read distortion alongside elapsed time. A faster run with a larger error is a different tradeoff; this chart does not establish a speedup at equal quality.
Each selected seed is shown separately. These observations use Aner's shared native engine; they do not reproduce the upstream H100 comparison. Resolved batch and probe settings can differ across methods, so this is a comparison of complete recipes. CPU counts are requested worker budgets; small jobs may use fewer workers. Quality shown is from the final timed fit; every timing and inertia repetition is retained in the evidence.
Resolved controls and input provenance
| Configuration | Probes / cells | Closing | Batch | Initial α |
|---|---|---|---|---|
| e-means · Metal + CPU budget: 4 workers · Float32 | 0 / 0 | Last pass | 16 | 0.0582655 |
| o-means · Metal + CPU budget: 4 workers · Float32 | 16 / 16 | Last pass | 128 | 0.378847 |
| p-means · Metal + CPU budget: 4 workers · Float32 | 4 / 16 | Recency L=0.5 | 128 | 0.378847 |
Input SHA256: 698db4434ad2cfda96964d58e26b3a07e7c8f4899a5ba1eefd621dfeab0ba538
Compiled source SHA256: 648fe42e52ea5c6f62857fcb10aa416a832147e374bf3af03b156b383e601db3
The raw report also preserves recipe identifiers, revival thresholds and the executable identity. The common seed is an experiment identifier; it does not guarantee identical final centers across methods.
Compare time and distortion across hardware
These retained runs use matching input hashes, dimensions, seeds and algorithm controls from the same compiled source. Each report retains its native executable identity and arithmetic.
2,048 rows · 16 dimensions · 32 clusters · 3 epochs · seed 42 · Float32 input
| Configuration | MSE | Median ms | Inertia | Timing runs |
|---|---|---|---|---|
| Apple M2 Max · e-means · Metal + CPU budget: 4 workers · Float32 | 6.72130 | 88.399 | 13765.2 | 5 |
| Apple M2 Max · o-means · Metal + CPU budget: 4 workers · Float32 | 11.1275 | 15.588 | 22789.0 | 5 |
| Apple M2 Max · p-means · Metal + CPU budget: 4 workers · Float32 | 11.1406 | 18.284 | 22816.0 | 5 |
| Tesla V100-PCIE-32GB · e-means · CUDA + CPU budget: 4 workers · Float32 | 6.72130 | 18.84 | 13765.2 | 5 |
| Tesla V100-PCIE-32GB · o-means · CUDA + CPU budget: 4 workers · Float32 | 11.1275 | 4.805 | 22789.0 | 5 |
| Tesla V100-PCIE-32GB · p-means · CUDA + CPU budget: 4 workers · Float32 | 11.1406 | 5.834 | 22816.0 | 5 |
MSE is inertia divided by the number of observations. Read it alongside elapsed time: these runs do not establish a speedup at equal quality or a general ranking of hardware. The default α calculation may differ by a few units in the last place across system math libraries; the pairing audit allows a tolerance of 10⁻¹² and preserves both recorded values.
This comparison retains Aner 0.0.10-dev.6 and shows each seed separately. CPU counts are worker budgets. Quality is from the final timed fit; each report retains every repeated loss. Methods use different complete recipes, while each method's controls and closing policy are paired across platforms.
Input and build provenance
Input SHA256: 698db4434ad2cfda96964d58e26b3a07e7c8f4899a5ba1eefd621dfeab0ba538
Compiled source SHA256: 648fe42e52ea5c6f62857fcb10aa416a832147e374bf3af03b156b383e601db3
CPU worker counts may differ across machines. Each GPU configuration uses four host workers. Exact recipes, resolved controls, raw timing runs and executable hashes are retained in each report.
K-means across CPU worker budgets
CPU execution on the Apple M2 Max machine with Aner 0.0.10-dev.6. This Lloyd engine uses exact accumulation and an iteration cap; it is a separate numerical experiment from the Float32 e/o/p series.
2,048 rows · 16 features · 32 centers · at most 3 Lloyd iterations · seed 42
| CPU budget | MSE | Median ms | Inertia |
|---|---|---|---|
| 1 worker | 10.98316 | 29.690 | 22493.51 |
| 4 workers | 10.98316 | 8.005 | 22493.51 |
| 8 workers | 10.98316 | 6.248 | 22493.51 |
| 12 workers | 10.98316 | 5.477 | 22493.51 |
Float32 input is widened for Float64 computation. The configured workspace cap is 64 MiB. Completed iterations and actual charged workspace were not captured by this frozen harness; its zero placeholders do not mean zero work or memory. A three iteration cap is not three e/o/p epochs or an equal quality target.
Inspect the Lloyd evidence and field corrections