Run this model with HF Jobs
Run Sakatepon/Brujula-50M on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Sakatepon/Brujula-50M. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Sakatepon/Brujula-50M on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Sakatepon/Brujula-50M. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Sakatepon/Brujula-50M. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use Sakatepon/Brujula-50M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sakatepon/Brujula-50M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Sakatepon/Brujula-50M", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Sakatepon/Brujula-50M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Sakatepon/Brujula-50M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sakatepon/Brujula-50M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sakatepon/Brujula-50M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Sakatepon/Brujula-50M
- SGLang
How to use Sakatepon/Brujula-50M 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 "Sakatepon/Brujula-50M" \ --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": "Sakatepon/Brujula-50M", "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 "Sakatepon/Brujula-50M" \ --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": "Sakatepon/Brujula-50M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Sakatepon/Brujula-50M with Docker Model Runner:
docker model run hf.co/Sakatepon/Brujula-50M
Brújula-50M (LoopedV3)
A 46.8M-parameter (21.1M non-embedding) looped decoder-only LM, trained from scratch on 5B tokens of FineWeb-Edu. Brújula ("compass" in Spanish) pairs a minimal DeepSeek-style backbone (MLA + RoPE + SquaredReLU + tied embeddings, Muon + AdamW) with v3 Block Attention-Residuals (arXiv:2603.15031) and LoopedV3 — weight-shared depth looping that uses Attention Residuals (instead of mHC) to route across passes.
With only 8 physical layers looped into 12 effective layers, it nearly halves the perplexity of Brújula-18M and edges out GPT-2 small (124M) on FineWeb-Edu at ~38% of the parameters.
What you are getting, up front
This is a tiny hobby base model (46.8M total params, 25.7M of which are the tied GPT-2 embedding table):
- It hallucinates freely. No instruction tuning, no alignment. It writes fluent educational-web continuations; it is not a source of facts.
- 1024-token context as shipped — trained at block size 1024.
- No KV cache in this reference HF export — recomputes the sequence each step (fast at 46.8M / ctx <= 1024, simple and version-proof across
transformers).- FineWeb-Edu distribution — stronger in-domain than out-of-distribution (see the WikiText-103 gap vs GPT-2 small below).
Results
Evaluated on the same fixed local harness (ctx = 1024, AMP) as the rest of the Brújula family:
| Model | Params | FineWeb-Edu val PPL | WikiText-103 PPL | Notes |
|---|---|---|---|---|
| Brújula-15M | 15.5M | 78.05 | 190.74 | tiny from-scratch base (4 layers) |
| Brújula-18M | 18.0M | 46.26 | 108.72 | Brújula-15M G_stack-grown (4→8 layers) |
| Brújula-50M (this model) | 46.8M | 25.88 | 48.78 | 8 physical → 12 effective layers (LoopedV3, 5B tok) |
| GPT-2 small (same harness) | 124M | 26.61 | 29.31 | OpenAI reference (WebText) |
| Brújula-150M | 153.6M | 21.44 | 36.08 | 20-layer MLA base |
| Brújula-450M | 512M | 13.87 | 23.59 | 28-layer Block-AttnRes flagship |
- Full 50M-token FineWeb-Edu validation split during training:
loss = 3.2647(PPL = 26.17); 200-batch local harness sample:loss = 3.2535(PPL = 25.88). Both are reported. - Compared to
Brujula-18M: −44% FineWeb-Edu PPL and −55% WikiText-103 PPL. - Export parity check vs the canonical training model:
0.000e+00max abs logit difference.
Usage
Custom architecture (configuration_brujula_v3.py / modeling_brujula_v3.py), so pass
trust_remote_code=True:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "Sakatepon/Brujula-50M"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True).eval()
ids = tok("The mitochondria is the", return_tensors="pt").input_ids
out = model.generate(
ids,
max_new_tokens=64,
do_sample=True,
temperature=0.8,
top_p=0.95,
repetition_penalty=1.2,
)
print(tok.decode(out[0], skip_special_tokens=True))
Small base model — use sampling + a continuation cue; greedy decoding tends to repetition-loop.
Architecture
| Type | Decoder-only causal LM with weight-shared middle loop (LoopedV3) |
| Hidden / Heads | n_embd = 512 / n_head = 4 (head_dim = 128) |
| Depth | 8 physical layers → 12 effective layers (lo = 2, hi = 6, iters = 2) |
| Residuals | v3 Block Attention-Residuals (attnres_block_size = 2 sublayers/block) |
| Loop routing | Per-pass query deltas (pass_w_delta), recency bias (pass_pos_bias), pass embedding (pass_emb), token-dependent AttnRes merge at loop exit |
| Attention | Multi-head Latent Attention (MLA), kv_compress = 48 / q_compress = 192 (10.7× KV compression) |
| Position / FFN / Norm | RoPE (GPT-NeoX) / SquaredReLU (4× hidden = 2048) / RMSNorm (pre-norm) |
| Vocab / Embeddings | 50,257 (GPT-2 BPE), tied input/output embeddings |
| Parameters | 46.81M unique (25.73M embedding + 21.07M backbone & loop routing) |
| Context length | 1024 |
How LoopedV3 works
The 8 physical layers form 8 AttnRes blocks (S = 2 sublayers per block):
- Prelude — blocks
[0, 2)(layers 0–1) run once. - Pass 1 — blocks
[2, 6)(layers 2–5) run once, attending over[emb, prelude, ...]. - Pass 2 — the same blocks
[2, 6)run a second time with a learned pass embedding, per-pass AttnRes query deltas, and recency-distance logit bias, attending over[emb, prelude, pass 1, current pass 2]. - Loop-exit merge — per-block token-dependent AttnRes merges Pass 1 and Pass 2 outputs
(learned
merge_biasfavors Pass 2 on all 4 looped blocks). - Coda — blocks
[6, 8)(layers 6–7) +attn_res_final.
Training
- Dataset: FineWeb-Edu, 5B tokens (
4,882,812sequences of length 1024), 1 epoch. - Optimizer: Hybrid Muon (64 weight matrices, 21.04M params) + AdamW (80 other tensors including embeddings, norms, and loop-control parameters, 25.77M params).
- Schedule / Compute: Batch size 32, chunked cross-entropy (8 chunks), bf16 AMP, per-block
torch.compile, ~12.1 hours on a single GPU.
License & attribution
- Model & code: Apache-2.0.
- Training data: FineWeb-Edu (ODC-BY).
- Built on ideas from: DeepSeek-V2 (MLA), Kimi Attention Residuals (arXiv:2603.15031), SenseNova-Loop (weight-shared depth looping), Muon optimizer, Primer (SquaredReLU), GPT-2 BPE.
- Downloads last month
- 140