Boosting multimodal inference performance by >10% with a single Python dictionary | Modal Blog
May 4, 2026

Summary
This post details an optimization in SGLang's scheduler for multimodal inference. By profiling with `py-spy`, the team identified that expensive book-keeping around shared GPU memory handles during multimodal request processing was a bottleneck. They implemented a Python dictionary cache for these handles, reducing host overhead and improving throughput by 16.2% and reducing mean end-to-end latency by 10.6% on a Qwen2.5-VL-3B-Instruct workload. This optimization was upstreamed to SGLang.
More from the Inference Performance Optimization trail
- TypeSafe AI scales Jev to trillions of tokens in three days on Modal | Modal Blog
- Modal Clusters are generally available
- Hitting a billion tokens per minute on one GPU by combining a query planner and an inference engine | Modal Blog
- How to serve trillions of tokens for trillion-parameter coding agents | Modal Blog
- Kimi K3 by Moonshot now available on Modal | Modal Blog