We present Midicoth, a lossless compression system that introduces a micro-diffusion denoising layer for improving probability estimates produced by adaptive statistical models. In compressors such as Prediction by Partial Matching (PPM), probability estimates are smoothed by a prior to handle sparse observations. When contexts have been seen only a few times, this prior dominates the prediction and produces distributions that are significantly flatter than the true source distribution, leading to compression inefficiency. Midicoth addresses this limitation by treating prior smoothing as a shrinkage process and applying a reverse denoising step that corrects predicted probabilities using empirical calibration statistics. To make this correction data-efficient, the method decomposes each byte prediction into a hierarchy of binary decisions along a bitwise tree. This converts a single 256-way calibration problem into a sequence of binary calibration tasks, enabling reliable estimation of correction terms from relatively small numbers of observations. The denoising process is applied in multiple successive steps, allowing each stage to refine residual prediction errors left by the previous one. The micro-diffusion layer operates as a lightweight post-blend calibration stage applied after all model predictions have been combined, allowing it to correct systematic biases in the final probability distribution. Midicoth combines five fully online components: an adaptive PPM model, a long-range match model, a trie-based word model, a high-order context model, and the micro-diffusion denoiser applied as the final stage.
Figures & tables
Figure 1: The Midicoth compression pipeline. Each byte passes through PPM prediction, three sequential blending layers (Match, Word, HighCtx), and the micro-diffusion layer (3-step Tweedie denoising with James-Stein shrinkage) before arithmetic coding. All models are updated after encoding (dashed arrow).
Level
Bit
Ctx
Encoding
0
MSB (bit 7)
1
No parent info
1
bit 6
2
Indexed by bit 7
2
bit 5
4
Indexed by bits 7,6
3–7
bits 4–0
4×5=20
Hash of higher bits → 4 groups
Total
27
Table 2
Compressor
Size (B)
Ratio
bpb
Original
152,089
100.0%
8.000
gzip -9
54,191
35.6%
2.851
zstd -19
49,215
32.4%
2.589
xz -9
48,500
31.9%
2.551
Brotli -q 11
46,487
30.6%
2.445
bzip2 -9
43,202
28.4%
2.273
Table 1: Compression results on alice29.txt (152,089 bytes). All classical results directly measured. PAQ8px run at -8L (level 8 with LSTM, v211). CMIX, ts_zip, and Nacrith from published results.
Compressor
Size (B)
Ratio
bpb
Original
100,000,000
100.0%
8.000
gzip -9
36,445,248
36.4%
2.916
bzip2 -9
29,008,758
29.0%
2.321
zstd -19
26,949,726
27.0%
2.156
Brotli -q 11
25,738,596
25.7%
2.059
xz -9
24,862,392
24.9%
1.989
Table 2: Compression results on enwik8 (100,000,000 bytes). Classical compressor values directly measured. Context-mixing and LLM-based results from published benchmarks. † PAQ8px enwik8 figure is for the -12L setting [ 18 ] .
Config
Size
Ratio
Δ
Time
Base PPM
42,672
28.06%
—
0.2s
+ Match
42,429
27.90%
+0.57%
0.4s
+ M+Word
41,980
27.60%
+1.06%
0.5s
+ M+W+HCtx
41,350
27.19%
+1.50%
0.8s
+ M+W+H+Tweedie
40,262
26.47%
+2.63%
3.6s
Total impr.
+5.65%
Table 3: Ablation study on alice29.txt (152,089 bytes). Each row adds one layer to the previous configuration. Δ is the marginal improvement from the previous row.
Config
Size
Ratio
Δ
Time
Base PPM
845,330
28.18%
—
3.1s
+ Match
798,329
26.61%
+5.56%
3.5s
+ M+Word
792,345
26.41%
+0.75%
4.0s
+ M+W+HCtx
772,613
25.75%
+2.49%
5.0s
+ M+W+H+Tweedie
751,174
25.04%
+2.77%
74.1s
Total impr.
+11.14%
Table 4: Ablation study on enwik8_3M (3,000,000 bytes).
Component
alice29
enwik3M
Avg.
Match
+0.57%
+5.56%
+3.07%
Word
+1.06%
+0.75%
+0.91%
HighCtx
+1.50%
+2.49%
+2.00%
Tweedie
+2.63%
+2.77%
+2.70%
Total
+5.65%
+11.14%
+8.40%
Table 5: Marginal contribution of each component across datasets.
File
Size
Ratio
Speed
alice29.txt
152 KB
26.47%
∼ 48 KB/s
enwik8_3M
3.0 MB
25.04%
∼ 60 KB/s
enwik8
100 MB
21.91%
∼ 42 KB/s
Table 6: Compression ratio and speed as a function of input size. All results use the full 5-layer pipeline.
alice29 (152 KB)
enwik8_3M (3 MB)
γ
C
step 0
step 1
step 2
step 0
step 1
step 2
0.500
128
0.0171
0.0044
0.0027
0.0163
0.0029
0.0019
0.200
512
0.0102
0.0039
0.0022
0.0133
0.0024
0.0014
0.059
2048
0.0058
0.0021
0.0014
0.0184
0.0043
0.0024
0.015
8192
0.0002
0.0002
0.0002
0.0205
0.0052
0.0032
Table 7: Weighted mean ∣δ^′∣ (after James-Stein shrinkage) vs. noise level γ , measured across all three denoising steps.