PTWM

Benchmarks

Compression ratios and throughput on real-world models, plus per-feature benchmark tables.

Compression numbers on representative real-world checkpoints.

Setup

  • Corpus
    • openai/gpt-oss-20b — MXFP4-quantized MoE, 13.76 GB raw (FP4 nibbles + E8M0 scales + BF16 layers).
    • nvidia/Llama-3_3-Nemotron-Super-49B-v1_5-NVFP4 — NVFP4-quantized Llama derivative, 31.07 GB raw (FP4 nibbles + FP8-E4M3 scales).
  • Configurations
    • huffman_only — PTWM with the preprocessing graph forced to passthrough; pure byte-Huffman per tensor. Isolates the contribution of the preprocessing graph.
    • microscale_full — PTWM with the production preprocessing graph and the MICROSCALE method enabled.
  • Hardware — CPU-only host, 16 cores, 64 GB RAM.

Compression ratios

Ratio is compressed bytes ÷ raw bytes. Lower is better.

Modelhuffman_onlymicroscale_full
openai/gpt-oss-20b0.88040.8603
nvidia/Llama-3_3-Nemotron-Super-49B-v1_5-NVFP40.90890.9003

Combined-corpus ratio (44.83 GB raw): microscale_full lands at 0.8881.

Throughput

The encode and decode pipelines run across a rayon thread pool. Full-model throughput through the safetensors file integration on a 32-core CPU host:

ModeldtypeEncodeDecode
mistralai/Mistral-7B-v0.1bf1645 MB/s1111 MB/s
openai/gpt-oss-20bmxfp477 MB/s1635 MB/s
nvidia/Nemotron-Super-120B-FP8fp826 MB/s627 MB/s
Qwen/Qwen2.5-72B-Instructbf1624 MB/s793 MB/s

Decode — the model-load hot path — runs at 0.6–1.6 GB/s: every tensor in a shard is decoded across the pool in a single call. Encode favours ratio over speed by trial-encoding the full codec menu per plane; the opt-in compress_safetensors_file(fast=True) mode forces a single codec for a 4–8× encode speedup at parity ratio on float models.

See pipeline validation for the full dtype, scale, memory, and edge-case matrix (including the fast-mode and thread-count dials that bound peak encode memory).

Key findings

  1. Microscaling formats are already near-incompressible at the byte level. Trained FP4 / NVFP4 nibble-packed bytes are close to uniform; no amount of plane-aware coding extracts much further.
  2. The remaining lossless headroom is in the scale plane. The MICROSCALE method's Order-1 ScaleAC codec compresses E8M0 scales to ≈ 0.16 of original. The whole-model effect is bounded by the scale-mass fraction (≈ 5%), which is why the on-disk gain over byte-Huffman is small in absolute terms.
  3. The PTWM preprocessing graph adds value over pure byte-Huffman, but only modestly on microscaling formats. huffman_only (graph forced to passthrough) hits 0.8804 on gpt-oss-20b vs 0.8603 with the full graph — a 2.0 percentage-point delta, most of which is the scale codec; the rest is dtype-aware nibble routing.

On-disk vs. algorithmic size

The numbers above report on-disk .ptwm directory size, including the multi-tensor container header, tensor index, per-plane codec dispatch records, and payload hashes. Container overhead runs roughly 1.6 percentage points on gpt-oss-20b, the price of features the raw entropy coders lack (random access, hash verification, multi-tensor packaging).

For a pure entropy-coder comparison, subtract the container overhead: microscale_full on gpt-oss-20b drops from 0.8603 to roughly 0.844 algorithmically. The on-disk number is reported here because it matches what users measure with du.

Preprocessing ablations

Effect of preprocessing-graph variants on the byte-Huffman ratio across dtypes. Higher ratio is better (compressed bytes ÷ raw bytes is the inverse of huf_ratio).

CategoryModelDtypeAblationVariantBytesN tensorshuf_ratioPlane entropies (bits/byte)
audiofacebook/encodec_24khzfp32A1fp32_reorder_on92,815,360981.07018.00 / 8.00 / 7.97 / 3.25
audiofacebook/encodec_24khzfp32A1fp32_reorder_off92,815,360981.06908.00 / 8.00 / 7.97 / 3.30
visionmicrosoft/resnet-50fp32A1fp32_reorder_on102,011,648541.05888.00 / 8.00 / 7.97 / 2.68
visionmicrosoft/resnet-50fp32A1fp32_reorder_off102,011,648541.05798.00 / 8.00 / 7.97 / 2.75
nlpdistilbert/distilbert-base-uncasedfp32A1fp32_reorder_on267,687,144401.03798.00 / 8.00 / 7.93 / 2.59
nlpdistilbert/distilbert-base-uncasedfp32A1fp32_reorder_off267,687,144401.03728.00 / 8.00 / 7.97 / 2.61
nlpHuggingFaceTB/SmolLM2-135Mbf16A1bf16_reorder_on268,959,7442111.06657.97 / 2.66
nlpHuggingFaceTB/SmolLM2-135Mbf16A1bf16_reorder_off268,959,7442111.06527.97 / 2.74
quantisedRedHatAI/Qwen2-1.5B-Instruct-FP8bf16A1bf16_reorder_on466,747,39211.00007.97 / 2.59
quantisedRedHatAI/Qwen2-1.5B-Instruct-FP8bf16A1bf16_reorder_off466,747,39211.00007.97 / 2.67
quantisedRedHatAI/Qwen2-1.5B-Instruct-FP8fp8-e4m3fnA3e4m3_passthrough1,310,195,7121961.00006.64
quantisedRedHatAI/Qwen2-1.5B-Instruct-FP8fp8-e4m3fnA3e4m3_reorder_only1,310,195,7121961.00006.64
quantisedRedHatAI/Qwen2-1.5B-Instruct-FP8fp8-e4m3fnA3e4m3_nibble_split1,310,195,7121960.50482.70 / 3.98
quantisedRedHatAI/Qwen2-1.5B-Instruct-quantized.w8a8bf16A1bf16_reorder_on934,498,304581.00067.97 / 2.60
quantisedRedHatAI/Qwen2-1.5B-Instruct-quantized.w8a8bf16A1bf16_reorder_off934,498,304581.00057.97 / 2.68

The FP8-E4M3 row (e4m3_nibble_split) demonstrates the dtype-aware nibble routing: splitting the byte into two 4-bit planes drops entropy from 6.64 to ~3.3 bits/byte per plane, yielding a 2× compression ratio on a dtype that is otherwise incompressible byte-wise.

Plane entropy

Per-plane entropy on facebook/encodec_24khz (fp32). The reorder strategy moves the IEEE-754 exponent bits into a dedicated plane, exposing the trained-weight exponent distribution (≈ 3.25 bits/byte) that is otherwise scattered across byte boundaries.

StrategyPlaneEntropy (bits/byte)
rawall7.467
shufflebyte08.000
shufflebyte18.000
shufflebyte27.971
shufflebyte33.301
reordermantissa_lo8.000
reordermantissa_mid8.000
reordermantissa_hi7.971
reorderexponent3.251

Method comparison (synthetic)

Compression ratio and throughput on synthetic uniform-random data across the four high-level PTWM methods. Ratios above 1.0 reflect compression; values at or below 1.0 reflect the method passing through (or in the FP8 cases, the raw input being smaller than the container's per-tensor overhead at 500 kB).

DtypeBytesMethodCompressedRatioCompress (MB/s)Decompress (MB/s)
float322,000,000IDENTITY2,000,3570.9998533.4612.6
float322,000,000HUFFMAN1,673,9151.1948661.01155.0
float322,000,000RANS1,661,8131.2035378.31068.7
float322,000,000ZSTD1,706,9341.1717417.81055.2
bfloat161,000,000IDENTITY1,000,1410.9999543.8933.3
bfloat161,000,000HUFFMAN673,3951.4850462.2753.1
bfloat161,000,000RANS660,4411.5141265.3654.8
bfloat161,000,000ZSTD705,9201.4166331.2750.2
float161,000,000IDENTITY1,000,1410.9999665.91180.4
float161,000,000HUFFMAN847,6031.1798438.5836.5
float161,000,000RANS845,1571.1832263.1656.9
float161,000,000ZSTD848,6121.1784349.2892.6
fp8-e4m3fn500,000IDENTITY1,000,1050.4999283.91077.2
fp8-e4m3fn500,000HUFFMAN410,9811.2166222.9220.9
fp8-e4m3fn500,000RANS406,7541.229296.4176.6
fp8-e5m2500,000IDENTITY1,000,1050.4999346.2913.3
fp8-e5m2500,000HUFFMAN355,7031.4057206.3264.2
fp8-e5m2500,000RANS351,3511.423196.7172.1
int8500,000IDENTITY500,1050.99981266.22276.0
int8500,000HUFFMAN500,1050.9998624.8986.3
int8500,000RANS500,1050.9998236.11762.7
int161,000,000IDENTITY1,000,1410.9999752.2981.8
int161,000,000HUFFMAN1,000,1410.9999428.8894.3
int161,000,000RANS1,000,1410.9999241.3765.0
int322,000,000IDENTITY2,000,3570.9998991.4694.8
int322,000,000HUFFMAN1,938,9451.0315715.3574.7
int322,000,000RANS1,943,5991.0290399.7613.4
int644,000,000IDENTITY4,001,2210.99971110.31019.3
int644,000,000HUFFMAN2,199,6011.8185819.7882.6
int644,000,000RANS2,232,6991.7916561.0809.5

Codec comparison (real models)

Per-codec ratio and throughput on real fp32 models, holding the preprocessing graph fixed at reorder+split for the Huffman and rANS rows and varying the ZSTD prefilter across the rest.

ModelCodecCompressedRatioCompress (MB/s)Decompress (MB/s)
facebook/encodec_24khzHuffman (reorder+split)86,736,6471.0701205.31375.9
facebook/encodec_24khzrANS (reorder+split)86,451,1101.0736119.5928.8
facebook/encodec_24khzZSTD (reorder+split)79,498,2761.1675158.11276.6
facebook/encodec_24khzZSTD (shuffle)79,409,4821.168867.5541.2
facebook/encodec_24khzZSTD (bitshuffle)80,272,7061.1563204.7562.6
facebook/encodec_24khzZSTD (bytedelta)92,818,4961.0000420.9699.9
microsoft/resnet-50Huffman (reorder+split)96,346,8501.0588168.11282.5
microsoft/resnet-50rANS (reorder+split)96,062,9801.0619131.9938.8
microsoft/resnet-50ZSTD (reorder+split)86,884,8591.1741148.41133.0
microsoft/resnet-50ZSTD (shuffle)86,536,6511.178859.7707.5
microsoft/resnet-50ZSTD (bitshuffle)87,549,7481.1652222.4804.0
microsoft/resnet-50ZSTD (bytedelta)102,013,3761.0000559.21094.1

Random-access tradeoff

Per-tensor compression preserves random access but pays a small ratio penalty against monolithic compression. On distilbert-base-uncased the gap is negligible for ZSTD (1.1811 vs 1.1803) and reversed for Huffman and rANS, where the per-tensor coder benefits from dtype-aware preprocessing while the monolithic stream cannot recognise tensor boundaries.

CoderStrategyCompressedRatioCompress (MB/s)
huffmanper_tensor257,921,1691.0379336.2
huffmanmonolithic267,687,1481.0000260.5
ransper_tensor257,426,0231.0399276.4
ransmonolithic267,687,1481.0000203.9
zstdper_tensor226,638,9841.1811278.2
zstdmonolithic226,799,8621.1803209.3

Source data for distilbert/distilbert-base-uncased (267,687,144 raw bytes, 40 fp32 tensors).