Skip to main content

Overview

Generation parameters control the sampling behavior and output characteristics of Qwen3-VL. Proper configuration can significantly impact response quality, creativity, and coherence.

Basic Generation Parameters

Key Parameters

max_new_tokens

Controls the maximum length of the generated response.
  • Default: 128-512 tokens for most use cases
  • Document analysis: 1024-2048 tokens
  • Long videos: Up to 4096 tokens

temperature

Controls randomness in generation. Higher values produce more creative but less focused outputs.
Recommended values:
  • 0.1-0.3: Factual tasks, OCR, data extraction
  • 0.6-0.8: General description, Q&A
  • 0.9-1.2: Creative writing, brainstorming

top_p (Nucleus Sampling)

Limits sampling to the smallest set of tokens whose cumulative probability exceeds p.

top_k

Limits sampling to the top K most probable tokens.

do_sample

Enables sampling-based generation. Set to False for greedy decoding.

Official Evaluation Settings

Instruct Models

Recommended settings for Qwen3-VL-Instruct models:
Environment variables (for vLLM/serving):

Thinking Models

Recommended settings for Qwen3-VL-Thinking models:
Environment variables:

Advanced Parameters

Repetition Control

Seed for Reproducibility

Stop Sequences

Task-Specific Configurations

Image Description

OCR and Text Extraction

Video Understanding

Creative Tasks

Complete Example

Performance Tips

Optimization Recommendations:
  1. Use flash_attention_2 for faster generation:
  2. Batch similar requests for better throughput
  3. Adjust max_new_tokens based on expected output length to save computation
  4. Use greedy decoding (do_sample=False) for deterministic, factual tasks
  5. Enable KV cache (enabled by default) for faster multi-turn conversations

Next Steps

Batch Inference

Process multiple requests for better throughput

Basic Usage

Review basic inference patterns