NVIDIA / NVIDIA/TensorRT-Edge-LLM
Support multimodal calibration when quantizing only the LLM backbone
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 563
- Forks
- 135
- Avg merge
- 14h 13m
- Merged PRs (30d)
- 1
Description
Problem
On the latest upstream main (bb291453bc10), it is not possible to calibrate a VLM with real image-text samples when only the LLM backbone is quantized and the vision tower stays in FP16.
Multimodal calibration is only used when --visual_quantization is enabled:
elif visual_quantization is not None:
image_ds = resolve_dataset(image_dataset, "image")
batches = _multimodal_calib_dataloader(...)
mtq.quantize(
model,
quant_cfg,
forward_loop=lambda m: _calibrate_multimodal(m, batches),
)
else:
# text-only calibration
Source: quantize.py#L950-L975
When --visual_quantization is not set, passing --image_dataset has no effect and calibration falls back to text-only inputs. This means the LLM quantizers never see the visual-token and multimodal chat-template inputs used in production.
Expected behavior
Please add an independent option, for example:
tensorrt-edgellm-quantize llm \
--quantization fp8 \
--image_dataset my_vlm_data \
--multimodal_llm_calibration
It should:
- Keep the vision tower in FP16;
- Run calibration with image-text inputs through the full VLM;
- Collect activation statistics only for the quantized LLM-side modules;
- Leave existing
--visual_quantizationbehavior unchanged.
This is a Python/ModelOpt calibration-flow issue, not something that can be addressed through a TensorRT plugin.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tensorrt_edgellm/quantization/quantize.py around lines 950-975 and trace how image_dataset, visual_quantization, and the text-only calibration branch are selected. Verify the new independent option calibrates the full VLM with image-text inputs while collecting statistics only for quantized LLM modules, keeps the vision tower in FP16, and leaves visual_quantization behavior unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 54/100