Skip to content

[Bug]: A small FLAC audio part decodes to gigabytes in trtllm-serve #20986

Open

Description

@LeizhenZhang

System Info

TensorRT-LLM main (687359e), trtllm-serve with any audio-capable multimodal model. CPU-side issue, no GPU needed to reproduce the decode.

Who can help?

@NVIDIA/trt-llm-runtime-devs (CODEOWNERS for tensorrt_llm/inputs)

Reproduction

Build a FLAC clip of silence and send it in one chat request.

import base64, io
import numpy as np, soundfile as sf

buf = io.BytesIO()
with sf.SoundFile(buf, "w", samplerate=96000, channels=8, format="FLAC", subtype="PCM_16") as f:
    block = np.zeros((96000, 8), dtype="int16")
    for _ in range(600):
        f.write(block)
b64 = base64.b64encode(buf.getvalue()).decode()   # about 465 KiB of FLAC

body = {"model": "<model>", "messages": [{"role": "user", "content": [
    {"type": "input_audio", "input_audio": {"data": b64, "format": "flac"}}]}]}

AudioMediaIO.load_base64 (tensorrt_llm/inputs/media_io.py) calls soundfile.read, which decodes the full clip to float64 before any model-side length check runs.

Expected behavior

The server rejects an audio input whose decoded size is far beyond what any model consumes, before allocating it.

Actual behavior

Measured with the real chat_utils.parse_chat_messages_coroutines and AudioMediaIO:

  • one part: 465 KiB in, 3.43 GiB float64 array out, peak RSS 3.98 GiB, 67 s and 84 s of decode in two runs
  • four audio_url data-URI parts in one request: 13.73 GiB decoded, peak RSS 14.29 GiB

A handful of such requests exhausts host memory on the serving process.

Additional notes

Remote media fetches are capped at 200 MiB of encoded bytes (_MAX_RESPONSE_BYTES). Nothing bounds the decoded audio size. A fix is ready that caps decoded samples per audio input.

Activity

  1. added 4 commits that reference this issue on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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