Pose-Factored Neural Coding of Vector Shapes That Decodes Identically on Any Hardware

Learned compressors shrink data far more than classical codecs because a neural network supplies the probabilities that the entropy coder uses. Arithmetic coding, the step that turns those probabilities into bits, has a strict requirement: the encoder and decoder must compute exactly the same probabilities. When they run on different chips, tiny floating-point differences break this. Synchronizing Probabilities in Model-Driven Lossless Compression showed that a language-model compressor encoded on an Apple M2 Pro decodes 0% of files correctly on an M4 Max. That paper's fix adds "helper bits" that flag probabilities lying near bin boundaries. It was tested only on one-dimensional text tokens, and only with an 8-billion-parameter model that decodes one token at a time, which is very slow.

This note proposes a codec for vector shapes (font glyphs, icon paths, sketch strokes) that splits each shape into two parts. The first is its pose: position, size, rotation, and the point where the outline starts. The second is its shape once pose is removed. Pose is coded with plain fixed-point arithmetic, so it is bit-exact by construction. Only the pose-free shape goes through a neural probability model, and that model predicts all of a shape's coefficients at once rather than one after another. The claim is that this split does three things together. It lowers the bit rate, because the model no longer spends capacity on pose. It lowers decode latency, because nothing is sequential. And it shrinks the part of the bitstream exposed to cross-hardware divergence to a small, measurable fraction that cheap synchronization can cover.

Core Claim

Geometric invariance is usually treated as a recognition problem. In a codec it is also a way to limit the reproducibility risk. Pose can be computed and coded without any neural network. A shape with pose removed lives on a sphere of complex vectors, the Kendall shape space, and Dictionary Learning for Two-Dimensional Kendall Shapes showed that such shapes are well represented by sparse combinations of complex atoms. On nematode landmarks their method reaches 2.36% reconstruction error, against 4.19% for aligning shapes first and then using an ordinary dictionary.

We make three specific bets. First, a feed-forward encoder can replace their slow iterative sparse-coding step with little loss. This mirrors how Texture Networks and SwiftSketch replaced per-image optimization loops with a single forward pass. Second, a prior over pose-free coefficients that conditions only on one global code can come within a few percent of the rate of a sequential prior. Third, a probability model that decodes all symbols in parallel cannot cascade errors across symbols the way text arithmetic coding does. Helper-bit synchronization in the style of the PMATIC scheme can therefore be applied per symbol, and its overhead can be measured directly as a function of the drift bound.

A useful asymmetry follows from the design. Pose estimation and the amortized encoder run only at the encoder, so their numerical nondeterminism is harmless. The decoder needs exact agreement only on the quantized coefficient probabilities. Everything else it computes from transmitted integers.

Research Program

Each closed path, or each stroke in a sketch, is resampled to $K$ points and written as a complex vector $z \in \mathbb{C}^K$. The pose is computed in closed form:

  • the centroid gives translation;
  • the norm gives scale;
  • the phase of the projection onto a canonical reference gives rotation;
  • the starting vertex is fixed by a deterministic rule on the discrete Fourier phase of the outline. In the turning-function view of Locality Sensitive Hashing for Efficient Similar Polygon Retrieval, the start point is a circular shift. That paper avoids choosing a start by cloning the function $m$ times, where $m$ is the vertex count. We avoid the cloning by fixing one start and transmitting it.

Each pose parameter is uniformly quantized and coded with a fixed integer table. The pose-free shape $\tilde z$ is mapped by a small feed-forward network to a sparse complex coefficient vector $c$ over a learned complex dictionary $D$. The network is trained to match what iterative matching pursuit would produce, and to minimize

$$ L = R(\hat c \mid h) + \lambda \, d\big(\tilde z, D\hat c\big), $$

where $\hat c$ is the quantized coefficient vector, $h$ is a per-file global code transmitted first, $R$ is the bit cost under the neural prior, $d$ is reconstruction distortion, and $\lambda$ sets the rate–distortion trade-off.

The prior factorizes over coefficients given $h$, so the decoder evaluates all probabilities in one batched pass. Those probabilities are snapped to integer cumulative tables. When a probability falls within $\delta$ of a table boundary, a helper bit marks it, following the guarantee in Synchronizing Probabilities in Model-Driven Lossless Compression that $\delta = \epsilon/2$ suffices when cross-device divergence is bounded by $\epsilon$. We measure $\epsilon$ empirically on each device pair and report the helper-bit overhead as a function of $\delta$. That overhead curve has not been measured for spatial data anywhere in the material.

The design draws on prior work in three roles. SVGBuilder motivates it: it already separates component identity from offset and scale. However, its normalization is a bounding-box heuristic that leaves rotation in the shape, it decodes autoregressively, and it does not consider bit rate. RECOMBINER supplies the idea of a global dictionary with compact per-instance codes, but it still fits each instance by gradient descent. Squeeze3D constrains the design: its feed-forward mapping into a generator's latent space is fast but cannot represent shapes outside that generator's range. For this reason we keep an explicit dictionary-and-residual representation rather than a generative bottleneck.

Baselines

The naive reference is the SVG file compressed with brotli and gzip after coordinates are rounded to the same precision our codec reaches. It is deterministic and fast, and any learned codec must beat its size at equal geometric error. Synchronizing Probabilities in Model-Driven Lossless Compression reports Enwik8 ratios of 0.4601 for gzip and 0.3524 for brotli. No reported result was found on Lacuna for either on SVG data, so we will measure both ourselves.

The strongest existing method is the PMATIC pipeline from that same paper, applied to SVG text: a pretrained language model, arithmetic coding, and helper bits. It is the only method in the material that is both neural and reproducible across hardware. Its reported numbers are an Enwik8 compression ratio of 0.0847 and 100% decode success from M2 Pro to M4 Max with $\delta = 0.01$. No reported result was found on Lacuna for it on vector graphics. We run it with the same model families on the same device pair and the same test files, and we report rate at matched rounding precision, decode wall-clock time, and success rate. Beating it means a lower rate at equal geometric error, at least ten times faster decoding, and 100% cross-device success.

The reconstruction reference is Im2Vec. It reports L2 error 0.0284 on FONTS, against 0.0938 for DeepSVG and 0.1322 for SVG-VAE. It is not a codec, so we plot our rate–distortion curve against its fixed point at its latent size in bits. For shape quality per coefficient, the reference is the iterative Kendall dictionary (2.36% error on Dataset 1). Our amortized encoder should come within 10% of that error while encoding at least 100 times faster.

Three ablations isolate the key ingredients. The first removes pose factoring and gives the identical prior raw Cartesian control points, trained with random affine augmentation. The second keeps pose factoring but replaces the parallel prior with a sequential one over coefficients, which isolates the latency and cascade effects. The third removes helper bits, which shows how often cross-device failure actually occurs in this setting.

All learned variants share one training budget, one hyperparameter search size, and five seeds. Following Quantified Reproducibility Assessment of NLP Results, we report the small-sample coefficient of variation across seeds. Exploring Variation of Results from Different Experimental Conditions found seed swings of about 5 BLEU points that dwarf typical claimed gains, so a single seed would not be trustworthy.

Why not just…?

Why not just make the probability model integer-only, so that no synchronization is needed? This is the most serious threat. An integer network is deterministic by construction, and if it loses almost no rate, the helper-bit component is unnecessary. We therefore include an integer-only version of our prior as a full competitor. If it matches the floating-point model's rate within 1% at equal latency, we will report that the pose-factoring and parallel-prior contributions stand alone and drop the synchronization claim. The material gives no measurement of this gap for spatial priors, so the experiment is needed to settle it.

Why not just augment the training data with rotations and scalings instead of factoring out pose? Augmentation teaches a network to cope with pose, but the network still has to spend probability mass, and therefore bits, encoding it. The align-first gap in the Kendall dictionary results (4.19% versus 2.36%) suggests that removing pose properly matters even before rate is considered. The Cartesian-plus-augmentation ablation answers the question directly. The test is whether it pays more bits at matched distortion, and whether its error rises on test shapes rotated beyond the training range while our codec's error stays flat by construction.

Why not just pin containers and run the decoder on the same hardware model? The PMATIC paper's failure appeared across two Apple GPUs running the same software. Archival data and broadcast streams are decoded on hardware the encoder never sees. Data Science at the Precipice argues that only low-friction reproducibility is realistic, which supports the same point. Our no-helper-bit ablation, run on Apple, NVIDIA, and CPU backends, measures how large the problem actually is for this data.

Why not just compress the output of a fast generator such as SVGBuilder? That would accept the generator's token sequence and its sequential decoding as given. It would also inherit rotation inside the shape tokens. We include SVGBuilder token streams compressed with the PMATIC pipeline as an additional point on the comparison plot.

Proposed Experiments

Training and testing use the FONTS glyphs, the Noto emoji and Noun Project icons used by Im2Vec, and ColorSVG-100K paths from SVGBuilder. The Kendall nematode and leaf sets serve as a sanity check on shape error.

For each method we report:

  • rate–distortion curves in bits per path, with distortion measured as control-point error after decoding and as LPIPS on rasterized renders;
  • encode and decode wall-clock time on a laptop GPU and a CPU;
  • decode success rate over all ordered pairs of devices drawn from an Apple M2-class GPU, an Apple M4-class GPU, an NVIDIA GPU, and an x86 CPU;
  • the measured divergence bound $\epsilon$ for each device pair, and helper-bit overhead as a fraction of total rate.

Four outcomes decide the proposal. Pose factoring must lower rate by a clear margin over augmentation at equal distortion, with a gap larger than the seed-to-seed spread. The parallel prior must cost less than 5% extra rate relative to the sequential prior while decoding at least ten times faster. Helper-bit overhead must stay below 2% of total rate while achieving 100% cross-device success. Finally, a rotation stress test must show flat distortion for our codec and rising distortion for the Cartesian baseline as test shapes are rotated beyond the training range.

If the first outcome fails, invariance does not earn its place in the design. If the integer-only competitor ties on rate, the reproducibility contribution reduces to an engineering default, and we will say so.