File size: 5,910 Bytes
adec9f3
 
dc47fb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adec9f3
dc47fb0
 
 
33feae2
 
 
 
dc47fb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33feae2
 
 
 
 
 
 
 
dc47fb0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
license: apache-2.0
language:
  - uk
  - en
  - ru
  - pl
  - cs
  - be
library_name: transformers
pipeline_tag: text-generation
tags:
  - udream
  - moe
  - mixture-of-experts
  - ukrainian
  - nope
  - sliding-window-attention
  - from-scratch
  - custom_code
---

# UDream 1.0 Base (`UDream/UDream-1.0-Base`)

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24653108.svg)](https://doi.org/10.5281/zenodo.24653108)

**Technical Report (Preprint):** [Zenodo (DOI: 10.5281/zenodo.24653108)](https://doi.org/10.5281/zenodo.24653108) · **Project Page:** [udream.com.ua](https://udream.com.ua)

**UDream 1.0 Base** is a from-scratch **Ukrainian-first sparse Mixture-of-Experts (MoE)** pretrained base language model (**4.14B backbone / 4.20B total parameters**, **1.44B active backbone / 1.50B full active**), trained on **63.73B tokens** plus a **32k Long-Context Bridge** (32.8M tokens) on a single 2× NVIDIA RTX 5090 workstation.

> **Staged Release Note:** This repository hosts the **Base** checkpoint (`step=972,500` + 32k context bridge, trained exclusively on public web/news/wiki corpora) alongside the `udream-64k` tokenizer and evaluation scripts. Conversational chat weights (`UDream-1.0-Chat`, with active 8D hormonal dialogue alignment) will be released separately after ongoing on-policy DPO alignment.

---

## Architecture Summary

| Property | Specification |
|---|---|
| Architecture | Decoder-only Sparse MoE Transformer (`UDreamForCausalLM`) |
| Parameters (Total / Active) | **4.14B / 1.44B** backbone (`4.20B / 1.50B` incl. 8D conditioning subsystem; 1.31B non-emb active) |
| Layers & Width | 26 layers (`d_model=2048`): 4 dense (`0,1,24,25`, `d_ff=5632`) + 22 MoE |
| MoE Configuration | 32 routed experts (`d_ff=768`, `top_k=6`) + 1 always-active shared expert (`d_ff=2048`), dropless |
| Hybrid Attention (5:1) | 22 sliding-window local layers (`w=512`, RoPE `10k`) + 4 global **NoPE** layers (`5,11,17,23`) |
| GQA & Context Length | 16Q / 4KV (`head_dim=128`), QK-RMSNorm, **32,768 tokens** (278 MB bf16 KV-cache at 32k) |
| Tokenizer | `udream-64k` ByteLevel BPE (`vocab_size=64,128`) with integrated 7-variant Ukrainian apostrophe normalization |
| Compression (Ukrainian) | **7.40 B/tok** (`uk_fineweb`), **7.46 B/tok** (`Belebele-uk`), **7.81 B/tok** (`fresh_news_sep`) |

---

## Quickstart (`transformers`)

Because `UDreamForCausalLM` uses a custom hybrid 5:1 SWA+NoPE architecture and optional 8D conditioning hooks, pass `trust_remote_code=True`.  
During pretraining, public web/encyclopedic/news documents were prefixed with `<doc><lang:uk>` (or `<lang:en>`, etc.) and **never** use `<bos>`.

```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

repo_id = "UDream/UDream-1.0-Base"
tok = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    repo_id,
    trust_remote_code=True,
    dtype=torch.bfloat16,
    device_map="cuda",
).eval()

prompt = "<doc><lang:uk>Київ — столиця України, розташована на річці Дніпро."
ids = tok(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)

with torch.inference_mode():
    out = model.generate(
        **ids,
        max_new_tokens=64,
        do_sample=True,
        temperature=0.7,
        top_p=0.9,
        pad_token_id=tok.pad_token_id,
        eos_token_id=tok.eos_token_id,
    )

print(tok.decode(out[0], skip_special_tokens=True))
```

---

## Honest Evaluation Results (Same RTX 5090, bf16)

All 9 models below were evaluated on identical hardware (`cuda:0`, bf16) with verified `<bos>` and right-padding batch invariance (`eval/bench_official_suite.py`):

| Model | Params (M) | B/tok (`Bel/News`) | News BPB ↓ | Belebele-uk (`Clz/0s/5s`) | ZNO-uk (`0s/5s`) | G-MMLU CS (`Clz/0s/5s`) | Meme Facts (259) | Catch BPB ↓ (90) |
|---|---:|---:|---:|---:|---:|---:|---:|---:|
| **UDream 1.0 Base** | 4,201.5 | **7.46 / 7.81** | 0.4057 | 33.2 / 24.4 / 22.6 | 22.6 / 20.0 | 24.9 / 23.5 / 24.8 | 60.2% | **0.7841** |
| Gemma-4-E2B Base | 5,104.3 | 5.65 / 5.56 | 0.4114 | 44.2 / 56.1 / 72.0 | 33.8 / 38.9 | 31.9 / 45.2 / 49.1 | 54.0% | 1.0317 |
| Qwen3.5-4B Base | 4,539.3 | 5.17 / 5.14 | 0.4700 | 49.2 / 86.2 / 88.0 | 46.9 / 45.4 | 35.1 / 65.7 / 66.9 | 51.7% | 1.1781 |
| Gemma-4-E4B Base | 7,941.1 | 5.65 / 5.56 | **0.3866** | **50.3 / 80.2 / 86.7** | **50.7 / 50.2** | **35.6 / 57.5 / 64.4** | **68.0%** | 0.9351 |
| MamayLM-12B-v2 *(IT)* | 12,187.3 | 5.65 / 5.56 | **0.3634** | **60.9 / 89.8 / 91.2** | **63.6 / 63.5** | **47.3 / 70.5 / 73.9** | **74.1%** | 0.8460 |

- **Strengths:** Highest Ukrainian byte compression (**+32–52%** vs Gemma-4 / Qwen3.5 with a 4× smaller vocabulary), lower unseen fresh Ukrainian news BPB (**0.4057**) than `Gemma-4-E2B Base` (0.4114) and `Qwen3.5-4B Base` (0.4700), lowest `Meme Probe v1` catchphrase BPB (**0.7841**) across all nine evaluated models, and **100%** plain-text Ukrainian NIAH recall across 4k–28.7k tokens (`niah_base_972500.json` vs post-bridge).
- **Limitations:** As a 63.73B-token specialized model (~28B Ukrainian tokens), `UDream-1.0-Base` is not intended for formal academic exams, STEM reasoning, or code generation (`Belebele-uk`, `ZNO-uk`, and `Global-MMLU-uk` remain near random chance). Note also that `Meme Probe v1` tests in-domain pretrain acquisition/retention (all 259 topics and 90 catchphrases appear in the pretrain meme sub-corpus).

---

## Citation

```bibtex
@misc{dormidontov2026udream10,
  author    = {Dormidontov, Oleksandr},
  title     = {{UDream 1.0: A From-Scratch Ukrainian Sparse MoE Conversational Language Model with Continuous 8D Hormonal Conditioning and Hybrid 32k Context}},
  month     = nov,
  year      = {2026},
  publisher = {Zenodo},
  version   = {1.0},
  doi       = {10.5281/zenodo.24653108},
  url       = {https://doi.org/10.5281/zenodo.24653108}
}
```