Image-Text-to-Text
Transformers
Safetensors
qwen3_vl
vision-language
image-classification
calibrated-probabilities
structured-outputs
typed-questions
jev-inspired
qwen3-vl
conversational
Instructions to use MeerDevelopment/Qevi-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MeerDevelopment/Qevi-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="MeerDevelopment/Qevi-2B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("MeerDevelopment/Qevi-2B") model = AutoModelForMultimodalLM.from_pretrained("MeerDevelopment/Qevi-2B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MeerDevelopment/Qevi-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MeerDevelopment/Qevi-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MeerDevelopment/Qevi-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/MeerDevelopment/Qevi-2B
- SGLang
How to use MeerDevelopment/Qevi-2B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MeerDevelopment/Qevi-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MeerDevelopment/Qevi-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MeerDevelopment/Qevi-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MeerDevelopment/Qevi-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use MeerDevelopment/Qevi-2B with Docker Model Runner:
docker model run hf.co/MeerDevelopment/Qevi-2B
Add plain-language explainer
Browse files- EXPLANATION.md +91 -0
EXPLANATION.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# How this model works
|
| 2 |
+
|
| 3 |
+
A short explainer for why Qevi-2B answers questions the way it does. Assumes no background.
|
| 4 |
+
For usage, see the [model card](README.md).
|
| 5 |
+
|
| 6 |
+
## What a normal vision model does
|
| 7 |
+
|
| 8 |
+
Show a model a photo and ask "is there a ladder?" and it *writes* an answer: it picks the most
|
| 9 |
+
likely next word, appends that word to its own input, runs the whole model again for the next
|
| 10 |
+
word, and repeats. A thirteen-word reply means thirteen-plus passes through 2.1 billion
|
| 11 |
+
parameters, to communicate what is really one bit of information.
|
| 12 |
+
|
| 13 |
+
Ask ten questions about the same photo and it does that ten times over, re-encoding the photo
|
| 14 |
+
from scratch each time. The photo is ~1,000 tokens and the question is maybe 20, so almost all
|
| 15 |
+
of that work is repeated for nothing.
|
| 16 |
+
|
| 17 |
+
## What we do instead
|
| 18 |
+
|
| 19 |
+
**1. Read the answer, don't generate it.**
|
| 20 |
+
|
| 21 |
+
Instruction-tuned models follow a rigid script. After your question ends, there is a specific
|
| 22 |
+
position where the model is about to write the first word of its reply. We call it the *sentinel*.
|
| 23 |
+
|
| 24 |
+
```
|
| 25 |
+
<|im_start|>user
|
| 26 |
+
<|vision_start|>[image tokens]<|vision_end|>
|
| 27 |
+
Statement: There is a ladder in this image.
|
| 28 |
+
Is this statement true of the image? Answer Yes or No.<|im_end|>
|
| 29 |
+
<|im_start|>assistant
|
| 30 |
+
^ the sentinel: the model's opinion already exists here
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
At that position the model has already computed a score for every word in its vocabulary. The
|
| 34 |
+
score for `Yes` and the score for `No` are sitting right there. We take those two numbers and
|
| 35 |
+
stop. No generation, no parsing, no chance of it replying in an unexpected format.
|
| 36 |
+
|
| 37 |
+
**2. Ask everything at once.**
|
| 38 |
+
|
| 39 |
+
Because nothing is being generated, we can lay the image down once and append every question
|
| 40 |
+
after it, then use the attention mask to enforce three rules:
|
| 41 |
+
|
| 42 |
+
- every question can see the image
|
| 43 |
+
- every question can see itself
|
| 44 |
+
- **no question can see any other question**
|
| 45 |
+
|
| 46 |
+
Each question therefore behaves exactly as if it had been asked alone. We verified this: shuffle
|
| 47 |
+
the question order and the outputs are bitwise identical. Packing doesn't quietly change answers.
|
| 48 |
+
|
| 49 |
+
The payoff is that the expensive part (encoding the image, ~500 ms) happens once, while each
|
| 50 |
+
extra question costs about 5 ms. Thirty questions run ~24x faster than asking them one at a time.
|
| 51 |
+
|
| 52 |
+
## What the fine-tune changed
|
| 53 |
+
|
| 54 |
+
The base model could already do this — reading logits works on a stock checkpoint. We fine-tuned
|
| 55 |
+
all 2.13 billion parameters against exactly that objective: cross-entropy over the candidate
|
| 56 |
+
answer logits, nothing else. Train-time and test-time behaviour are identical, which is rarer
|
| 57 |
+
than it sounds.
|
| 58 |
+
|
| 59 |
+
One epoch over 85,500 questions on 28,500 images, ~5 GPU-hours on two consumer cards. Results:
|
| 60 |
+
|
| 61 |
+
| | Base 2B | Qevi-2B |
|
| 62 |
+
|---|---|---|
|
| 63 |
+
| Accuracy, domains seen in training | 0.855 | **0.977** |
|
| 64 |
+
| Accuracy, 12 domains never trained on | 0.745 | **0.889** |
|
| 65 |
+
| Calibration error (held-out, lower better) | 0.160 | **0.054** |
|
| 66 |
+
|
| 67 |
+
The interesting number is the second row. It improved *more* on domains it had never seen
|
| 68 |
+
(+14.4) than on ones it trained on (+12.2), which is the evidence it learned a transferable
|
| 69 |
+
skill rather than memorising 28,500 images.
|
| 70 |
+
|
| 71 |
+
## What this costs you
|
| 72 |
+
|
| 73 |
+
Every question needs a finite answer set declared up front. The model cannot caption an image,
|
| 74 |
+
describe it freely, or answer something you didn't anticipate. Free-form generation still works
|
| 75 |
+
(we checked) but comes out about 44% shorter than the base model, having been trained on
|
| 76 |
+
one-word answers.
|
| 77 |
+
|
| 78 |
+
For classification, moderation, triage, inspection and tagging, that trade is usually correct.
|
| 79 |
+
For open-ended description, use the base model.
|
| 80 |
+
|
| 81 |
+
## Honest caveats
|
| 82 |
+
|
| 83 |
+
- Two of 31 domains got **worse**: German traffic signs (0.834 vs 0.879) and heavily pixelated
|
| 84 |
+
car models (0.474 vs 0.501, where both models are near the floor).
|
| 85 |
+
- One epoch, one seed, no ablations — there are no error bars on any of these numbers.
|
| 86 |
+
- The baseline in every comparison is the base model run through the *same* readout, which
|
| 87 |
+
isolates the effect of fine-tuning. It is not a comparison against the base model used
|
| 88 |
+
conversationally.
|
| 89 |
+
- English prompt templates only.
|
| 90 |
+
|
| 91 |
+
See the [model card](README.md) for the full evaluation, per-domain results and limitations.
|