Codec Benchmarks

NVIDIA RTX 6000 Ada · Single stream

MOSS Audio
Tokenizer v2

Decode latency and causal streaming

Whole clips decode up to 227.65× realtime on this GPU. The live decoder emitted each chunk without waiting for future codes.

Read the measurements  ↓

Whole clip · 30 s

227.65× realtime

131.78 ms p50 · BF16 SDPA

Causal · 80 ms chunks

0.86× realtime

93.03 ms steady p50 · BF16 SDPA

Causal · 160 ms chunks

1.68× realtime

93.97 ms steady p50 · BF16 SDPA

Decode latency

48 kHz stereo, batch size 1, 32 codebooks. Realtime multiples divide audio duration by measured decode time. Higher is faster.

Whole-clip decode speed

BF16 codec weights and compute · PyTorch SDPA · synchronized wall p50.
80 ms0.95×
320 ms3.76×
960 ms11.23×
2 s23.02×
6 s67.37×
12 s125.76×
30 s227.65×

What the GPU timings cover

From precomputed codes on the GPU, the 30 s BF16 SDPA decode took 131.78 ms p50. A single 80 ms frame took 84.21 ms p50. Full FP32 SDPA took 70.04 ms for the same single-frame shape.

At 30 s, peak PyTorch tensor allocation was 4,474 MiB with BF16 codec weights and 8,596 MiB with FP32 codec weights and BF16 compute. Both include the loaded encoder and decoder.

Timing starts with GPU-resident codec IDs and ends with GPU-resident waveform output. End-to-end latency also includes token generation or encoding, data transfer, buffering and playback.

BF16 codec weights and compute · PyTorch SDPA
AudioFramesWall p50 (ms)Wall p95 (ms)CUDA event p50 (ms)Peak (MiB)Realtime
80 ms184.2186.3484.184,1260.95×
320 ms485.1487.1385.114,1293.76×
960 ms1285.5286.6285.504,13711.23×
2 s2586.8887.4986.854,15323.02×
6 s7589.0591.6289.034,19667.37×
12 s15095.4296.0595.404,266125.76×
FP32 codec weights, BF16 compute · PyTorch SDPA
FP32 codec weights, BF16 compute · PyTorch SDPA
AudioFramesWall p50 (ms)Wall p95 (ms)CUDA event p50 (ms)Peak (MiB)Realtime
80 ms183.9184.6483.888,2590.95×
320 ms483.9085.2383.878,2593.81×
960 ms1284.5985.5084.568,25911.35×
2 s2585.9286.9585.908,27023.28×
6 s7588.0589.1688.028,31868.15×
12 s15094.6996.3494.678,387126.73×
FP32 codec weights and compute · PyTorch SDPA
FP32 codec weights and compute · PyTorch SDPA
AudioFramesWall p50 (ms)Wall p95 (ms)CUDA event p50 (ms)Peak (MiB)Realtime
80 ms170.0471.0670.018,2481.14×
320 ms470.9872.9270.958,2524.51×
960 ms1271.1281.2771.108,26113.50×
2 s2571.6872.5971.678,27627.90×
6 s7592.4293.0492.408,35264.92×
12 s150152.29153.09152.278,42878.80×

Causal streaming

One codec frame represents 80 ms of audio. The decoder can emit its 3,840 samples per channel as soon as that frame’s codes are available.

New codec framesOrdered code indices
FP32 code lookupQuantizer reconstructs latents
Six decoder stagesUpdate attention history
Stereo PCMAppend samples in order

How much of the chunk budget is used?

Steady wall p95 divided by chunk duration. The white marker is the 100% deadline.
BF16 80 ms121.8%
BF16 160 ms62.2%
BF16 320 ms33.4%
BF16 640 ms15.2%
FP32 80 ms130.4%
FP32 320 ms33.0%

Choosing a chunk size

160 ms was the smallest BF16 chunk that held realtime. All 225 steady full chunks fit the playout window. Adding frames improves throughput and can increase queueing delay when codes arrive one frame at a time.

At 80 ms, FP32 reached 0.80× realtime with 104.33 ms p95 and 456/456 steady chunks above budget.

Persistent decoder · BF16 codec weights and compute · PyTorch SDPA
ChunkFramesFirst p50 (ms)Steady p50 (ms)Steady p95 (ms)Steady over budgetSession speedRMSE vs fullPeak errorSNR
80 ms197.1093.0397.45456/4560.86×0.000690.01240.9 dB
320 ms497.1993.55107.010/1113.35×0.000720.01240.5 dB
640 ms896.8293.6796.990/546.53×0.000740.0240.2 dB

Three warmed sessions per chunk size of the same 12.24 s input. First p50 is measured across fresh state within an already loaded process. Steady p95 uses full chunks after the first, and session speed includes the first and any shorter final chunk. Times use the private frame method to isolate decode in a live context. Context setup, waveform concatenation, code arrival and playback are outside the timed calls. Signal errors compare each concatenated stereo waveform to the unchunked output from the same precision and backend.

Persistent decoder · FP32 codec weights and compute · PyTorch SDPA
ChunkFramesFirst p50 (ms)Steady p50 (ms)Steady p95 (ms)Steady over budgetSession speedRMSE vs fullPeak errorSNR
320 ms4107.76102.09105.480/1113.06×8.5e-085e-06119.0 dB
Public live decode · independent timing check
Codec precisionChunkFirst (ms)Steady p50 (ms)Steady p95 (ms)Steady over budgetSession speed
BF16160 ms101.34100.28102.800/751.58×
FP32320 ms88.9884.6686.610/373.70×

One warmed session per row, timed using model.decode(step, return_dict=True) inside the persistent context. The two series used the same fixture in separate runs. Observed process-to-process timing variation limits direct comparison of wrapper overhead.

Decoder correctness checks

Replace future codes Bit-exact prefix

Replaced all codes after 37 frames. For the common prefix, RMSE 0, peak 0, SNR ∞ dB. The suffix changed by RMSE 0.12.

Decode only the prefix Numerical difference

Compared the first 37 frames decoded alone with the same prefix of the full waveform. RMSE 0.00079, peak 0.024, SNR 39.5 dB.

Live public API Bit-exact helper match

Public incremental decode at 320 ms per call versus the built-in chunked helper gave RMSE 0, peak 0, SNR ∞ dB. Against the unchunked result, RMSE 0.00072, peak 0.012, SNR 40.5 dB.

Copy and restore state Bit-exact resume

Cloned the module-local state after a prefix and restored it into a fresh context. The continuation versus uninterrupted decode gave RMSE 0, peak 0, SNR ∞ dB.

Discard state between calls Negative control

For later 320 ms chunks, fresh context RMSE was 0.14. Clearing only K/V and key positions gave 0.14. Zeroing only attention offsets gave 0.11. Compare with the persistent 320 ms row.

Pause one of two streams State frozen

An inactive slot returned length zero and its cached tensors and offsets were checked bit for bit. Its resumed audio versus the independently decoded slot gave RMSE 0.0011, peak 0.021, SNR 37.6 dB.

FP32 cross-check Bit-exact under mutation

With TF32 disabled, the 320 ms persistent decode versus full FP32 gave RMSE 8.5e-08, peak 5e-06, SNR 119.0 dB. The prefix under same-shape suffix mutation gave RMSE 0, peak 0, SNR ∞ dB. The prefix decoded alone gave RMSE 9.7e-08, peak 3.9e-06, SNR 117.7 dB.

What state to carry

Keep a single streaming context alive for the session. The pinned implementation attaches mutable state to its decoder modules.

Preserve across chunks

  • Attention history. Every decoder attention layer holds RoPE-rotated keys, values and valid key positions. A position of −1 marks an empty slot.
  • Positions and lane state. Keep per-layer and per-lane offsets, execution masks and lane identity. The Transformer stack also maintains offsets, while this configuration uses RoPE at attention. Inactive lanes must freeze their state.
  • Application state. Queue codes until a complete frame is available, track the next PCM sample and retain the original sample count if a last frame needs trimming.
  • Session lifecycle. Enter the context once, feed consecutive frames and exit to reset. Use independent model state or explicitly owned batch lanes for concurrent streams.

State structs · Cache update · Stack positions

Minimal live decode loop

# Each new_codes is a CUDA LongTensor [32, frames] for one lane.
with torch.inference_mode(), model.streaming(batch_size=1):
    for new_codes in code_chunks:
        result = model.decode(new_codes, return_dict=True)
        pcm = result.audio[0, :, :new_codes.shape[-1] * 3840]
        emit(pcm)  # Queue or play [2, samples] immediately.

Use complete code frames. The pointwise quantizer, reshape upsampling and stereo restoration need no additional history or overlap. The chunk_duration convenience argument manages its own context and returns assembled audio, so keep it outside a live context.

Frame decode · Batch helper · Public decode

Per-layer attention windows
StageAttention layersWidthInternal rateCache slotsWindow
1321,28012.5 Hz12510 s
21276825 Hz25010 s
31276850 Hz4008 s
412768100 Hz4004 s
512768200 Hz4002 s
612768400 Hz4001 s

The 92 decoder attention layers retain approximately 84.77 MiB of BF16 K/V and 64-bit key positions per lane when allocated. Weights, transient tensors and allocator overhead are separate. In the 12.24 s test, every attention window rolled over. The first stage retained positions 28–152, with next offset 153. The last stage retained 4496–4895, with next offset 4896. These limits apply layer by layer. Since the windows compose across layers, reconstructing exact state after a restart can require more raw code history than the largest individual window. The checkpoint exposes a context manager for state ownership and reset. Session migration would require exporting and restoring the module-local tensors, offsets, masks and lane mapping. Pinned configuration

Methods and files

Scripts and machine-readable results are embedded in this report for offline access.

Environment

Checkpoint
OpenMOSS-Team/MOSS-Audio-Tokenizer-v2
Revision
f6e20e543b33d2c252a7ef71bdf8aa71e5ff9169
GPU
NVIDIA RTX 6000 Ada Generation
GPU memory
48,509 MiB visible to PyTorch
Runtime
Python 3.12.3 · PyTorch 2.12.0+cu130 · Transformers 5.24.1
CUDA / driver
13.0 / 580.126.09
TF32
Disabled for FP32 cross-checks

Reproduce the run

Run in a CUDA-enabled Python environment matching the versions shown. Install the Python dependencies with the matching PyTorch CUDA build. The default scripts fetch the pinned Hugging Face checkpoint. To reuse a local copy, pass --snapshot /path/to/snapshot.

python -m pip install transformers==5.24.1 accelerate==1.16.0 huggingface_hub==2.4.0 numpy==2.5.2 soundfile==0.14.0
python benchmark_decode.py
python causal_decode.py
python causal_decode.py --public-cross-check
Fixture and timing protocol

Pinned model-card demo, linearly resampled from 24 to 48 kHz, mono duplicated to stereo, frame-aligned, encoded once, then code sequence repeated and cropped for longer cases. Each offline public decode shape had 5 warmups and 30 synchronized timed repetitions. GPU event times are reported alongside host wall time.

The streaming run instead repeated the resampled waveform before encoding 153 frames. The same BF16-encoded IDs were used for both BF16 and FP32 causality checks. RMSE and peak error are in waveform amplitude units. SNR is 20 × log10(reference RMS / error RMS).

The precision labels describe the codec. The quantizer remains FP32 in every setting. The timings use PyTorch SDPA. Native FlashAttention 2 was unavailable in the benchmark environment.

Attention dispatch

A separate profile of a cached 320 ms BF16 step showed aten::_scaled_dot_product_efficient_attention dispatched by PyTorch SDPA. Separate public whole-clip traces dispatched the same operator for BF16 and FP32 at 1, 25 and 375 frames. All latency measurements were taken without profiling.

Primary sources · Pinned Hugging Face model card · Pinned implementation · CAT research paper