CoolFace
Modelpublic

kerzgrr/Haiku-base

sourceHugging Faceapache-2.0updated 12d agoView on Hugging Face
2likes319downloads
Model Card

<div align="center">

Haiku-base

Pretrained base model for the Haiku family (~655M)

![Model](.) ![Stage-orange.svg)](.) ![License](LICENSE) ![Architecture](.) ![Demo](https://huggingface.co/spaces/kerzgrr/haiku-demo)

A larger TinyGDN hybrid: Kimi Delta Attention memory plus gated multi-head latent attention

</div>


What this is

Haiku-base is the pretrained (base) checkpoint for Haiku, the ~655M successor to the Tercet family.

  • —Scales `kerzgrr/Tercet-base` from ~502M to ~655M parameters
  • —Hybrid Kimi Delta Attention (KDA) recurrent layers + gated MLA (NoPE) full-attention layers
  • —Own 65,536 BPE tokenizer (not the Tercet 49k vocab)
  • —This repo is pretrain-only raw text continuation
  • —Chat / instruction SFT is not released

This base model is for continuation and research. It will not follow instructions reliably.


Model Architecture

Pipeline: Text Prompt → BPE-65K Tokenizer → Haiku Hybrid Decoder (36L) → Next-token Prediction

Hybrid block schedule (×36)

Every 4th layer is gated MLA; the rest are Kimi Delta Attention:

KDA, KDA, KDA, MLA, … (3:1 recurrent-to-attention)

ComponentDetails
Kimi Delta AttentionLinear-time recurrent memory (flash-linear-attention)
Gated MLADeepSeek-style latent KV, content-only QK (NoPE), full-rank output gate
MLPSiTU-GLU
ResidualsBlock attention residual
NormZero-centered RMSNorm
EmbeddingsTied input / output

Technical specifications

ArchitectureHaiku hybrid (KDA + gated MLA)
Parameters655,270,488 deployable
Hidden size1,024
Intermediate (MLP)3,840
Layers36 (27 KDA + 9 gated MLA)
Attention8 heads, Q LoRA rank 512, KV LoRA rank 256
Linear (KDA)8 heads × 128 dim
Context (trained)2,048
Max position embeddings32,768
Vocabulary65,536 (BPE)
RoPE θ1,000,000 (partial factor 0.5; used by KDA)
Precision (Hub weights)bfloat16 EMA
Weight filemodel.safetensors (~1.22 GiB)

Training (pretrain)

DatasetFineWeb-Edu (10.13B packed train tokens)
Tokens seen4,404,019,200
Sequence length2,048
ObjectiveNext-token prediction (+ MTP during training; not used at decode)
OptimizerHybrid Muon + AdamW — β₁=0.9, β₂=0.95
Peak LR2 × 10⁻⁴
Warmup1% of steps
Grad clip1.0
EMAKarras power EMA (γ=1.0, p=0.75, max decay 0.9999) — this Hub file is the EMA weights
Checkpointoptimizer step 8,400
Val loss (EMA)3.6904 (ppl 40.06)

Install

1) System requirements

  • —Python 3.10+
  • —CUDA GPU strongly recommended
  • —PyTorch with CUDA matching your driver

2) Create an environment

bash
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux / macOS
source .venv/bin/activate

3) Install PyTorch

Pick the build for your platform from https://pytorch.org. Example:

bash
pip install torch --index-url https://download.pytorch.org/whl/cu124

CPU-only:

bash
pip install torch

4) Install Python deps

bash
pip install safetensors tokenizers huggingface_hub

Flash Linear Attention is installed automatically by `inference.py` on first run (pinned commit + Windows import patches when needed). Git must be on PATH.

5) Download the inference script

bash
curl -L -o inference.py https://huggingface.co/kerzgrr/Haiku-base/resolve/main/inference.py

# or Hugging Face CLI
hf download kerzgrr/Haiku-base inference.py --local-dir .

The script auto-downloads model.safetensors, config.json, tokenizer.json, and the tiny_gdn/ package from this repo.


Quick start

Single prompt (streams tokens):

bash
python inference.py --prompt "The history of computing begins"

Interactive REPL:

bash
python inference.py

Common options:

FlagDefaultDescription
--prompt(none)One-shot continuation; omit for REPL
--temperature0.8Sampling temperature
--top-p0.95Nucleus sampling
--top-k50Top-k (0 disables)
--max-new-tokens256Generation length
--repetition-penalty1.08Repetition penalty
--context-length2048Tokens kept in the window
--seed42RNG seed
--devicecuda if availablecuda or cpu
--no-streamoffPrint the full completion at once
--no-bosoffDo not prepend `<\beginoftext\>`
--local-dir(none)Use a local snapshot directory

Files

kerzgrr/Haiku-base/
  README.md
  inference.py
  requirements.txt
  model.safetensors
  config.json
  tokenizer.json
  tokenizer_config.json
  special_tokens_map.json
  special_token_ids.json
  merges.txt
  vocab.json
  chat_template.jinja
  tiny_gdn/
    __init__.py
    config.py
    model.py
    haiku_layers.py
    nn_common.py

Limitations

  • —Base model: not instruction-tuned; may ramble or fail at Q&A format
  • —Scale: ~655M parameters — research / edge prototype, not a frontier model
  • —Dependency: requires flash-linear-attention (KDA); not GGUF / llama.cpp compatible today
  • —Context: trained at 2,048; longer windows are experimental

Model family

ModelParametersArchitectureStageHub
Monostich~100MLLaMA-styleSFT`kerzgrr/Monostich`
Monostich-2-base~150MTinyGDN hybridPretrain`kerzgrr/Monostich-2-base`
Monostich-2~150MTinyGDN hybridSFT`kerzgrr/Monostich-2`
Couplet-base~268MTinyGDN hybridPretrain`kerzgrr/Couplet-base`
Couplet~268MTinyGDN hybridSFT`kerzgrr/Couplet`
Tercet-base~502MTinyGDN hybridPretrain`kerzgrr/Tercet-base`
Tercet~502MTinyGDN hybridSFT`kerzgrr/Tercet`
Haiku-base~655MKDA + gated MLAPretrainthis repo

Citation

bibtex
@misc{haikubase2026,
  title={Haiku-base: A 655M Hybrid KDA + Gated-MLA Language Model},
  author={kerzgrr},
  year={2026},
  url={https://huggingface.co/kerzgrr/Haiku-base}
}

Acknowledgments


<div align="center">

A haiku is three lines — larger than a tercet, still compact.

</div>