Downloads · 30 days
3
15% of all-time downloads
crumb-ai/abl_2_1_interleaved
abl_2_1_interleaved is a machine learning model from crumb-ai. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
abl21interleaved is the best-performing model in the CRUMB Phase-1 ablation. It is a hybrid decoder-only language model that interleaves Mamba-3 selective state-space layers with GQA (Grouped-Query Attention) layers a…
Downloads · 30 days
3
15% of all-time downloads
All-time downloads
20
Public
Repo size
584 MB
Likes
0
Public
Click a slice to open those files.
.pt584 MB · 99%
From the Hugging Face model README
abl_2_1_interleaved ⭐ Best in Phase-1 Ablationabl_2_1_interleaved is the best-performing model in the CRUMB Phase-1
ablation. It is a hybrid decoder-only language model that interleaves
Mamba-3 selective state-space layers with GQA (Grouped-Query
Attention) layers at a 2:1 Mamba-majority ratio with interleaved
placement, and was pre-trained exclusively on Python source code.
Across the eleven ablation variants, this configuration achieves the lowest evaluation perplexity (3.4182), confirming that a moderate Mamba majority (67 % of layers) with attention distributed throughout the stack is the optimal design choice at the 150M-parameter scale.
| Property | Value |
|---|---|
| Total parameters | 146,075,776 (146.1M) |
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) |
8 Mamba layers + 4 GQA attention layers (2 Mamba blocks per attention block).
Mamba and attention layers alternate throughout the network according to a
2:1 schedule. Layer order: M A M M A M M A M M A M
This placement distributes the attention layers as evenly as the 2:1 ratio allows while keeping every attention layer close to a Mamba layer that provides the broad sequential context.
| Property | Value |
|---|---|
| Training data | Python subset of bigcode/the-stack-dedup-v2 |
| Tokens seen | 5,367,398,400 (~5.37 B) |
| Steps | 163,840 |
| Context length | 4096 |
| Training time | 47 h 24 m 43 s |
| Final learning rate | 3.00e-05 |
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 |
temperature=0.8, top_k=50,
max_new_tokens=128; each completion checked with ast.parse().
Implementation: src/evaluation/syntax_validity.py.temperature=0.6, top_k=50, max_new_tokens=200, identical random
seed per prompt.
Implementation: src/evaluation/qualitative_comparison.py.| Metric | Value |
|---|---|
| Eval loss | 1.2291 ⭐ (best) |
| Eval perplexity | 3.4182 ⭐ (best) |
| Eval time | 3,175.94 s (~53 min) |
| Syntax validity (n=200) | 55 / 200 → 27.5 % |
| Inference gen. time (200×128 tok) | 180.33 s |
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 |
abl_2_1_interleaved is recommended as the base configuration for Phase 2
of the CRUMB project. The overall spread across all 11 configurations is
0.314 perplexity points (9.2 %); this model is 0.176 PPL (4.9 %) better
than the worst model (abl_1_1_frontloaded) and 0.105 PPL (3.0 %) better
than the best pure baseline (abl_pure_mamba).
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.
from tokenizers import Tokenizer
import torch
from src.model.config import CRUMBConfig
from src.model.model import CRUMBModel
config = CRUMBConfig.from_yaml("configs/model/abl_2_1_interleaved.yaml")
model = CRUMBModel(config)
state = torch.load("saved/model/abl_2_1_interleaved/model.pt", map_location="cpu")
model.load_state_dict(state)
model.eval()
tok = Tokenizer.from_file("saved/tokenizer/crumb_tok_hf/tokenizer.json")
ids = tok.encode("def fibonacci(n):\n").ids
x = torch.tensor([ids])
with torch.no_grad():
y = model(x)