Skip to main content

GGDLPC

Generalized Gaussian Distribution Linear Predictive Coding — a lossless compression method for scalar-quantized signals, autoencoder latents, and neural network parameter values.

How it works

The core observation is that prediction residuals of many integer-valued signals — particularly quantized autoencoder latents — are well-approximated by a Generalized Gaussian Distribution (GGD). Since the KL divergence between the actual distribution and a fitted GGD is small (~0.75% above the conditional entropy bound), Huffman codes designed for the GGD are near-optimal for the actual data.

Linear prediction removes spatial/temporal correlation: each sample is predicted as a linear combination of causal neighbors, and the prediction residual is entropy coded.

Per-channel parametric model: each channel is described by a small number of scalars:

  • A scale relationship: the GGD scale parameter varies as an affine function of a local activity statistic
  • A shape relationship: the GGD shape parameter β varies as an affine function of log-scale
  • Linear predictor weights and bias

From these scalars, all Huffman tables across ~41 log-spaced context bins are generated analytically at load time — no fitted tables are stored or transmitted.

Embedded run mode: for contexts where the conditional entropy falls below 1 bit (where symbol codes are inherently wasteful), a zero-run mode with elementary Golomb codes recovers the sub-bit rate, with the trigger and order derived from the same parametric model.

Design principles (from LOCO-I/JPEG-LS)

  1. Structure: prediction → context statistic → parametric conditional model
  2. Model cost: few parameters per channel, with the model generating every context's distribution
  3. Sufficient statistics: code selection from a decoder-computable causal statistic — no signaling
  4. Symbol codes only: canonical Huffman + Golomb family — table lookups and shifts, no multiplications, suitable for FPGA and microcontroller targets

Origin

GGDLPC was developed as the entropy coding stage for the FRAPPE family of asymmetric neural codecs (v3+), replacing the off-the-shelf JPEG-LS codec used in earlier versions. It applies to any integer-valued signal with GGD-distributed prediction residuals.

Package

src/GGDLPC/ is the Python package (C coding engine JIT-built on first import; requires a C compiler). One call codes one integer tensor (values in [-N, N], N ≤ 65536 chosen at fit time; rank 1, 2, or 3) as one self-contained byte-padded bitstream, truncatable at any channel boundary. Macroregions, pre-quantization, multi-call file layouts, and metadata are caller compositions.

import GGDLPC
channels, prov = GGDLPC.fit(loader_factory, N=31, rank=2)
codec = GGDLPC.Codec(GGDLPC.new_blob(31, 2, channels, prov))
data, ch_bits = codec.encode(z)      # (C, *S) integers -> bytes
z2 = codec.decode(data, z.shape)     # bit-exact
bits = GGDLPC.proxy_call_bits(z_noisy, codec.blob)  # differentiable rate

Local development install: ./install_for_debugging.sh (builds a wheel, installs into the ~/g venv, runs GGDLPC.selftest()).

Related

  • FRAPPEv5 — autoencoder training code that uses GGDLPC
  • compressors — codec library with FRAPPE v1–v3 inference implementations

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ggdlpc-0.0.1.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ggdlpc-0.0.1-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file ggdlpc-0.0.1.tar.gz.

File metadata

  • Download URL: ggdlpc-0.0.1.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for ggdlpc-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9e9f6a95854ce1bca3bb7ef954d7d73d995b8caea3e5245f14fb8d6e85d2a29f
MD5 9004364556f586622cff95f000b85c06
BLAKE2b-256 14c3aad9f13cf145bbd64138141c58181282d5dc7c31cc7b616e7c8e4ceaea69

See more details on using hashes here.

File details

Details for the file ggdlpc-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ggdlpc-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for ggdlpc-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4240bdec128ee965ea6330964880c57374e568752eeec3c7d3f480f8e1609e63
MD5 f2acc258afa86c39c8232ac930e89fd2
BLAKE2b-256 5f570978287ce8a1e633af43cb591c0b3be3bf427ac526ddc008e8100c02ebcf

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.2

2 files

This release

0.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page