Skip to content

gigaam: native streaming for GigaAM-v4 (Zapformer) checkpoints #310

Backlog

Description

@shaba

Problem

GigaAM-v4 has a stateful streaming mode in the reference implementation,
but the port in #285 wires only the offline full-context run path.
Streaming is unavailable end to end.

Evidence

  • src/arch/gigaam/model.cpp:935-939 registers
    stream_validate/begin/feed/finalize/reset = nullptr.
  • capabilities.cpp never sets supports_streaming, so
    transcribe_stream_begin() returns TRANSCRIBE_ERR_NOT_IMPLEMENTED.
  • scripts/convert-gigaam-v4.py:277 writes stt.capability.streaming=false
    and fixes chunk_size=-1 / chunk_window=(-1,-1).
  • reports/porting/gigaam/gigaam-v4-e2e-rnnt/intake.json:156 records
    "streaming": false; docs/models/gigaam.md lists real-time streaming as
    unsupported.
  • The v2 and v3 Conformer checkpoints have no streaming in the reference:
    gigaam/streaming.py was added with v4 on 2026-11-27. Streaming is a
    Zapformer capability; the multilingual-v2 checkpoint is tracked separately
    (see the note below).

Reference behaviour

From gigaam/streaming.py (salute-developers/GigaAM):

  • GigaAMStreaming reads model.cfg["streaming"]["contexts"], a list of
    {future_context_ms, left_context} presets. The v4 card shows
    create_stream(future_context_ms=160); 160/320/640 ms are advertised.
  • chunk_size = future_context_ms / frame_ms (40 ms), plus left_context.
  • ZapformerLayerStreamState caches query, value, mean,
    convolution.
  • EncoderStreamState keeps pending frames, position, the frontend buffer,
    and the per-layer states.
  • transcribe_partial(packet) publishes committed text; flush() drains
    the tail.
  • to_onnx(streaming=True) exports the same graph.
  • The streaming config lives in the checkpoint, so the converted GGUF must
    carry it.

Decisions

  • Cover the released v4 checkpoints that carry streaming.contexts. An
    encoder without that config stays offline. A causal-only variant is a
    follow-up if a checkpoint requires it.
  • GigaAM-Multilingual-v2 carries the same streaming contexts, but porting
    it is a separate model effort (language conditioning, dual heads); it is
    tracked in gigaam: stream GigaAM-Multilingual-v2 (Zapformer, language conditioning) #312. The streaming graph and hooks built here are shared with
    it.
  • The converter writes every advertised context (160/320/640 ms). The graph
    is parameterized by chunk size and left context, so one code path serves
    them all; transcribe_stream_begin uses the smallest advertised context
    by default.
  • GGUF schema, parallel arrays of the same length:
    • stt.gigaam.streaming.future_context_ms (array u32)
    • stt.gigaam.streaming.left_context (array u32)
    • stt.gigaam.streaming.frame_ms (u32, 40)
  • stt.capability.streaming is true only when both arrays are present and
    non-empty.

Work items

  1. Converter/hparams: read streaming.contexts from the checkpoint config
    and write the arrays above; stop hard-coding streaming=false.
  2. Graph: build the Zapformer encoder with chunked attention (left + future
    context) and per-layer KV/conv caches, plus the frontend buffer that
    emits encoder frames per hop.
  3. Decoder: carry the RNN-T state across chunks instead of resetting the
    greedy decoder per chunk; publish committed/tentative text through
    transcribe_stream_get_text().
  4. API: implement the stream hooks and set supports_streaming=true for v4
    GGUFs that carry a streaming config; keep v3 offline.
  5. Tests: golden parity against the reference at 160/320/640 ms on a short
    utterance, plus a streaming smoke like moonshine_streaming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions