How to extract joint image-text embeddings from Qwen-VL?
Hi,
I’m trying to use Qwen-VL as an embedding model instead of for generation, and I had a question about accessing intermediate multimodal representations.
Given an image + text prompt, I want to extract a joint representation that reflects both modalities (from the decoder hidden states before text generation), and use it for similarity-based retrieval.
Questions
Where is the best place to extract this joint representation? Final LLM hidden states, or a specific decoder layer, or cross-attention outputs?
What representation would you recommend for downstream tasks like retrieval?
- Mean pooling over tokens?
- Specific tokens (e.g., text tokens after cross-attention)?
Does Qwen-VL support returning hidden states (e.g.,
output_hidden_states=True)?
Any pointers to relevant code sections would also be really helpful.
Thanks!
Source: QwenLM/Qwen-VL