Image-Text-to-Text
Transformers
Safetensors
English
gemma4
vision-language
visual-question-answering
knowledge-distillation
lora
merged
research
conversational
Instructions to use gnitoahc/ceed-b4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gnitoahc/ceed-b4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="gnitoahc/ceed-b4") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("gnitoahc/ceed-b4") model = AutoModelForMultimodalLM.from_pretrained("gnitoahc/ceed-b4", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gnitoahc/ceed-b4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gnitoahc/ceed-b4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gnitoahc/ceed-b4", "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/gnitoahc/ceed-b4
- SGLang
How to use gnitoahc/ceed-b4 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 "gnitoahc/ceed-b4" \ --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": "gnitoahc/ceed-b4", "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 "gnitoahc/ceed-b4" \ --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": "gnitoahc/ceed-b4", "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 gnitoahc/ceed-b4 with Docker Model Runner:
docker model run hf.co/gnitoahc/ceed-b4
File size: 3,512 Bytes
d7e542a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | ---
license: gemma
base_model: google/gemma-4-e4b-it
library_name: transformers
pipeline_tag: image-text-to-text
tags:
- vision-language
- visual-question-answering
- knowledge-distillation
- lora
- merged
- research
datasets:
- lmms-lab/DocVQA
- lmms-lab/GQA
- lmms-lab/ChartQA
language:
- en
---
# CEED B4 — gemma-4-e4b-it, distilled, with visual-advantage reweighting
A LoRA fine-tune of [`google/gemma-4-e4b-it`](https://huggingface.co/google/gemma-4-e4b-it)
trained with B2's objective plus **VA-OPD's visual-advantage reweighting** (arXiv:2605.21924).
The teacher is the sparse mixture-of-experts [`google/gemma-4-26b-a4b-it`](https://huggingface.co/google/gemma-4-26b-a4b-it).
The adapter has been folded into the base weights, so this is a standalone
checkpoint: load it exactly like the base model, with no PEFT and no CEED code.
This is **Group B4** of the CEED study (Causal Expert–Evidence Distillation),
a research artifact published for reproducibility. It is not a product.
## Usage
```python
from transformers import AutoModelForImageTextToText, AutoProcessor
model = AutoModelForImageTextToText.from_pretrained("gnitoahc/ceed-b4", dtype="float16")
processor = AutoProcessor.from_pretrained("gnitoahc/ceed-b4")
```
The model was trained and scored with a short-answer instruction in the prompt.
Without it an instruction-tuned model answers `"The total written in the image is
**28**."` against gold `"28"` and scores zero on every metric here.
## Training
| | |
| --- | --- |
| Corpus | chartqa 2,500, docvqa 5,349, gqa 10,000 (17,849 examples, 80/10/10 split by example id) |
| Passes over the training split | 2.69 |
| Adapter | LoRA rank 4 |
| Final cross-entropy | 1.0979 |
| Final KD term | 2.1309 |
| Seed | 0 |
| Run identity | `6a4544ff1af675be8b364825a3f3f5c7bd825801471267ebd5f4956ff3febaa8` |
## Evaluation
| Dataset | Metric | Score | n |
| --- | --- | --- | --- |
| docvqa | ANLS | 0.8538 | 565 |
| gqa | exact match | 0.6102 | 1016 |
| chartqa | relaxed accuracy | 0.6185 | 249 |
Scored by CEED's own harness (`harness_version: ceed-direct-1`)
with greedy decoding, on CEED's own 10% validation split.
**These numbers are not comparable to published DocVQA / GQA / ChartQA leaderboard
results.** Different splits, different prompt, different decoding. They are
meaningful only against the other CEED Groups, which were scored identically.
## Limitations
- **This is a LoRA result.** Merging folds the adapter into the weights; it does
not turn a rank-4 adapter into a full
fine-tune. CEED's own ADR-0005 bars LoRA numbers from the study's headline
table, because a null result under a small adapter cannot be attributed between
"the signal does not transfer" and "the adapter lacked the capacity to hold it".
Read any comparison involving this checkpoint with that in mind.
- **The distillation gain is not established.** The no-teacher control (CEED B1), trained identically but with `kd_weight: 0`, scored **above this checkpoint on every dataset** (docvqa 0.8538 vs 0.8798; gqa 0.6102 vs 0.6959; chartqa 0.6185 vs 0.7871). Whatever this checkpoint's objective contributes, it is not visible as an advantage over supervised fine-tuning here.
- Trained on document, natural-image and chart VQA in English only. Behaviour
outside that is untested.
- Inherits the base model's limitations and the Gemma licence.
`ceed_provenance.json` beside the weights carries the source run's identity,
parameter-efficiency mode, and metrics.
|