#16072·Speech

Chunked long-audio timestamps drift monotonically (2.36 s over 1 hour) because chunk offsets are floor-divided before accumulation

Author: udsy19Created Aug 18, 2026Updated Sep 27, 2026
Labelscommunity-request

Describe the bug

join_char_level_timestamps accumulates per-chunk frame offsets by dividing before summing:

python
# nemo/collections/asr/parts/utils/chunking_utils.py:222-223
chunk_frame_offset = chunk_offsets[i] // subsamp
cumulative_offset += chunk_frame_offset

chunk_offsets[i] is in raw frames, built as encoded_len * subsampling_factor - 100 (line 78), where the -100 removes the 1 s chunk overlap. For the FastConformer/Canary default subsampling_factor = 8, 100 is not divisible by 8, so each chunk floor-divides away exactly 0.5 subsampled frames, always in the same direction. The error accumulates linearly with the number of chunks, so word- and segment-level timestamps drift monotonically earlier through a long file.

The sibling implementation accumulates in raw frames and divides once, with an inline comment explaining exactly this hazard:

python
# nemo/collections/asr/parts/utils/streaming_utils.py:2003-2013
cumulative_offset += self.chunk_offsets[i]
...
'start_offset': word['start_offset'] + cumulative_offset
    // self.subsampling_factor,  # dividing here to avoid error accumulation over long audios

chunking_utils.py does the opposite.

Steps/Code to reproduce bug

python
import torch
from nemo.collections.asr.parts.utils.rnnt_utils import Hypothesis
from nemo.collections.asr.parts.utils.chunking_utils import join_char_level_timestamps

SUB, STRIDE, NCHUNK, ENC_LEN = 8, 0.01, 60, 750       # 60 chunks of ~60 s == 1 hour of audio
chunk_offsets = [0] + [(ENC_LEN * SUB - 100)] * (NCHUNK - 1)   # cf. merge_parallel_chunks:77-80

hyps = [
    Hypothesis(score=0.0, y_sequence=torch.tensor([1]),
               timestamp={"char": [{"token_id": 1, "start_offset": 0, "end_offset": 1, "char": "a"}]})
    for _ in range(NCHUNK)
]

out = join_char_level_timestamps(hyps, chunk_offsets, SUB, STRIDE, merged_tokens=None)
print("current :", out[-1]["start_offset"])
print("exact   :", sum(chunk_offsets) / SUB)

Output:

current : 43483
exact   : 43512.5

The last character is placed 29.5 subsampled frames = 2.36 s too early on a one-hour file, and the error grows without bound with duration.

Expected behavior

The accumulated offset should be sum(chunk_offsets) // subsampling_factor, not sum(o // subsampling_factor for o in chunk_offsets) — accumulate in raw frames and divide once, as streaming_utils.py already does.

Environment overview (please complete the following information)

  • Environment location: Bare-metal (macOS, arm64)
  • Method of NeMo install: from source, current main (d0a07c056)

Environment details

  • PyTorch 2.7.1
  • Python 3.12

Additional context

This only reproduces when subsampling_factor does not divide 100 — the default 8 for FastConformer and Canary. With subsampling_factor=4 the division is exact and no drift appears, which is likely why it has gone unnoticed.

Note that the open PR #15186 ("Parallel chunking feature for RNNT and TDT models") reworks this area but appears to carry the same divide-then-accumulate pattern into the new cumulative_frame_offset code, so the drift would survive that refactor. Worth checking there too.

I have a fix with a regression test ready and would be happy to open a PR.