Skip to content

fix: keep lfm2_audio and lfm3_audio fixed ASR chunks within the cap - #1135

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
Liquid4All:lfm3-asr-fixed-chunk-cap
Oct 29, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
Liquid4All:lfm3-asr-fixed-chunk-cap

Conversation

@ykhrustalev

Copy link
Copy Markdown
Contributor

Problem
Fixed ASR chunking in lfm2_audio and lfm3_audio (audio_chunk_mode=fixed, and auto without the VAD model) merged a last piece shorter than 1 s into the chunk before it, so a chunk could run up to 1 s past audio_chunk_duration_sec. With a 1 s cap, 2.5 s of input went through as 1 s and 1.5 s. With lfm3_audio's default 300 s cap, which equals max_pass_duration_sec, 300.5 s went through the encoder in one pass.

Solution

  • A last piece under 1 s and the chunk before it now split their audio evenly, so no chunk is longer than audio_chunk_duration_sec; earlier chunks keep the full length.
  • Both halves stay at least 1 s with a cap of 2 s or more, and at least half the cap below that.
  • lfm2_audio's docs and audio_chunk_duration_sec description drop the "up to 1 s longer" exception.

Testing

  • ctest -R "lfm2_audio|lfm3_audio" on macOS (M3 Ultra, Metal): 22/22 pass. The new session-test cases fail with the old chunking.
  • The new rule on the real plan_audio_chunks, for caps of 1 to 3 s and every input length up to three caps: no chunk over the cap, and none under 1 s or half the cap, whichever is less.
  • Real weights (LFM3-Audio-2B and LFM2.5-Audio-1.5B, Q8_0) in fixed mode, chunk lengths from the per-chunk audio token logs:
Input Cap main This PR
1.5 s 1 s, both families 1.5 s 0.75 s + 0.75 s
300.5 s 300 s, lfm3_audio default 300.5 s 150.25 s + 150.25 s
300.5 s 30 s, lfm2_audio default 9 × 30 s, then 30.5 s 9 × 30 s, then 15.25 s + 15.25 s

The 300.5 s transcripts keep their length and ending. The fixed column of lfm2_audio's long-audio WER table was not re-run; only its files with a tail under 1 s split differently.

Refs #1119

A last piece under 1 s was merged into the chunk before it, so a fixed
chunk could run up to 1 s past audio_chunk_duration_sec, and past
max_pass_duration_sec when the two are equal (lfm3_audio's default).
The tail and the chunk before it now split their audio evenly.
@0xShug0 0xShug0 added the ready label Oct 29, 2026
@0xShug0
0xShug0 merged commit 6a7673f into 0xShug0:main Oct 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants