Versalit ResearcherBot-1
A language model that reads text, images and audio — with encoders, tokenizer and Mixture-of-Experts router written from scratch in pure PyTorch. Built to talk about AI research, in Brazilian Portuguese.
python demo_multimodal.py (the model speaks Portuguese), cut at the demo's token limit; sampling is random, so every run differs. "aluno" is the student, "orientador" the advisor. Translation: what is mixture of experts? — "an architecture where the model has multiple specialized sub-networks called…"; how to structure a paper? — "IMRaD: introduction, method, results and discussion"; what is machine learning? — it answers about federated learning instead, the model's limit showing. In the same run, the question about adversarial attacks also went off-topic. The image and audio answers describe a red circle and a constant low tone, correctly.What it is
A multimodal language model with Mixture-of-Experts: it takes a text question — alone or together with an image or an audio clip — and answers in text. It has 19.9 million parameters, of which about 10 million work on each token. It is the multimodal sibling of SAC-1: the same MoE transformer base, plus two encoders.
No CLIP, no pre-trained ViT, no Whisper or wav2vec: the vision encoder, the audio encoder, the BPE tokenizer and the decoder were written by hand in pure PyTorch. The only dependency is torch.
How text, images and audio come together
The image (64×64) is cut into 64 patches of 8×8 pixels; the audio becomes a mel spectrogram cut into 16-frame patches. Each encoder turns its patches into vectors the same size as text tokens, and a modality embedding marks where each vector came from. From there on, the decoder treats everything as a single sequence.
image 64×64 → 64 patches 8×8 + CLS → self-attention → projection ─┐
audio (mel, 64 bands) → 16-frame patches + CLS → projection ──────┤
text → BPE tokens (1,024) + modality embedding ───────────────────┤
↓
6 transformer blocks: RoPE, RMSNorm, SwiGLU
blocks 0, 2, 4: MoE, 8 experts, top-2 # the router picks 2 per token
→ LM head → text answer
Benchmark — 811 tests
| Modality | Tests | Correct |
|---|---|---|
| Text (questions and answers) | 401 | 87.5% |
| Image (shape and colour) | 250 | 76.8% |
| Audio (type of sound) | 160 | 87.5% |
| Composite score | 811 | 84.8% |
How to read it: the criterion is lenient — a text answer counts as correct if it contains at least one expected keyword, even when it talks about the wrong topic. The model memorizes: it gets 100% of the questions seen in training and 70.3% of the same questions rephrased. And the domain is synthetic: geometric shapes and code-generated sounds, not real photos or audio.
Training
| Parameter | Value |
|---|---|
| GPU | NVIDIA RTX 3060 (12 GB) |
| Optimizer | AdamW (β 0.9 / 0.95) |
| Learning rate | 3e-4, 500 warmup steps + cosine |
| Batch | 32 |
| Precision | mixed (FP16) |
| Data | 3,672 synthetic examples: 2,700 text, 540 image, 432 audio |
| Steps | 2,000 (~45 min) |
| Published checkpoint | step 500 — lowest validation loss (1.34) |
Why step 500: after it, training loss fell to 0.05 while validation loss rose to 1.87 — the model started memorizing the training set. The published checkpoint is the one with the best validation loss.
How to run it
git clone https://huggingface.co/delvek/versalit-researcherbot-1 cd versalit-researcherbot-1 pip install torch python demo_multimodal.py # text, image and audio python generate.py # interactive chat python benchmark_1k.py # the 811 tests (~1h45 on an RTX 3060)
Honest limitations
- Small synthetic data: simple geometric shapes and code-generated sounds.
- 1,024-token vocabulary: out-of-domain words become
<unk>and the output has no accents. - 256-token context and 64×64 images — far too small for real photos; the audio side does not handle speech.
- Brazilian Portuguese only. It is a demonstration of the multimodal MoE architecture, not a production assistant.