Text Generation
Transformers
Safetensors
udream
Mixture of Experts
mixture-of-experts
ukrainian
nope
sliding-window-attention
from-scratch
custom_code
Instructions to use UDream/UDream-1.0-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use UDream/UDream-1.0-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="UDream/UDream-1.0-Base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("UDream/UDream-1.0-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use UDream/UDream-1.0-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "UDream/UDream-1.0-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "UDream/UDream-1.0-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/UDream/UDream-1.0-Base
- SGLang
How to use UDream/UDream-1.0-Base 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 "UDream/UDream-1.0-Base" \ --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": "UDream/UDream-1.0-Base", "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 "UDream/UDream-1.0-Base" \ --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": "UDream/UDream-1.0-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use UDream/UDream-1.0-Base with Docker Model Runner:
docker model run hf.co/UDream/UDream-1.0-Base
|
Download README.md from UDream/UDream-1.0-Base: direct link, hf CLI and curl.
- Browser
- Download file 5.91 kB
-
https://huggingface.co/UDream/UDream-1.0-Base/resolve/main/README.md
- Command line
-
hf download hf://UDream/UDream-1.0-Base/README.md
-
curl -L -o README.md https://huggingface.co/UDream/UDream-1.0-Base/resolve/main/README.md
5.91 kB
| 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`) | |
| [](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} | |
| } | |
| ``` | |