Instructions to use d0rj/q-prefixlm-51M-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use d0rj/q-prefixlm-51M-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="d0rj/q-prefixlm-51M-base", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("d0rj/q-prefixlm-51M-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use d0rj/q-prefixlm-51M-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "d0rj/q-prefixlm-51M-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "d0rj/q-prefixlm-51M-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/d0rj/q-prefixlm-51M-base
- SGLang
How to use d0rj/q-prefixlm-51M-base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "d0rj/q-prefixlm-51M-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "d0rj/q-prefixlm-51M-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "d0rj/q-prefixlm-51M-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "d0rj/q-prefixlm-51M-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use d0rj/q-prefixlm-51M-base with Docker Model Runner:
docker model run hf.co/d0rj/q-prefixlm-51M-base
prefixlm-51M-base
A 50,866,688-parameter English base model trained from random initialization in the Tiny llm ablation experiment.
Architecture and references
10 decoder layers, width 512, SwiGLU 1792, GQA 8 query / 2 KV heads, RoPE, RMSNorm, tied embeddings. Bidirectional prefix fractions are sampled from {0.25, 0.5, 0.75}; only causal suffix targets contribute to training loss. Sequences shorter than 100 tokens fall back to causal training. Evaluation conditions on the entire bidirectional text context, with a causal answer. Context length: 2048. The architecture/tokenizer baseline is Q-50M-Base; these weights are not a fine-tune of that checkpoint. The unchanged tokenizer has 32,768 entries. The prefix objective follows the prefix language-modeling family described in T5.
Training
Exactly 3,932,160,000 processed source tokens, 15,000 optimizer steps, FineWeb-Edu sample-10BT. This counts input blocks, not unique text or supervised target tokens. Effective batch: 8 × 16 accumulation × 2048 = 262,144 source tokens per step. Shuffle buffer 100,000; seed 2026.
BF16 compute / FP32 weights, one RTX 5070 Ti 16 GB. Fused AdamW, peak LR 0.001, 150-step linear warmup then cosine decay to 0.0001; betas (0.9, 0.95), weight decay 0.1 excluding bias/norm/1D parameters, gradient clipping 1.0. Exact configuration. Equal source-token budgets do not imply equal supervision or FLOPs.
Evaluation
Full splits, zero-shot, lm-eval 0.4.12, BF16, RTX 5070 Ti, max context 2048, no chat template. Protocol: Bidirectional text context, causal answer; answer-only conditional likelihood. Accuracy is percent; ± means one standard error; brackets are 95% Wilson intervals. LAMBADA requires every final-word token to match. acc_norm normalizes option likelihood by harness length. All metrics and provenance.
| Dataset | Split | Examples | Metric | Score ± SE (%) | 95% CI (%) |
|---|---|---|---|---|---|
| HellaSwag | validation | 10,042 | acc_norm | 28.39 ± 0.45 | [27.52, 29.28] |
| ARC-Easy | test | 2,376 | acc_norm | 36.24 ± 0.99 | [34.33, 38.19] |
| ARC-Challenge | test | 1,172 | acc_norm | 22.78 ± 1.23 | [20.47, 25.27] |
| PIQA | validation | 1,838 | acc_norm | 53.10 ± 1.16 | [50.82, 55.37] |
| WinoGrande | validation | 1,267 | acc | 49.72 ± 1.41 | [46.98, 52.47] |
| OpenBookQA | test | 500 | acc_norm | 25.60 ± 1.95 | [21.97, 29.60] |
| BoolQ | validation | 3,270 | acc | 54.86 ± 0.87 | [53.15, 56.56] |
| LAMBADA OpenAI | test | 5,153 | acc | 23.35 ± 0.59 | [22.21, 24.52] |
WikiText-2 raw test continuation: 291 nonoverlapping 1024-token blocks, 512 prefix + 512 scored suffix tokens; 148,992 scored tokens, 335 tail tokens excluded. GPU FP32 PPL 39.596 [38.055, 41.170], NLL 3.678741 [3.639031, 3.717709]. Percentile block bootstrap, 10,000 resamples, seed 2026. BF16 results are stored separately. This is conditional continuation PPL, not standard rolling or word PPL. Intervals do not capture training-seed variability or all within-document dependence.
model-index contains author-reported scores; no official leaderboard submission or verified badge is claimed.
Usage
Install requirements.txt. Custom code requires trust_remote_code=True.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "d0rj/prefixlm-51M-base"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True).eval()
inputs = tokenizer("The purpose of science is", return_tensors="pt", add_special_tokens=False)
inputs["prefix_lengths"] = torch.tensor([inputs["input_ids"].shape[1]])
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=32, do_sample=False)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Reproduce core scores from a downloaded repository after installing evaluation/requirements.txt:
python evaluation/run_core.py --device cuda:0 --dtype bfloat16 --batch-size 16 --output evaluation-rerun
TensorBoard and limitations
Training and evaluation event files contain 750 training-loss points (steps 20–15,000) and eval/ scalars at step 15,000, including CI bounds. Looped training resumed from a saved checkpoint; TensorBoard retains the valid history across the restart.
Small English base model, not instruction-tuned. Single training seed; benchmark contamination was not audited. Reference models with other tokenizers, prompts or data are not directly interchangeable. These checkpoints are research ablations.
- Downloads last month
- 2
Dataset used to train d0rj/q-prefixlm-51M-base
Collection including d0rj/q-prefixlm-51M-base
Paper for d0rj/q-prefixlm-51M-base
Evaluation results
- acc_norm on HellaSwagvalidation set self-reported0.284
- acc_norm on ARC-Easytest set self-reported0.362
- acc_norm on ARC-Challengetest set self-reported0.228
- acc_norm on PIQAvalidation set self-reported0.531
- acc on WinoGrandevalidation set self-reported0.497
- acc_norm on OpenBookQAtest set self-reported0.256
- acc on BoolQvalidation set self-reported0.549
- acc on LAMBADA OpenAItest set self-reported0.233