NVIDIA / NVIDIA/TensorRT-LLM

trt-llm相比hf跑qwen的forward仅context phrase有加速效果,generation没有加速效果

Open
#2,705 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug General perf Model optimization
Dominant language
Python
Stars
14.7k
Forks
2.8k
Avg merge
2d 23h
Merged PRs (30d)
489

Description

System Info
  • CPU architecture: X86_64
  • GPU properties:NVIDIA L40S,46G,8卡
  • Libraries
    -TensorRT-LLM 版本:v0.14.0
    -TensorRT版本:10.4.0
    -llm 模型:Qwen2-7B-Instruct
    -使用镜像:nvcr.io/nvidia/tritonserver:24.10-trtllm-python-py3
    -NVIDIA driver info:NVIDIA-SMI 545.23.08 Driver Version: 545.23.08 CUDA Version: 12.3
    参考test_llama.py写test_qwen.py调用模型forward,脚本中build_engine参数:gemm_plugin和gpt_attention_plugin均使用,enable_remove_input_padding为false,dtype为float16,多次调用runtime进行forward和hf进行对比,耗时如下:

context phrase:
Time cost of trt-llm is 0.1882
Time cost of hf-llm is 0.4351
generation phrase:
ime cost of trt-llm is 0.0219
Time cost of hf-llm is 0.0236

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

1.build engine from hf model reference llama:https://github.com/NVIDIA/TensorRT-LLM/blob/main/tests/model/test_llama.py
2.调用前向计算代码,打印时间

Expected behavior

比hf速度有明显提升

actual behavior

仅context phrase有加速效果,generation没有加速效果

additional notes

none

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/model/test_llama.py and the reported test_qwen.py reproduction, then run the forward benchmark under the listed TensorRT-LLM, TensorRT, driver, and GPU versions. Compare context and generation timings against Hugging Face and document whether the generation gap is reproducible and what component accounts for it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.