File size: 5,313 Bytes
1727faf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7e9c38
1727faf
9b486d0
 
 
 
 
bdd4301
 
1727faf
f7e9c38
9b486d0
f7e9c38
bdd4301
 
 
 
9b486d0
2c4010c
 
 
9b486d0
 
f7e9c38
1727faf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7e9c38
 
 
 
1727faf
 
 
 
 
 
f7e9c38
1727faf
f7e9c38
d651d1c
1727faf
 
f7e9c38
1727faf
 
 
 
 
f7e9c38
1727faf
 
 
 
 
 
 
f7e9c38
 
bdd4301
f7e9c38
d651d1c
f7e9c38
bdd4301
 
2c4010c
bdd4301
f7e9c38
1727faf
 
f7e9c38
 
2c4010c
 
 
 
 
 
 
 
 
d651d1c
9b486d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7e9c38
9b486d0
 
 
 
 
1727faf
 
2c4010c
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
language:
- en
- fr
- de
- es
- it
- pl
license: apache-2.0
tags:
- vision-language-model
- multimodal
- visual-question-answering
- image-captioning
- vlm
base_model:
- OpenGVLab/InternViT-300M-448px-V2_5
- PleIAs/Baguettotron
---

# baguettotron-internvit-alignment

**Baguettotron-VLM** is an open, fully-reproducible, multilingual Vision-Language
Model in the **sub-1B parameter** class. It extends
[PleIAs/Baguettotron](https://huggingface.co/PleIAs/Baguettotron) β€” a 321M
text-only reasoning SLM β€” with visual capabilities via the
[InternViT-300M-448px-V2.5](https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5)
vision encoder and a lightweight MLP projector, for a total of ~628M parameters. It
inherits six European languages (EN, FR, DE, ES, IT, PL) from the Baguettotron backbone.

Two checkpoints are published:

- [baguettotron-internvit-alignment](https://huggingface.co/andreagemelli/baguettotron-internvit-alignment)
  β€” the projector-only warmup. It describes images, and nothing more.
- [baguettotron-vision-vqa](https://huggingface.co/andreagemelli/baguettotron-vision-vqa)
  β€” instruction-tuned on top of it. It goes past plain description and follows visual
  instructions, so prefer it for a richer chat experience.

Apache 2.0. Both live in the [Baguettotron-VLM collection](https://huggingface.co/collections/andreagemelli/baguettotron-vlm-69de37b4cab1960226e9c1f7).
Source: [github.com/andreagemelli/baguettotron-vlm](https://github.com/andreagemelli/baguettotron-vlm) Β·
Write-up: [andreagemelli.me/posts/baguettotron-vlm](https://andreagemelli.me/posts/baguettotron-vlm/)


> **Alignment checkpoint.** Only the MLP projector was trained (on LLaVA-CC3M-Pretrain-595K) β€” the ViT and the Baguettotron LLM are unmodified base weights. It writes short captions and nothing more. Published so the alignment stage can be reproduced; for actual use take [baguettotron-vision-vqa](https://huggingface.co/andreagemelli/baguettotron-vision-vqa).

## Architecture

```
Image (448Γ—448)
  β†’ InternViT-300M-448px-V2.5 (304M, frozen) β†’ 1024 tokens Γ— 1024d
  β†’ Pixel unshuffle (factor=2)                β†’ 256 tokens Γ— 4096d
  β†’ MLP projector (2-layer, ~2.7M)            β†’ 256 tokens Γ— 576d
  β†’ Interleave with text tokens
  β†’ Baguettotron (321M, Llama arch, 80L, h=576)

Total: ~628M parameters
```

## Usage

```bash
pip install "transformers>=4.56,<5" torch pillow timm einops accelerate
```

```python
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
from PIL import Image

model = AutoModelForImageTextToText.from_pretrained(
    "andreagemelli/baguettotron-internvit-alignment",
    trust_remote_code=True,
    dtype=torch.bfloat16,
    device_map="auto",  # also tested on Apple Silicon (mps) and CPU
)
processor = AutoProcessor.from_pretrained(
    "andreagemelli/baguettotron-internvit-alignment",
    trust_remote_code=True,
)

image = Image.open("photo.jpg").convert("RGB")
inputs = processor(
    messages=[{"role": "user", "content": "<image>\nDescribe the image concisely."}],
    image=image,
)
inputs = {k: v.to(model.device) for k, v in inputs.items() if v is not None}

print(model.chat(**inputs))
```

### Example output

Greedy, prompt `Describe the image concisely.` β€” verbatim output. Images from [COCO](https://cocodataset.org) val2017.

| | output |
|---|---|
| <img src="examples/cats.jpg" width="180"> | `a cat is sleeping on the couch` |
| <img src="examples/bear.jpg" width="180"> | `the bear is a good friend.` |
| <img src="examples/stop.jpg" width="180"> | `a sign for a stop` |
| <img src="examples/bus.jpg" width="180"> | `the bus is a red double - decoration` |

### Chat template

Trained on short image captions with no `<think>` traces. The processor emits a bare assistant prefix (`<|im_start|>assistant\n`) and the model completes the caption directly. Keep prompts simple ("Describe the image").

## Limitations

- **Resolution ceiling.** One 448Γ—448 crop β†’ 256 visual tokens puts document text at
  roughly 2–4 px/char. OCR, charts and documents are out of reach by architecture, not
  by budget. Neither published checkpoint reads text in an image.
- **Hallucinations**, especially on fine-grained or text-heavy questions.
- **Multilingual capability is inherited, not verified.** The backbone covers six
  languages; the VLM was never evaluated on non-English benchmarks.

> Tested against `transformers` 4.57. Newer major versions may need adjustments.

**Contributions and suggestions are very welcome** β€” issues, PRs, and ideas for
better data mixes, training recipes, or evaluation setups are all appreciated.
Open an issue or PR on the
[GitHub repo](https://github.com/andreagemelli/baguettotron-vlm).


## Citation

If you use or extend Baguettotron-VLM in your research, please cite it:

```bibtex
@misc{gemelli2026baguettotronvlm,
  title        = {Baguettotron-VLM: An Open, Reproducible, Multilingual Sub-1B Vision-Language Model},
  author       = {Gemelli, Andrea},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/andreagemelli/baguettotron-vision-vqa}},
  note         = {Code: \url{https://github.com/andreagemelli/baguettotron-vlm}}
}
```


## License

Apache 2.0 β€” see the [GitHub repo](https://github.com/andreagemelli/baguettotron-vlm).