Speeding up vllm inference for Qwen2.5-VL

For deterministic OCR extraction, set temperature=0, top_p=1.0, and top_k=0 (or -1). This ensures greedy decoding, which is the most repeatable and least random. Your current settings (temperature=0.1, top_p=0.1) introduce randomness and can cause inconsistent outputs (SamplingParams docs).

To prevent infinite repetition of the same token, vLLM does not natively support a “no_repeat_ngram_size” parameter, but you can implement a custom logits processor for this purpose. See this example for how to add a NoRepeatNGramLogitsProcessor to your sampling parameters.

Would you like a code example for adding a custom logits processor?

Sources: