Ismail Ben Alla

tiny-dlms

Tiny Decision Models That Score Instead of Generate

Deep learning · Nov 2026 · Completed

Two tiny models that look at a situation, score every option and pick one: Rhoa for text, Mēlon for images.

Built withPyTorchONNXJavaScriptGymnasiumMatplotlib

tiny-dlms — overview

Overview

tiny-dlms is two decision models built from scratch in PyTorch. Instead of generating an answer, they read a situation and its options, give every option a score and pick the highest. Every piece is hand-written: tokenizers, Transformer, pre-training, fine-tuning, image model, benchmark and browser demo, with no Hugging Face transformers.

Rhoa reads text. One model, fine-tuned on four datasets at once, answers bAbI stories, finds the intent among 151 CLINC150 or 77 Banking77 options, and tries CommonsenseQA. Mēlon is the same judge on image patches: it learns to drive in CarRacing from a pure-pursuit teacher, and to solve mazes.

I benchmarked 16 Rhoa versions and 4 Mēlon versions on the same held-out test data, next to simple baselines, and compared a word tokenizer with a byte-level BPE. To try it: pip install -e ".[test,car,web]", then QUICK=1 bash scripts/train_all.sh checks the whole pipeline, and scripts/ask.py asks a trained model.

The question

Can a model with a few million weights make good decisions by scoring every option, instead of generating an answer?

Key features

How it works

  1. One sequence per option

    Each option is paired with the context as <cls> context <sep> option. Mēlon does the same with image patches instead of words.

  2. Score every option

    An encoder reads each pair, a candidate layer lets the options look at each other, and a score head gives one number per option. A softmax picks the decision.

  3. Pre-train, then fine-tune

    Rhoa first learns to guess 15% hidden tokens in web text, then learns to pick the right option. Mēlon learns from a teacher that drives, or from mazes generated on the fly.

Examples

Rhoa on real test questions it never saw: it scores all 151 CLINC150 or 77 Banking77 options and picks one.
Mēlon driving a CarRacing track it never saw, choosing among 15 actions from pixels only.
Mēlon solving mazes it never saw, one move at a time, on the shortest path.
What pre-training adds: each Rhoa next to its twin trained from scratch, on the four datasets.
What pre-training adds: each Rhoa next to its twin trained from scratch, on the four datasets.

Tech stack

What I learned

Limitations

Related projects