- make exp / make experiments build the integrated winners (exp/bench + diags; experiments/rans_tool + dict + bchcheck) - make test runs tests/run_integration_tests.sh: clean round-trips for all three ECC codecs, intlv-d64 burst survival + uninterleaved control, bch1k BER survival + as-shipped control, LDPC BER survival, rANS round-trip, dict+lzip round-trip, bchcheck 8-flip recovery and 32-flip expected failure, LZPL v5 archive round-trip - docs/INTEGRATION.md: the four winners with measured numbers, the rejects with numbers, build/test instructions - README.md: Integrated experiments section; branch READMEs carry a pointer to docs/INTEGRATION.md Archive format unchanged (LZPL v5); wiring interleave/LDPC into lzply -e levels would be a format change and is future work.
lzply ECC experiments (branch experiments/ecc)
Integrated onto current main (
experiments/integration, LZPL v5): the winners here are interleaving d64, small-block BCH 1 KiB, and LDPC r90. Polar and UEP were measured, rejected, and their code was NOT carried over — seedocs/INTEGRATION.md.
Open-ended error-correction research on top of lzply's BCH baseline.
Each family implements ecc_iface.h (whole-blob encode/decode) and is
measured by bench.c on the same corpora, same corruption matrix, same
success criterion (exact recovery, memcmp + SHA-256).
How to run
./bench --codec bch-t32 --blob corpora/text.lz --size 65536 \
--trials 200 --ber 1e-3 --nopass2 --out results/x.csv
./bench --codec ldpc-r90 --blob corpora/text.lz --burst 256,1 --trials 200
./bench --codec bch-t32 --blob corpora/text.lz --speed
./ldpc_diag r90 40 50 # single-block error-count sweep
./uep_diag uep-c1024-h32-l8 corpora/text.lz 65536 50 --ber 1e-3
Modes: --ber X (independent bit flips), --burst LEN,COUNT
(COUNT randomized-byte bursts of LEN bytes), --clean, --speed.
--nopass2 skips the (slow) second-chance recovery hook so the matrix
stays fast; run_pass2.sh measures rescue rates separately.
run_matrix.sh <corpus> <size> <trials> <out.csv> <codec...> runs the
full matrix (5 BERs + 5 burst settings + clean), parallel over cores.
Corpora (mkcorpora.sh, generated, not committed): text.lz /
bin.lz / rand.lz — lzip -9 of 4 MiB text, binaries, seeded random
bytes (the compressed blob is what lzply protects); *.raw — the
stored-entry case. Default window is 64 KiB.
Families
| codec | what it is |
|---|---|
bch-t{2,4,8,16,32} |
Baseline: BCH exactly as lzply ships it (auto-pick poly for the whole blob; pass 2 via recover_verified). |
bch1k-t{8,16,32} |
Same BCH, forced m=13 blocks (971 data bytes/block) — the "spend real redundancy" point. |
intlv-d{D}-bch1k-t{T} |
Byte interleaver (depth D) over bch1k-t{T}. Zero extra parity; bursts spread across blocks. Groups merge the short tail (see below). |
ldpc-r{90,95} |
Regular LDPC, PEG construction, min-sum belief propagation. |
polar-r{90,95}[-d{2,3,4}] |
Polar code, SC decoding. -dN is the design crossover 1e-N (default d2 = 1e-2). The design point matters enormously (see below). |
uep-c{C}-h{H}-l{L} |
Unequal error protection: first C bytes at BCH t=H, rest at t=L (small blocks). |
Results (text.lz, 64 KiB windows, 200 trials/setting, hot_newyork)
Recovery rate = fraction of trials exactly recovered. Overhead is measured (stored/data - 1). Pass-2 rescue rates are in results/pass2-text.csv (separate, 25 trials/setting).
Baseline: what lzply ships is nearly unprotected
| codec | ovh | BER 1e-5 | 1e-4 | 1e-3 | 3e-3 | 1e-2 | burst 256 B |
|---|---|---|---|---|---|---|---|
| bch-t2 | 0.01% | 0.11 | 0 | 0 | 0 | 0 | 0 |
| bch-t8 | 0.03% | 0.88 | 0 | 0 | 0 | 0 | 0 |
| bch-t16 | 0.06% | 1.00 | 0 | 0 | 0 | 0 | 0 |
| bch-t32 | 0.12% | 1.00 | 0.01 | 0 | 0 | 0 | 0 |
One 64 KiB blob is a single BCH block (m=20, 80 parity bytes), so t=32 corrects 32 bit errors per 64 KiB. At BER 1e-4 the blob already carries ~52 errors: the cliff is between 1e-5 and 1e-4.
Pass 2 (hash-gated candidates) rescues nothing in practice: the repo's own bch_test reports t+1 recovered 0/100 and t+2 recovered 0/100; this harness's pass2 matrix (35 rows, 875 trials, all BCH codecs) shows rescued=0 in every setting, and a targeted sweep (pass2_diag, m=13 t=16, k=t+1..t+8) rescues 0/50 at every k. Its mechanism (residual-BM) addresses pass-1 miscorrection, which essentially never happens for random errors (pass 1 fails rather than miscorrecting), and the flip-and-redecode fallback does not reach the true codeword. Its demonstrated value is the loud-failure guarantee: 0 silent miscorrections in 7813 checks. The matrix numbers above are therefore the true lzply numbers with or without pass 2.
Spending redundancy: small-block BCH
| codec | ovh | BER 1e-4 | 1e-3 | 3e-3 |
|---|---|---|---|---|
| bch1k-t8 | 1.29% | 1.00 | 0 | 0 |
| bch1k-t16 | 2.62% | 1.00 | 0.73 | 0 |
| bch1k-t32 | 5.40% | 1.00 | 1.00 | 0.01 |
Same code, 1 KiB blocks: t=32 buys survival to BER 1e-3 at 5.4% overhead. Bursts still kill it (256 B burst: 0.00 at every t).
Interleaving: zero-overhead burst protection (WINNER)
Byte interleave over bch1k-t32, 5.40% overhead (unchanged):
| codec | burst 16 B | 64 B | 256 B | 1024 B | 4x64 B |
|---|---|---|---|---|---|
| bch1k-t32 (no intlv) | 0 | 0 | 0 | 0 | 0 |
| intlv-d16-t32 | 1.00 | 1.00 | 0 | 0 | 0.10 |
| intlv-d32-t32 | 1.00 | 1.00 | 0 | 0 | 0.80 |
| intlv-d64-t32 | 1.00 | 1.00 | 1.00 | 0 | 1.00 |
Random-error performance is unchanged by construction (same BCH underneath). Even at 1.29% overhead, intlv-d64-bch1k-t8 survives 64 B bursts at 1.00. Gotcha fixed en route: a short tail group (4 blocks of 68) was the weak point and measured 0.94 on 64 B bursts; groups now merge the tail.
LDPC: the random-error winner (WINNER at ~11% overhead)
| codec | ovh | BER 1e-3 | 3e-3 | 1e-2 | burst 16 B |
|---|---|---|---|---|---|
| ldpc-r90 | 10.94% | 1.00 | 0.97 | 0 | 0.24 |
| ldpc-r95 | 6.25% | 0.32 | 0 | 0 | 0 |
At BER 3e-3, ldpc-r90 recovers 0.97 where bch1k-t32 recovers 0.01 — the iterative decoder's cliff sits a decade higher in BER. But bursts kill it (a 16 B burst is ~64 errors in one 1 KiB block), and r95 is weak: the regular (3,64) code starts failing at 6 errors/block (ldpc_diag). Irregular LDPC would be the follow-up; LDPC+interleave would fix bursts.
Polar SC: dominated, rejected (honest negative)
Designing for p=1e-2 gives 0.00 at BER 1e-4; designing for the operating point (d3/d4) gives 0.90/0.95 at 1e-4 — but every variant is 0.00 at BER 1e-3. SC at N=4096/R=0.9 is far weaker than bch1k-t32 (1.00 at 1e-3, half the overhead) and ldpc-r90 (1.00 at 1e-3, same overhead). Two real bugs were fixed en route (SC partial sums overwrote the leaf decisions; see polar.c). SCL list decoding is the follow-up that could rescue polar; SC as measured is a reject.
UEP: graceful degradation, conditional
Exact recovery is dominated by the weak tier (uep-c1024-h32-l8 at 1e-3: 0.00, same as uniform bch1k-t8). The prefix tells another story (uep_diag, 50 trials):
| codec | BER 1e-3 whole | BER 1e-3 prefix | burst 256 B prefix |
|---|---|---|---|
| uep-c1024-h32-l8 | 0.00 | 1.00 | 1.00 |
| uep-c4096-h32-l8 | 0.00 | 1.00 | 0.94 |
The first 1-4 KiB (lzip header + stream start) survives when the file is lost. Only useful if lzply gains a salvage mode; today the entry SHA gates all-or-nothing extraction.
Speed and memory (isolated, sequential, 64 KiB blob, clean)
--speed mode, 5 reps each. RSS is the bench process peak (harness
- buffers ~6.5 MB); the codec delta is what matters.
| codec | enc MB/s | dec MB/s | RSS KB | ovh |
|---|---|---|---|---|
| bch-t32 | 6.46 | 3.44 | 6564 | 0.12% |
| bch1k-t8 | 9.98 | 5.87 | 6560 | 1.29% |
| bch1k-t16 | 5.39 | 3.14 | 6492 | 2.62% |
| bch1k-t32 | 2.97 | 1.55 | 6652 | 5.40% |
| intlv-d64-t32 | 3.39 | 1.73 | 6720 | 5.40% |
| intlv-d64-t8 | 11.11 | 5.80 | 6572 | 1.29% |
| ldpc-r90 | 3.34 | 0.91 | 7776 | 10.94% |
| ldpc-r95 | 5.18 | 1.16 | 7652 | 6.25% |
| polar-r90-d4 | 4.82 | 0.58 | 7252 | 11.72% |
| uep-c1024-h32-l8 | 9.96 | 4.80 | 6612 | 1.43% |
Interleaving costs nothing measurable (same speed and memory as the BCH underneath; it is a permutation). LDPC pays a one-time ~1.8 s init (PEG + Gauss-Jordan) and decodes ~4x slower than bch1k-t32; polar decodes slowest of all (0.58 MB/s). Failed BCH decodes are far slower than clean ones (pass 2 dominates; matrix rows for failed whole-blob blocks read 0.02-0.10 MB/s).
Generalization
Cross-corpus check (bin.lz, rand.lz, 100 trials/setting, headline codecs, BER 1e-4/1e-3 + 256 B burst + clean) reproduces text.lz exactly for every codec and setting: bch1k-t32 1.00/1.00/0.00, intlv-d64-t32 1.00/1.00/1.00, ldpc-r90 1.00/1.00/0.00, polar-r90-d4 0.94/0.00/0.00, uep-c1024 1.00/0.00/0.00. Clean round-trips are bit-identical everywhere (all clean rows 1.00).
Test totals
- BCH matrix (text.lz): 143 rows x 200 trials = 28,600 trials
- LDPC matrix: 22 rows x 200 = 4,400
- Polar matrix: 33 rows x 200 = 6,600
- UEP matrix: 33 rows x 200 = 6,600
- Pass-2 matrix: 35 rows x 25 = 875 (rescued 0)
- Cross-corpus: 48 rows x 100 = 4,800
- Diagnostics: ldpc_diag single-block sweeps, uep_diag prefix survival (50 trials/setting), pass2_diag targeted sweep (t+1..t+8, 50 trials each)
- Total matrix trials: 51,875 (+ diagnostics)
- hot_chicago verification: BLOCKED — the old-VPS tunnel's SSH leg to 104.225.223.162 failed 4 times over ~1.5 h (banner-exchange timeout on the last attempt). Snapshot zips are staged on the old VPS (/tmp/lzply-*.zip) for a retry when the tunnel recovers.
Rules of this branch
- Never touch
mainor the other coordinator's branches/checkouts. - No Reed-Solomon (the other job's territory).
- No legacy support; the format may change freely.
- Do not break the existing
-rlevels. - Honest negatives count: a family that loses on every axis is killed early and its numbers recorded.
- After every push: zip snapshot to /root/git-backups/lzply/ on both servers (newest 7 kept); use /root/scripts/git-push-snapshot.sh when present, else temp-clone + zip + copy manually.