what it is
A Qwen2 architecture reconfigured from scratch — not a fine-tune. It takes
the tokenizer (and the idea) of Qwen/Qwen2.5-0.5B, then shrinks the model
down to fit a modest GPU and a modest evening:
- ~93M trainable parameters (tied embeddings to stay lean)
- 5 hidden layers, hidden_size 512, 8 attention heads
- 512-token context (that's what the VRAM allowed)
- trained fully in fp32 on the whole thing
the process, honestly
Qwen2Config built from scratch with the official Qwen2.5-0.5B tokenizer
so the small model ships with the same vocabulary (151,936 tokens).
- Tokenized
Salesforce/wikitext (wikitext-2-raw-v1), empty lines filtered
out, sequences capped at 512 tokens.
- Trained with HuggingFace
Trainer on the GTX 1060 Mobile: batch size 2,
gradient accumulation 32 (effective batch 64), gradient checkpointing on,
8-bit AdamW (adamw_bnb_8bit) just to keep the optimizer from eating
the whole 6 GB, fp16/bf16 disabled — Pascal does its best but half precision
is not its friend.
- One epoch, ~372 optimizer steps, about 45 minutes of laptop fan noise.
- Final loss ~6.73 (train), eval loss 6.67. Not good. Honest. Small model,
small data, one pass.
what it's for
Looking at loss curves and smiling. Testing memory tricks on old hardware.
Proof that "AI winter in your bedroom" doesn't have to mean a cluster. This
model will say confident nonsense and occasionally something that reads like
a sentence, and that's exactly the point.
what it's NOT for
Production anything. Factual questions. Opinions. Your homework. It has
never read a book longer than 512 tokens.
how to use it
from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("VinayRevanuru/qwen2-100m-wikitext")model = AutoModelForCausalLM.from_pretrained("VinayRevanuru/qwen2-100m-wikitext") inputs = tok("Once upon a time", return_tensors="pt")out = model.generate(**inputs, max_new_tokens=50, do_sample=True, temperature=0.8)print(tok.decode(out[0], skip_special_tokens=True))
thanks
To the GTX 1060 for not catching fire, and to HuggingFace for making from-
scratch training feel like something a person can still do at their kitchen
table.