Wan 3D-VAE decode parity on CPU (Swift): pinning the layout contract
Ran Tao (Octoryn Research)
Abstract
A from-scratch Swift CPU reimplementation of the Wan2.1 AutoencoderKLWan decode path reaches cosine 1.0 against the diffusers reference, independently pinning three contracts the video pipeline depends on: the z latent layout, causal-convolution semantics, and temporal-upsample behaviour. This is a single-figure, decode-only correctness anchor, not a throughput or generation-quality result. CPU naive convolution is slow, and the encode side and other VAE variants are out of scope.
Contribution
Claimed. A from-scratch Swift CPU reimplementation of the Wan2.1 AutoencoderKLWan decode path reaches cosine 1.0 against the diffusers reference decode. The value of the result is that it independently pins three layout/semantic contracts that the rest of the video pipeline depends on: the z latent layout (orientation / channel order), the causal-convolution semantics (temporal causality inside the 3D convolutions), and the temporal-upsample behaviour. Because the decode that turns latents into pixel frames is verified in isolation, upstream parity work (encoder, diffusion transformer) can be trusted to compose end to end rather than being undermined at the final hop.
NOT claimed. This is a correctness-validation (parity) result, not a novel algorithm and not a performance result. It does not claim decode throughput — the CPU naive-convolution implementation is explicitly slow. It does not claim perceptual or generation quality: numeric cosine parity against the reference is not a statement about visual fidelity of generated video. It does not cover the encode side, other VAE variants, or any non-decode path. The altitude here is an engineering correctness anchor, not a research advance.
Methods
| Field | Value |
|---|---|
| Hardware | Apple Silicon Mac (Swift CPU) |
| Stack / implementation | Swift CPU reimplementation of AutoencoderKLWan decode |
| Oracle / baseline | diffusers AutoencoderKLWan decode (reference); reference version not recorded in source notes |
| Precision | not recorded in source notes (reference path is fp32 per related pipeline notes; not asserted here) |
| Metric + gate | cosine similarity vs the diffusers reference output; reported value cosine 1.0 |
| Procedure | Reimplement the decode path (3D causal convolutions + temporal upsample), decode an identical latent, and compare the output tensor to the diffusers decode |
| Stimulus / inputs | a z latent fed to the decode; exact latent shape / count not recorded in source notes |
Results
| Measurement | Value |
|---|---|
| Decode output cosine vs diffusers | 1.0 |
No other quantitative measurements (timing, tensor shapes, PSNR, sample count) are recorded in the source note for this decode parity.
Threats to validity / Limitations
- Single reported metric, single configuration. The note records exactly one number (cosine 1.0) from what is structurally a parity smoke test. There is no reported sample size (number of latents / prompts), no variance, and no multi-input sweep — this validates the layout contract, not statistical robustness across inputs.
- Parity is not quality. Cosine 1.0 against the diffusers reference confirms the reimplementation matches that reference's numerics; it says nothing about perceptual quality of generated frames, and it inherits any limitation of the reference itself.
- No throughput claim, and CPU is slow. The implementation uses naive convolution on CPU and is explicitly not a performance vehicle; no timing is recorded here.
- Scope is decode-only. Encode side, other VAE variants, and non-decode pipeline stages are out of scope and untested by this note.
- Precision ceiling / details unrecorded. Reference precision, reference version, exact latent shape, and hardware SKU are not recorded in the source notes; "cosine 1.0" is reported as-is without an explicit numeric tolerance gate.
- Evidence standing. The note documents a single decode-parity figure; treat it as the standing claim rather than a fresh independent re-measurement.
Reproducibility / Provenance
- Implementation: Swift CPU
AutoencoderKLWandecode, validated by cosine comparison against the diffusers reference decode. - Build commands / version pins: not recorded in source notes for this specific decode-parity note.
- Sovereignty: no third-party ML framework is used in the decode path (vendor-native math primitives only).
- Oracle caveat: validate the diffusers reference decode against known-good output before treating engine-vs-oracle parity as meaningful; the parity statement is only as strong as the reference it is compared to.
Claim boundary
The author's explicit scope — what this work does and does not establish — carried over from the Octoryn Research publishing model.
Proves
- A Swift CPU reimplementation of Wan2.1 AutoencoderKLWan decode reaches cosine 1.0 vs the diffusers reference, pinning the z-layout, causal-convolution, and temporal-upsample contracts the video decode path depends on.
Does not prove
- Decode throughput: the CPU naive-convolution path is explicitly slow and no timing is reported.
- Encode-side parity or other VAE variants.
- Perceptual or generation quality: numeric cosine parity is not a statement about visual fidelity.
- Statistical robustness: a single cosine figure is reported, with no sample size, variance, or multi-input sweep.
Applies when
- Verifying the Wan 3D-VAE decode layout and convolution/upsample semantics against the diffusers reference.
Does not apply when
- Reasoning about decode throughput or performance.
- Inferring generation or perceptual quality from numeric parity.
- Encode-side, non-decode pipeline stages, or other VAE models.
Authors
- Ran Tao — Investigation, Writing
Cite this
Citation
Tao, R., Octoryn Research. (2026). Wan 3D-VAE decode parity on CPU (Swift): pinning the layout contract (TR-2026-0024). Octopus Research Institute.
BibTeX
@techreport{oritr20260024,
title = {Wan 3D-VAE decode parity on CPU (Swift): pinning the layout contract},
author = {Tao, Ran and {Octoryn Research}},
institution = {Octopus Research Institute},
year = {2026},
note = {Permanent ID TR-2026-0024. Not peer reviewed.}
}Disclosures
- Funding
- Hardware and infrastructure provided by Octoryn / Octopus Core Pty Ltd.
- Conflicts of interest
- Octoryn ships commercial inference and governance tooling; findings are reported independently.
