CRUMB abl_1_1_interleaved
Model Overview
abl_1_1_interleaved is a hybrid decoder-only language model from the
CRUMB (Compact Recurrent-hybrid Underlying Mamba Blocks) project. It
alternates Mamba-3 selective state-space layers with GQA
(Grouped-Query Attention) layers in a strict 1:1 alternating pattern,
and was pre-trained exclusively on Python source code.
It is one of eleven ablation variants trained to study how the
Mamba-to-attention ratio and the placement of attention layers affect
small-scale (~150M-parameter) language models on Python program synthesis.
Architecture
| Property | Value |
|---|
| Total parameters | 141,805,344 (141.8M) |
d_model | 768 |
n_layers | 12 |
n_heads | 12 |
n_kv_heads | 4 (GQA) |
d_head | 64 |
d_ff | 3072 |
vocab_size | 32768 |
seq_len | 4096 |
| Tie embeddings | yes |
| Pos. encoding | RoPE (base = 10000) |
| Mamba layer type | Mamba-3 (d_state=64, expand=2, headdim=64, ngroups=1, chunk=64) |
Mamba : Attention ratio — 1 : 1
6 Mamba layers + 6 GQA attention layers.
Placement — Interleaved
Attention and Mamba layers alternate one-for-one throughout the network.
Layer order: A M A M A M A M A M A M
This is the most "balanced" arrangement: every Mamba block is followed by an
attention block, distributing exact token-level retrieval evenly through the
stack.
Training
| Property | Value |
|---|
| Training data | Python subset of bigcode/the-stack-dedup-v2 |
| Tokens seen | 5,367,422,970 (~5.37 B) |
| Steps | 163,840 |
| Context length | 4096 |
| Training time | 47 h 16 m 00 s |
| Final learning rate | 3.00e-05 |
Evaluation Method
Perplexity (primary metric)
Per-token cross-entropy loss with BF16 autocast, computed over the full
held-out evaluation set.
| Setting | Value |
|---|
| Eval sequences | 20,063 batches |
| Eval tokens | 328,631,940 |
| Implementation | src/evaluation/perplexity.py |
Generation-based metrics
- Python syntax validity — 200 free-form completions generated per model
from 49 diverse Python prompts at
temperature=0.8, top_k=50,
max_new_tokens=128; each completion checked with ast.parse().
Implementation: src/evaluation/syntax_validity.py.
- Qualitative side-by-side completions — 10 fixed prompts at
temperature=0.6, top_k=50, max_new_tokens=200, identical random
seed per prompt.
Implementation: src/evaluation/qualitative_comparison.py.
Evaluation Results
| Metric | Value |
|---|
| Eval loss | 1.2643 |
| Eval perplexity | 3.5407 |
| Eval time | 3,102.14 s (~52 min) |
| Syntax validity (n=200) | 48 / 200 → 24.0 % |
| Inference gen. time (200×128 tok) | 187.28 s |
Rank Summary
Out of 11 ablation configurations evaluated at the same token budget:
| Rank | Model | Perplexity |
|---|
| 1 | abl_2_1_interleaved | 3.4182 |
| 2 | abl_3_1_interleaved | 3.4359 |
| 3 | abl_3_1_backloaded | 3.4493 |
| 4 | abl_2_1_backloaded | 3.4683 |
| 5 | abl_1_1_backloaded | 3.4763 |
| 6 | abl_pure_mamba | 3.5237 |
| 7 | abl_1_1_interleaved | 3.5407 |
| 8 | abl_pure_attn | 3.5939 |
| 9 | abl_3_1_frontloaded | 3.6798 |
| 10 | abl_2_1_frontloaded | 3.7078 |
| 11 | abl_1_1_frontloaded | 3.7315 |
Within the 1:1 Mamba:Attention ratio, interleaved placement ranks below
backloaded (PPL 3.476) but ahead of frontloaded (PPL 3.731). Within the
interleaved arrangement, 1:1 is the weakest of the three ratios.
Intended Use & Limitations
- Domain: Python source-code language modelling.
- Base model only: no instruction tuning, no chat alignment, no safety
filtering. Outputs are unconstrained code completions.
- Repetitive degeneration: all base CRUMB models tend to repeat
function signatures / docstrings during free-form generation; this is
expected behaviour for unaligned base models.
Citation / Context
This model is part of the CRUMB Phase-1 ablation study:
Efficient Architectural Hybrids for Small-Scale Language Models in Python
Program Synthesis — Department of Computer Science and Engineering,
Daffodil International University.
Findings documented in documents/phase1_ablation_findings.md.
How to Load
1from tokenizers import Tokenizer
2import torch
3from src.model.config import CRUMBConfig
4from src.model.model import CRUMBModel
5
6config = CRUMBConfig.from_yaml("configs/model/abl_1_1_interleaved.yaml")
7model = CRUMBModel(config)
8state = torch.load("saved/model/abl_1_1_interleaved/model.pt", map_location="cpu")
9model.load_state_dict(state)
10model.eval()
11
12tok = Tokenizer.from_file("saved/tokenizer/crumb_tok_hf/tokenizer.json")
13ids = tok.encode("def fibonacci(n):\n").ids
14x = torch.tensor([ids])
15with torch.no_grad():
16 y = model(x)