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

[Bug]: Garbage output with modelopt FP8 checkpoint in 1.2.0: use_fp8_context_fmha forced True, regression from 1.1.0

Open langzhao-netizen opened this issue 7 months ago • 6 comments

System Info

  • TensorRT-LLM version: 1.2.0
  • Model: LLaMA-3.1-8B-Instruct, LLaMA-3.2-3B-Instruct
  • Checkpoint: produced by NVIDIA modelopt, kv_cache_quant_algo: "FP8" in config
  • GPU: NVIDIA L4 (SM 89)

Who can help?

No response

Information

  • [ ] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

Checkpoint config.json: { "quantization": { "quant_algo": "FP8", "kv_cache_quant_algo": "FP8" } }

Build:
trtllm-build --checkpoint_dir --kv_cache_type paged

Note: passing --use_fp8_context_fmha disable is silently overridden — builder.py forces it back to True whenever kv_cache_quant_algo=FP8 and use_paged_context_fmha=True, logging: "FP8 Context FMHA is enabled to support FP8 Paged Context FMHA."

Expected behavior

Correct model output, same as TRT-LLM 1.1.0 with the same checkpoint.

actual behavior

Most prompts produce garbage / degenerate output (e.g. ##.##.##.##..., repetitive loops). Some very short prompts accidentally produce correct output.

additional notes

The relevant Python code in builder.py and modeling_utils.py is byte-for-byte identical between 1.1.0 and 1.2.0. Both versions force use_fp8_context_fmha=True and both synthesize attention_output_orig_quant_scale the same way:
scale = [1.0] / layer.dense.activation_scaling_factor.raw_value
layer.attention_output_orig_quant_scale = Parameter(value=scale.astype(np.float32), ...)

Modelopt checkpoints do not include attention_output_orig_quant_scale natively; TRT-LLM synthesizes it from
dense.activation_scaling_factor. Since the Python path is identical, the regression must lie in the compiled attention kernel.

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.

langzhao-netizen avatar Apr 09 '26 05:04 langzhao-netizen

Hi @langzhao-netizen Have you tried Pytorch workflow on latest code? It works for me. python hf_ptq.py --dataset cnn_dailymail --pyt_ckpt_path Llama-3.2-1B/ --qformat fp8 --export_path ./Llama-3.2-1B-FP8 --kv_cache_qformat fp8 --trust_remote_code python TensorRT-LLM/examples/llm-api/quickstart_advanced.py --model_dir ./Llama-3.2-1B-FP8

Tracin avatar Apr 16 '26 04:04 Tracin

Hi @Tracin, we use TRT backend in our inference stack.

langzhao-netizen avatar Apr 16 '26 17:04 langzhao-netizen

Hi @Tracin, do you have any plan to fix the issue with TRT backend? Thanks.

langzhao-netizen avatar Apr 29 '26 18:04 langzhao-netizen

@langzhao-netizen, Apologies for the delayed response. The TensorRT backend is planned for deprecation as mentioned in this PR: https://github.com/NVIDIA/TensorRT-LLM/pull/11723. In the meantime, we’re focusing our investment on developing the PyTorch workflow. Please try the PyTorch workflow instead.

karljang avatar May 12 '26 03:05 karljang

Hi @karljang, is it possible to achieve feature parity before deprecating TRT backend? https://github.com/NVIDIA/TensorRT-LLM/issues/11257 is a hard blocker for us to use PyTorch backend

ShuaiShao93 avatar May 12 '26 03:05 ShuaiShao93

https://github.com/NVIDIA/TensorRT-LLM/issues/11257 is fixed, and we will soon remove TRT backend (see https://github.com/NVIDIA/TensorRT-LLM/releases#release-v1.3.0rc20), please use PyTorch backend instead.

yuxianq avatar Jul 06 '26 07:07 yuxianq