Downloads · 30 days
15
17% of all-time downloads
ksopyla/gemma3-concepts-1b-c128-1bt
gemma3-concepts-1b-c128-1bt is a text generation model from ksopyla. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
Gemma-3-1B with a grafted shared depth-recurrent concept memory (C=128). Research release from MrCogito experiment E16b: trained for ~1B tokens at seq 4096 on a long-document mix.
Downloads · 30 days
15
17% of all-time downloads
All-time downloads
88
Public
Parameters
1B
2.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2 GB · 98%
How the weights are stored.
BF161B · 99%
From the Hugging Face model README
Gemma-3-1B with a grafted shared depth-recurrent concept memory (C=128). Research release from MrCogito experiment E16b: trained for ~1B tokens at seq 4096 on a long-document mix.
Claim level: mechanism success — concepts are causally used (ablating them raises long-range CE a lot). Generation quality is not the claim: this is a research base LM, not instruction-tuned, and open-ended text is often weak or repetitive. Do not treat samples as evidence of a strong generative model. Also not a GLUE / chat-arena SOTA claim.
| Hub id | ksopyla/gemma3-concepts-1b-c128-1bt |
| Line / size / C / budget | gemma3-concepts · 1b · c128 · 1bt |
| Experiment | E16b — long-context Muon scale-up |
| Run id | backbone_concept_gemma_3_1b_pt_K512_concept_20260718_150850 |
| Checkpoint | checkpoint-7900 (best by eval CE) |
| Parameters | ~1.01B (full checkpoint: frozen Gemma + LoRA + concepts) |
| Tokenizer | Gemma-3 (files shipped in this repo) |
| Developed by | Krzysztof Sopyła · ai.ksopyla.com |
| Code | github.com/ksopyla/MrCogito |
| Project page | Concept Encoder |
| Spec | E16b |
| Run report | 2026-07-25 |
| W&B | training run |
| Base model | google/gemma-3-1b-pt |
What it is
z ∈ R^{C×H}.What it is not
AutoModelForCausalLM without MrCogito.git clone https://github.com/ksopyla/MrCogito.git
cd MrCogito
uv sync
Accept the Gemma license on Hugging Face if prompted.
import torch
from transformers import AutoTokenizer
from nn.backbone_concept_lm import BackboneConceptLM
repo_id = "ksopyla/gemma3-concepts-1b-c128-1bt"
if torch.cuda.is_available():
device, dtype = "cuda", torch.bfloat16
elif getattr(torch.backends, "mps", None) and torch.backends.mps.is_available():
device, dtype = "mps", torch.float32 # fp16 often NaNs on Apple MPS
else:
device, dtype = "cpu", torch.float32
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = BackboneConceptLM.from_pretrained(repo_id, torch_dtype=dtype).to(device).eval()
prompt = "Once upon a time, in a quiet library at the edge of the city,"
inputs = tokenizer(prompt, return_tensors="pt").to(device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=64,
do_sample=True,
temperature=0.8,
top_p=0.95,
)
print(tokenizer.decode(out[0], skip_special_tokens=True))
Research API — concept ablation (same generate / forward path):
# concept_mode: "real" | "zero" | "shuffle" | "static" | "one_block"
out = model.generate(**inputs, max_new_tokens=32, concept_mode="shuffle")
Playground notebook: playground/e16b_generation_playground.ipynb.
concept_mode=…).BackboneConceptLM lives in MrCogito; clone the repo.max_new_tokens small
(≈64–128 on laptop GPU/MPS).float32.MrCogito is a research bet that reasoning should eventually happen in a compact concept space, not only as next-token prediction over text:
long input (text today; audio/vision later)
→ compress into C latent concept vectors (C ≪ N)
→ refine / reason in concept space (recursion, depth, …)
→ decode / crystallise back to tokens (training signal + human interface)
The belief behind that stack:
Full write-up: vision and goals · living agenda · ai.ksopyla.com.
E16b is not the full encode→recursive-reason→decode stack yet. It is a Gemma graft: keep a strong frozen decoder LM, add a small shared concept workspace, and ask a sharper mechanism question —
when next-token loss can already be solved from local Gemma context, do concepts ever become causally necessary?
Earlier short-context runs (E10–E16a, seq 2048, ≤100M tokens) often kept concept geometry healthy (high RankMe) while beyond-local ablation ΔCE stayed near zero. E16b changes the operating regime (seq 4096, long-document mix, Muon, 1B tokens) and clears that gate: ablating concepts at long positions hurts a lot. That validates one path for causally load-bearing concept memory — a platform to build recursive / latent-reasoning ideas on — without closing other routes (from-scratch AR, diffusion, etc.).
input_ids [B, L]
│
▼ consume in blocks of K=512
┌───────────────────────────────────────────────┐
│ Gemma-3-1B decoder (frozen) + LoRA adapters │
│ │
│ local / sliding layers → standard Gemma │
│ global (full-attn) layers: │
│ 1. run original Gemma layer │
│ 2. READ concepts → tokens (gated xattn) │
│ 3. WRITE tokens → concepts (BiXT update) │
└───────────────────────────────────────────────┘
│
▼
shared concept state z [B, C=128, H=1152]
│ carried across blocks (recurrent memory)
▼
LM head @ last position → next-token logits
Mechanics in short:
z, gated so early training can stay near the frozen backbone.zero / shuffle / static / one_block break the memory on
purpose; large ΔCE means the intact model was using it.| Property | Value |
|---|---|
| Class | BackboneConceptLM (model_type=backbone_concept) |
| Backbone | Gemma-3-1B-pt frozen + LoRA r=16, α=32 on q/k/v/o_proj |
| Hidden / layers | 1152 / 26 |
| Concepts (C) | 128 |
| Concept block (K) | 512 (= Gemma sliding window) |
| Concept I/O | shared_depth_recurrent + read RMSNorm; gate init 0.01 |
| Train seq length | 4096 (8 concept blocks) |
Code: nn/backbone_concept_lm.py.
Training used the frozen mix recipe e16b_long_4k_v1 — a long-document-heavy
causal-LM mix at seq length 4096, designed so enough documents span multiple
concept blocks (target: ≥40% of docs >2k tokens, ≥20% >4k).
| Mix id | e16b_long_4k_v1 |
| Recipe (source of truth) | data/mix_recipes/e16b_long_4k_v1.json |
| Launcher | scripts/launch_e16b.sh → scripts/launch_e10.sh |
| Pretokenizer | scripts/pretokenize_mix.py |
| Tokenizer | google/gemma-3-1b-pt (Gemma 3 SentencePiece; vocab 262 144; same tokenizer shipped in this Hub repo) |
| Max sequence length | 4096 tokens (truncation; no cross-document packing) |
| Token cache tree | datasets_tok_gemma_4k (isolated from the 2K Gemma caches) |
| Manifest (training) | {DATASETS_TOK_DIR}/e16b_long_4k_v1_gemma_manifest.json |
| Objective fit | causal_lm (also marked compatible with reconstruction / prefix→suffix) |
Weights are document-sampling mixture weights from the recipe (sum = 1.0). They are not guaranteed equal to final non-padding token mass after truncation, but they define the intended corpus balance.
| Role | Weight | Source name | Hub dataset | Config / subset | Split | Text field | Caps (recipe) |
|---|---|---|---|---|---|---|---|
| Long PDF prose | 30% | finepdfs_100BT | HuggingFaceFW/finepdfs_100BT | default · data/*.parquet | train | text | ≤16 shards · ≤2.5M samples |
| Book-length narrative | 18% | pg19 | emozilla/pg19 | default · data/train-*.parquet | train | text | ≤23 shards · ≤50k samples |
| Web fluency | 15% | dclm_baseline | mlfoundations/dclm-baseline-1.0 | global-shard_01_of_10/* (.jsonl.zst) | train | text | ≤40 shards · ≤1.5M samples |
| Entity-dense encyclopedic | 12% | wikipedia_en | wikimedia/wikipedia | 20231101.en · train-*.parquet | train | text | ≤41 shards · ≤2M samples |
| Edu web | 10% | fineweb_edu | HuggingFaceFW/fineweb-edu | sample-10BT · sample/10BT/*.parquet | train | text | ≤8 shards · ≤1.5M samples |
| Code / markdown | 10% | stack_edu_py_js | meryyllebr543/stack-edu-huggingface | python + files python.parquet, javascript.parquet, typescript.parquet, markdown.parquet | train | text | ≤1M samples |
| Math | 5% | finemath_3plus | HuggingFaceTB/finemath | finemath-3plus | train | text | ≤10 shards · ≤800k samples |
Long vs fluency split (by weight): long/coherent tier ≈ FinePDFs 30% + PG19 18% + Wikipedia 12% = 60%; fluency/code/math ≈ DCLM 15% + FineWeb-Edu 10% + Stack-Edu 10% + FineMath 5% = 40%.
e16b_long_4k_v1 Gemma-4K manifest (see Evaluation).| Name | google/gemma-3-1b-pt |
| Type | Gemma 3 / SentencePiece (as shipped by the backbone) |
| Vocab size | 262 144 (config.json / tokenizer) |
| Special ids (this ckpt) | bos=2 · eos=1 · pad=0 |
| In this Hub repo | tokenizer.json, tokenizer_config.json, special_tokens_map.json |
| Training flag | TOKENIZER_NAME=google/gemma-3-1b-pt in launch_e10.sh (E16b inherits) |
Load either from this repo or from the backbone id — they match the training tokenizer.
| Property | Value |
|---|---|
| Objective | causal next-token CE (block-recurrent) |
| Optimizer | Muon 0.01 / wd 0.1 / AdamW LR 2e-4 |
| Budget | ~1B non-padding tokens · 7,905 steps |
| Batch / seed | effective batch 72 · seed 42 |
| Best eval CE | 1.621 @ step 7900 (from 2.269 early) |
| Property | Value |
|---|---|
| Hardware | Odra — 3× RTX 3090 (24 GB) |
| Wall time | ~38.3 h |
| GPU-h | ~114.9 |
| Energy | ~34.4 kWh |
Protocol (Tier-1, 2026-07-25): pretokenized e16b_long_4k_v1, seq 4096,
buckets 1024,2048, 24 docs × 2 seeds.
Summary: within-sample RankMe stays high (~101/128) and beyond-local concept
ablations clear the pre-registered ≥0.01 gate by a large margin
(min(Δstatic, Δshuffle)_beyond ≈ 2.35 nats).
| Metric | Value |
|---|---|
| within-sample RankMe (mean) | 101.0 / 128 |
| within-sample RankMe (centered) | 107.9 |
| collapsed dimensions | 0 |
| active slot fraction | 1.0 |
| mean pairwise concept cosine | 0.32 |
Higher Δ ⇒ ablating concepts hurts next-token CE (model was using them).
| Ablation | Δ overall | Δ beyond (≥1024) | Δ early |
|---|---|---|---|
| shuffle | 2.15 | 2.47 | 2.05 |
| static | 2.00 | 2.35 | 1.95 |
| one-block | 0.27 | 0.58 | ~0.007 |
| Position bucket | Δshuffle | Δzero | n |
|---|---|---|---|
| (0, 1024] | 2.12 | 1.17 | 3 |
| (1024, 2048] | 2.29 | 1.76 | 3 |
| (2048, 4096] | 1.99 | 1.70 | 2 |
| Criterion | Result |
|---|---|
min(Δstatic, Δshuffle)_beyond ≥ 0.01 | PASS (~2.35, ~235× gate) |
| RankMe ≥ 38.4 | PASS (101) |
| Depth utilization | PASS |
| Run | Budget / seq | RankMe | min beyond Δ |
|---|---|---|---|
| E10 / E10e | 100M / 2K | 77–100 | ~0.001 |
| E16a Muon | 100M / 2K | 97 | 0.0028 |
| E16b (this) | 1B / 4K | 101 | ~2.3 |
| Probe | Status |
|---|---|
| STS-B zero-shot | not run |
| SICK / PAWS / GLUE | not run |
| Generation vibe-check metrics | not published (playground only) |
| Chat / IFEval / MT-Bench | not trained / not run |
@misc{sopyla2026gemma3-concepts-1b-c128-1bt,
author = {Sopyła, Krzysztof},
title = {gemma3-concepts-1b-c128-1bt (E16b)},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/ksopyla/gemma3-concepts-1b-c128-1bt},
note = {Gemma-3-1B + C=128 shared-depth concepts; 1B-token long-ctx Muon}
}
Please also respect the Gemma 3 terms / base model card.
license: gemma — weights derived from
google/gemma-3-1b-pt.
Krzysztof Sopyła — https://ai.ksopyla.com · https://github.com/ksopyla