Configuration Parsing Warning:In config.json: "quantization_config" must be an object

Omoikane-50M-Base

Omoikane (思兼) is a small hybrid language model built and trained end to end on a single Mac mini (Apple M4, 32 GB unified memory, no CUDA). It is named after the Shinto god of wisdom and thought, whose name means "the one who combines many thoughts". Like its namesake, the model combines many small experts and two kinds of memory.

This repository holds the base model: 48.9M parameters, pretrained from random initialisation for one epoch on a 995M-token mixture of web text, math and code, in 70 hours. It is the second checkpoint of the project, after the proof of concept, and uses the same architecture and the training recipe the PoC validated, on 10× the data.

This is a pretrained base model, not an assistant: it continues text and has no instruction tuning. Context-extended, instruction-tuned and preference-trained versions are planned (see Model family below).

Omoikane architecture

Architecture

Omoikane mixes two kinds of sequence mixers, each used where it is cheapest:

  • Gated DeltaNet (GDN) layers (8 of 10): linear-time recurrent layers with a fixed-size state per head, updated by the gated delta rule S_t = α_t (I − β_t k_t k_tᵀ) S_{t−1} + β_t k_t v_tᵀ. O(1) per token at inference, and no notion of absolute position.
  • Multi-head Latent Attention (MLA) layers (2 of 10, layers 3 and 7): full attention for exact recall, with a low-rank compressed KV cache, decoupled RoPE and a sigmoid output gate.
  • Fine-grained Mixture-of-Experts feed-forward blocks (layers 1–8): 16 small experts, top-4 group-limited sigmoid routing, a shared expert, and aux-loss-free load balancing.
  • A multi-token-prediction (MTP) head that predicts token t+2 (extra training signal; a possible self-speculative drafter).
Omoikane-50M
Parameters 48.9M total: 33.6M tied embedding + 15.4M trunk (~41.8M active per token)
Layers 10 + MTP; GDN everywhere except MLA at 3 and 7; dense SwiGLU at 0 and 9; MoE in 1–8
Width d = 256; GDN 4 heads (K = V = 64, chunk 128); MLA 4 heads (q-rank 128, kv-rank 64, 48 nope + 16 RoPE dims, θ = 1e5)
MoE 16 experts × 96, top-4 within 2 of 4 groups, + 1 shared expert
Vocabulary 131,072-token byte-level BPE, tied input/output embedding
Trained context 1,024 tokens (loss stays flat up to at least 4,096; see below)

Training

Training pipeline

setting value
Data 995.0M tokens, 1 epoch: 70% openbmb/Ultra-FineWeb (en), 20% openbmb/UltraData-Math (L3 textbook exercises), 10% openbmb/UltraData-Code (L3, 11 languages); packed 1,024-token windows
Steps 60,730 optimizer steps × 16,384 tokens (micro-batch 8 × 1,024, 2 gradient-accumulation steps)
Optimizer Muon (Nesterov 0.95, 5 Newton–Schulz steps, RMS-matched) for hidden matrices; AdamW for embedding, router, norms, scalars; wd 0.1
Schedule 5% warmup → constant 6e-3 → linear decay to 6e-4 over the last 20% (WSD; decay from step 48,584)
Loss next-token CE + 0.1 × MTP CE (25% of positions) + 1e-4 MoE balance loss
Stack MLX 0.32 + custom Metal kernel for the gated-delta recurrence, mx.compile; fp32 weights, bf16 vocab GEMMs
Hardware / time Mac mini M4, 32 GB, 70.3 hours, median 4,340 tokens/s, 13.1 GB peak memory

Training curve

step 1k 5k 10k 20k 30k 40k 48.6k (decay starts) 52k 55k 58k 60,730
validation loss 4.649 3.775 3.663 3.617 3.601 3.592 3.586 3.510 3.438 3.337 3.2016
validation perplexity 104 43.6 39.0 37.2 36.6 36.3 36.1 33.4 31.1 28.1 24.6

The learning-rate decay did most of the late work. At the constant peak LR the loss plateaued (3.617 → 3.586 over the 460M tokens from step 20k to 48.6k). The final 20% linear decay then took it from 3.586 to 3.2016 (−0.38 nats), more than all progress after step 10k combined. Training was stable throughout: no divergence or loss spikes, gradient norm median 0.40, expert load within ~1.2× of the mean, and train vs validation loss at the end 3.211 vs 3.202 (no overfitting; no data was repeated).

Evaluation

Held-out loss: Base vs PoC

Held-out loss by domain

eval set PoC (104M tokens, web only) Base (995M tokens)
1B-mix test, all sources 4.343 3.198 (ppl 24.5)
web (Ultra-FineWeb) 4.122 3.937 (ppl 51.3)
math (UltraData-Math) 4.637 1.055 (ppl 2.9)
code (UltraData-Code) 5.299 1.954 (ppl 7.1)
fineweb-edu validation 4.011 4.079 (ppl 59.1)

The base model is far better on everything in its training mix. The math test set is synthetic textbook exercises, which are very predictable text, so read its low loss as "learned the format" rather than "can do math". On fineweb-edu, which the PoC trained on but the 1B mix does not contain, Base is slightly worse: a change of domain, not a regression.

Zero-shot benchmarks

Zero-shot accuracy, PoC vs Base

1,000 examples per task (the same subsets for both models; BLiMP: 938 pairs over all 67 phenomena), lm-evaluation-harness-style prompts and loglikelihood scoring (custom MLX harness, so comparisons with other papers are approximate).

task PoC Base chance
SciQ 60.0% 65.9% 25%
PIQA 54.6% (norm 54.6%) 55.0% (norm 57.5%) 50%
ARC-Easy 39.2% (norm 36.4%) 39.4% (norm 38.1%) 25%
HellaSwag 25.8% (norm 27.1%) 26.4% (norm 27.7%) 25%
LAMBADA (exact last word) 9.8% 10.1% 0%
BLiMP (grammar) 72.9% 71.3% 50%
Winogrande 50.7% 47.8% 50%

The zero-shot results moved much less than the loss did. SciQ (+5.9 points) and the length-normalised PIQA/ARC/HellaSwag scores improved; BLiMP and Winogrande are within noise of the PoC (±1.5 points standard error). At 15.4M trunk parameters the model is capacity-limited on these tasks, and much of the 1B mix's extra signal (math, code) doesn't target them.

Does every part of the architecture do work?

Component knock-outs

Zeroing a component's output at inference time (measured on fineweb-edu validation text) shows how much the trained model relies on it. Compared with the PoC, the routed experts carry more (+1.60 vs +1.05 nats), and the first and last GDN layers became critical (+1.15 and +1.22). Removing every GDN layer still breaks the model (+6.7). MLA layer 7 carries clear load (+0.17); MLA layer 3 matters little at this point (+0.02). The shared expert stays nearly redundant (+0.05), a design note for future versions.

Experts specialise by domain

With math and code in the training mix, the experts now separate the domains much more clearly than in the PoC. The Jensen–Shannon divergence between expert-usage distributions on web vs math text reaches 0.21 (layer 3) and 0.18 (layer 8), against ≤ 0.07 in the PoC, and math vs code, which the PoC treated identically (0.003), now separates too (up to 0.07). All experts stay in use (routing entropy 0.96–0.99 of the maximum).

GDN memory and length generalisation

GDN memory horizons

The recurrent heads again split into long-memory heads (hundreds of tokens) and very local ones (a few tokens). The average head's memory horizon moved ~2.7× from initialisation.

Loss by position up to 4,096 tokens

Trained only on 1,024-token windows, the model's loss stays flat out to 4,096 tokens (4.098 / 4.013 / 4.076 / 4.064 by 1,024-token segment on fineweb-edu validation), with no context-extension training. A zero-shot sweep of the RoPE base shows a larger θ helps long documents slightly (mean loss over positions 1k–4k on 51 long validation documents: −0.012 / −0.023 / −0.032 for θ = 2.5e5 / 5e5 / 1e6, at a short-context cost of +0.001 / +0.004 / +0.007). That's input for the planned 4K version.

Multi-token prediction

The MTP head predicts token t+2 with 25.6% top-1 accuracy (the main head predicts t+1 with 31.1%). Its draft matches the main model's own greedy choice 58.5% of the time, roughly a 1.3–1.5× greedy-decoding speed-up with self-speculative decoding.

Usage

🤗 Transformers (PyTorch)

The model uses custom code, so pass trust_remote_code=True. generate(), pipelines, streamers, beam search and batched left-padded prompts are supported.

from threading import Thread

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer

repo = "Goekdeniz-Guelmez/Omoikane-50M-Base"
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.float32).eval()

prompts = [
    "Photosynthesis is the process by which plants convert light energy into chemical energy.",
    "Once upon a time, there was a little robot who lived in a big city called New York. He loved to play with his friends and help them learn new things.",
    "Question: Sara has 14 apples and gives away 5. How many apples does she have left?\nAnswer:",
    "def fibonacci(n):\n    \"\"\"Return the n-th Fibonacci number.\"\"\"\n",
]

for prompt in prompts:
    inputs = tokenizer(prompt, return_tensors="pt")
    streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
    thread = Thread(target=model.generate, kwargs=dict(
        **inputs, streamer=streamer, max_new_tokens=64,
        do_sample=True, temperature=0.8, top_p=0.95, repetition_penalty=1.1,
    ))
    thread.start()
    print(f"\n>>> {prompt}", flush=True)
    for chunk in streamer:
        print(chunk, end="", flush=True)
    thread.join()
    print()

Greedy decoding tends to loop at this model size; sampling (as above) with a mild repetition penalty works better. The model keeps a recurrent state, so it uses its own cache (OmoikaneCache); assisted decoding through generate() is not supported. On Apple-silicon PyTorch (MPS), separate runs can differ slightly numerically, so use CPU for bit-exact outputs.

MLX (Apple silicon)

modeling_omoikane_mlx.py is the MLX implementation the model was trained with. It loads the same model.safetensors. Run from inside the downloaded folder:

import mlx.core as mx
from tokenizers import Tokenizer
from modeling_omoikane_mlx import load_model

model, _ = load_model(".")
tok = Tokenizer.from_file("tokenizer.json")

def generate(prompt, max_new_tokens=48, temperature=0.8):
    ids = tok.encode(prompt, add_special_tokens=False).ids
    cache, out = {}, []
    logits = model(mx.array([ids]), cache=cache, offset=0)[:, -1]
    for pos in range(len(ids), len(ids) + max_new_tokens):
        nxt = mx.random.categorical(logits / temperature)
        if nxt.item() == 1:  # <|end|>
            break
        out.append(nxt.item())
        logits = model(nxt[:, None], cache=cache, offset=pos)[:, -1]
    return tok.decode(out)

print(generate("Photosynthesis is the process by which plants convert light energy into chemical energy."))

Limitations

  • Small model. The trunk has 15.4M parameters (the 131k-token embedding holds the other 33.6M). Expect fluent but factually loose text, weak reasoning, and near-chance commonsense benchmarks.
  • Base model. No instruction tuning, alignment or safety training; it continues text and may produce wrong or inappropriate content.
  • Math and code are learned as formats. The low math/code losses reflect predictable synthetic data, not problem-solving ability.
  • No baseline yet. The results show the architecture trains stably and uses all its parts. They do not show that Omoikane beats a standard transformer of the same size; a same-budget dense baseline is still to come.
  • 1,024-token training context (works zero-shot to 4,096; a dedicated 4K version is planned). English only.

Model family

model what it is status
Goekdeniz-Guelmez/Omoikane-50M-PoC proof of concept: 104M tokens of fineweb-edu released
Goekdeniz-Guelmez/Omoikane-50M-Base-Phase-1 (this repo) pretraining on the 995M-token mix released
Goekdeniz-Guelmez/Omoikane-50M-Base-Phase-2 Base with context extended to 4,096 tokens planned
Goekdeniz-Guelmez/Omoikane-50M-SFT instruction-tuned (SFT on UltraData-SFT-2605, ChatML) planned
Goekdeniz-Guelmez/Omoikane-50M Instruct + preference training planned

Files

file what
model.safetensors weights (fp32, 48.9M parameters, tied embedding stored once)
config.json, configuration_omoikane.py model config (model_type: omoikane)
modeling_omoikane.py PyTorch / 🤗 Transformers implementation (OmoikaneForCausalLM)
modeling_omoikane_mlx.py MLX implementation used for training
tokenizer.json, tokenizer_config.json 131,072-token byte-level BPE (`<
generation_config.json sampling defaults (T = 0.8, top-p 0.95)
trainer_state.json final step, token count and training arguments
assets/ figures used in this card

Project

Code, training logs, the data pipeline, analysis and the technical report live in the main project repository (currently Goekdeniz-Guelmez/Anthropic-Numbat on the Hugging Face Hub, to be renamed Goekdeniz-Guelmez/Omoikane). Author: Gökdeniz Gülmez.

Downloads last month
52
Safetensors
Model size
48.9M params
Tensor type
F32
·
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train Goekdeniz-Guelmez/Omoikane-50M-Base-Phase-1

Collection including Goekdeniz-Guelmez/Omoikane-50M-Base-Phase-1