TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

[Usage]: Ministral 8B is not more performant than Llama 3.1 8B when handling long inputs

Open ShuaiShao93 opened this issue 9 months ago • 2 comments

System Info

System Information:

  • OS:
  • Python version:
  • CUDA version:
  • GPU model(s): RTX PRO 6000
  • Driver version:
  • TensorRT-LLM version: 1.1.0

Detailed output:

Paste the output of the above commands here

How would you like to use TensorRT-LLM

I heard Ministral 8B uses Sliding Window Attention, while Llama 3.1 8B uses full attention. In this case, the TTFT of Ministral 8B should be much lower compared to Llama 3.1 8B when inputs are long, like 100k tokens. However, when I tested on RTX PRO 6000 with TRTLLM 1.1.0, it's not like that.

15k input, 1 output

Model Checkpoint (quantization) KV cache Avg latency (ms) Avg TTFT (ms) Throughput (tok/s)
Llama 3.1 8B wq_fp8-kv_fp16 FP16 618.88 618.88 24,821
Llama 3.1 8B wq_fp8-kv_fp8 FP8 489.38 489.37 31,389
Ministral 8B wq_fp8-kv_fp16 FP16 664.37 664.36 23,122
Ministral 8B wq_fp8-kv_fp8 FP8 514.99 514.98 29,828

100k input, 1 output

Model Checkpoint (quantization) KV cache Avg latency (ms) Avg TTFT (ms) Throughput (tok/s)
Llama 3.1 8B wq_fp8-kv_fp16 FP16 13,284.20 13,284.19 7,528
Llama 3.1 8B wq_fp8-kv_fp8 FP8 8,111.50 8,111.48 12,328
Ministral 8B wq_fp8-kv_fp16 FP16 15,743.79 15,743.78 6,352
Ministral 8B wq_fp8-kv_fp8 FP8 9,339.25 9,339.24 10,708

You can see, with 15k tokens, the latency are comparable. But with 100k tokens, Ministral 8B is even slower than Llama 3.1 8B. Is this a bug, or configuration issue?

Before submitting a new issue...

  • [x] Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.

ShuaiShao93 avatar Feb 16 '26 17:02 ShuaiShao93

How do I make the engine work?

[02/21/2026-01:52:06] [TRT-LLM] [V] [client] Response reader started
[02/21/2026-01:52:06] [TRT-LLM] [V] [client] Response reader ready to process messages
[02/21/2026-01:52:06] [TRT-LLM] [V] Set Python GC threshold to customized value: 10000
[02/21/2026-01:52:06] [TRT-LLM] [V] [client] Response reader started eagerly during initialization
[02/21/2026-01:52:06] [TRT-LLM] [V] [client] RPC Client initialized. Connected to ipc:///mnt/scratch/pip_build/rpc_test_7257e027-ad41-4db6-b17c-d5ffa3004f3c
INFO:     Started server process [737]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

The server starts, but when I run:

curl -sS http://127.0.0.1:8000/v1/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"llama3_8b_base_engine","prompt":"Say hello.","max_tokens":8,"temperature":0,"top_k":0,"top_p":1.0}'

I get:

{"object":"error","message":"Encountered an error in forwardAsync function: std::bad_cast","type":"BadRequestError","param":null,"code":400}

What am I doing wrong?


I converted and built the engine using:

python3 /workspace/Lama3.1_8B/Llama3.1_8b_convert_to_legacy.py \
  --src /models/Llama-3.1-8B-Instruct \
  --dst /models/llama3_8b_legacy \
  --trust-remote-code
trtllm-build \
  --checkpoint_dir /models/llama3_8b_legacy \
  --output_dir /models/llama3_8b_base_engine \
  --max_batch_size 1 \
  --max_seq_len 3000 \
  --max_num_tokens 6000 \
  --kv_cache_type paged \
  --paged_kv_cache enable \
  --gpt_attention_plugin auto \
  --context_fmha enable \
  --remove_input_padding enable \
  --logits_dtype float16

Then I served it with:

PYTHONUNBUFFERED=1 TENSORRT_LLM_LOG_LEVEL=INFO \
python -m tensorrt_llm.commands.serve serve \
  /models/llama3_8b_base_engine \
  --backend tensorrt \
  --host 0.0.0.0 \
  --port 8000 \
  --max_batch_size 1 \
  --max_seq_len 3000 \
  --max_num_tokens 6000 \
  --tokenizer /models/Llama-3.1-8B-Instruct

I also copied the tokenizer files:

cp -v "$SOURCE"/tokenizer.* \
      "$SOURCE"/tokenizer_config.json \
      "$SOURCE"/special_tokens_map.json \
      "$SOURCE"/generation_config.json \
      "$DEST"/ 2>/dev/null || true

CristyNel avatar Feb 21 '26 02:02 CristyNel

@ShuaiShao93 , Thank you for reporting the issue! As you know, SWA was not working for Ministral model, and #12597 has resolved the issue~

karljang avatar Apr 03 '26 04:04 karljang