Instructions to use ai-forever/Viridian-1-8B-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ai-forever/Viridian-1-8B-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ai-forever/Viridian-1-8B-Preview", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ai-forever/Viridian-1-8B-Preview", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ai-forever/Viridian-1-8B-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ai-forever/Viridian-1-8B-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai-forever/Viridian-1-8B-Preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ai-forever/Viridian-1-8B-Preview
- SGLang
How to use ai-forever/Viridian-1-8B-Preview 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 "ai-forever/Viridian-1-8B-Preview" \ --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": "ai-forever/Viridian-1-8B-Preview", "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 "ai-forever/Viridian-1-8B-Preview" \ --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": "ai-forever/Viridian-1-8B-Preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ai-forever/Viridian-1-8B-Preview with Docker Model Runner:
docker model run hf.co/ai-forever/Viridian-1-8B-Preview
Introduction
Viridian-1-8B (Preview) is a hybrid decoder-only language model designed for fast, efficient inference and long-context processing. It has 8 billion main-model parameters and a 250-million-parameter multi-token prediction (MTP) head for speculative decoding. The architecture comprises eight interleaved groups, with 24 KDA layers and eight MLA layers connected through Attention Residuals. The model uses NoPE (No Positional Encoding), omitting explicit positional encodings entirely. Its KDA layers support a native context window of 256K tokens, extendable to 1M tokens.
The model was trained on 5.3 trillion tokens during pretraining, 400 billion tokens during midtraining, and 50 billion tokens during SFT. Training focuses primarily on mathematics and agentic tasks, with Russian-language datasets introduced during midtraining. All training data is publicly available under permissive licenses.
Preview release: This repository contains the code and weights for the preview version. A full release with a larger pretraining token budget, agentic reinforcement learning alignment, and MLA sparsification is coming soon.
Highlights
- Viridian-1-8B sets a new state of the art among hybrid LLMs with 8 billion dense parameters, outperforming models with comparable sizes and training token budgets while competing with substantially more expensive models.
- KDA and MLA blocks combine efficient inference with native long-context support, without explicit positional encodings. Attention Residuals significantly improve training stability and reduce cross-entropy loss at the same token budget.
- We use model souping with exponential moving average (EMA) weights after each training stage to improve checkpoint stability and evaluation scores.
- The combination of KDA and Attention Residuals enables a 256K context window, extendable to 1M tokens with 100% recall on NIAH tasks in RULER.
- We release the full training recipes, including open-source dataset mixtures, training configurations, and evaluation code.
Checkpoints
| Stage | Context length | Training tokens | Link |
|---|---|---|---|
| Pretrain | 4K | 5.26 Trillion | Viridian-1-8B-Pretrain-Preview |
| Midtrain Stage 1 | 4K | 151.03 Billion | Viridian-1-8B-Midtrain-4K-Preview |
| Midtrain Stage 2 | 64K | 150.86 Billion | Viridian-1-8B-Midtrain-64K-Preview |
| Midtrain Stage 3 | 256K | 100.12 Billion | Viridian-1-8B-Midtrain-256K-Preview |
| SFT | 32K/128K | 48.9 Billion | Viridian-1-8B-SFT-Preview |
Quickstart
The examples below load a base checkpoint with either Transformers or vLLM. Viridian includes custom Hugging Face model code, so loading it through Transformers requires trust_remote_code=True.
Transformers
The following example requires an NVIDIA GPU and a compatible PyTorch/CUDA installation. MODEL_ID can also be a local directory containing the model files.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_ID = "ai-forever/Viridian-1-8B-Midtrain-256K-Preview"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
trust_remote_code=True,
dtype=torch.bfloat16,
).to("cuda").eval()
prompt = "The capital of France is"
# For base-model completion prompts, add BOS without appending EOS.
ids = [tokenizer.bos_token_id] + tokenizer.encode(
prompt, add_special_tokens=False,
)
input_ids = torch.tensor([ids], device="cuda")
with torch.inference_mode():
output = model.generate(
input_ids=input_ids,
attention_mask=torch.ones_like(input_ids),
max_new_tokens=64,
do_sample=False,
use_cache=True,
pad_token_id=model.config.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(output[0, len(ids):].tolist(), skip_special_tokens=True))
The portable PyTorch KDA reference backend prioritizes correctness and is slow for long prefills. Use the vLLM integration below for native GPU serving.
vLLM
The installable plugin is included in vllm_plugin/. It loads the same configuration, tokenizer, and SafeTensors shards as Transformers.
In a separate Python 3.11.18 environment, install the plugin and start the server:
pip install vllm==0.34.0
MODEL_ID="ai-forever/Viridian-1-8B-Midtrain-256K-Preview"
hf download "$MODEL_ID" --include "vllm_plugin/*" --local-dir viridian
pip install ./viridian/vllm_plugin
vllm serve "$MODEL_ID" \
--served-model-name viridian \
--dtype bfloat16 --tokenizer-mode viridian --enforce-eager \
--tensor-parallel-size 1 --max-model-len 4096 \
--max-num-seqs 4 --max-num-batched-tokens 1024 \
--no-enable-prefix-caching
Send a completion request:
curl http://localhost:8000/v1/completions \
-H 'Content-Type: application/json' \
-d '{"model":"viridian","prompt":"The capital of France is","max_tokens":32,"temperature":0}'
The 4,096-token serving limit is an initial inspection setting. For checkpoints with a larger configured window, increase --max-model-len after checking VRAM. The viridian tokenizer mode preserves the trained token IDs and applies the same in-memory BOS-only prompt handling as the Transformers example above.
Evaluation
Base model
The tables below report results for the base checkpoints, evaluated without chat templates.
Results depend on prompt formatting, few-shot examples, decoding settings, and answer extraction, so these settings should be matched across models. Scores reported for a task subset or a particular aggregation rule apply to that exact setup, rather than every variant of the benchmark. Long-context retrieval results describe a specific capability and should be considered alongside knowledge and reasoning scores.
Knowledge and math
| Benchmark | Viridian Pretrain | Viridian Midtrain Stage 1 | Viridian Midtrain Stage 2 | Viridian Midtrain Stage 3 | OLMo Hybrid 7B Base | Qwen 3 8B Base | ZGCM-1 7B Base | Instella-MoE-16B-A3B-Base |
|---|---|---|---|---|---|---|---|---|
| MMLU | 66.0 | 69.0 | 69.7 | 70.2 | 70.5 | 78.5 | 61.2 | 68.4 |
| MMLU STEM | 58.9 | 62.7 | 63.4 | 64.0 | 64.5 | 76.5 | 54.0 | 60.9 |
| MMLU Humanities | 67.2 | 69.8 | 71.0 | 71.4 | 71.7 | 77.7 | 64.1 | 70.2 |
| MMLU Social Sci. | 74.5 | 78.7 | 79.3 | 79.7 | 79.2 | 84.8 | 68.1 | 77.0 |
| PIQA | 74.6 | 56.6 | 74.3 | 81.0 | 81.6 | 87.4 | 74.5 | 77.9 |
| ARC Challenge | 57.3 | 60.5 | 60.6 | 60.8 | 59.6 | 63.0 | 55.3 | 57.9 |
| HellaSwag | 45.1 | 73.1 | 73.9 | 76.1 | 74.0 | 84.8 | 46.6 | 66.8 |
| Winogrande | 72.2 | 69.5 | 71.0 | 71.9 | 71.0 | 72.2 | 64.7 | 68.9 |
| GSM8K | 57.4 | 76.4 | 77.9 | 78.7 | 74.9 | 87.0 | 56.4 | 73.9 |
| MATH (5k), pass@1 | 19.2 | 35.6 | 38.4 | 38.5 | 33.1 | 40.3 | 19.4 | 26.6 |
| MATH (5k), maj@4 | 20.4 | 38.1 | 41.7 | 42.2 | 36.2 | 43.4 | 20.9 | 28.1 |
| BBH (17 tasks) | 38.5 | 50.1 | 52.9 | 53.7 | 42.0 | 52.6 | 34.4 | 41.3 |
Long context
| Benchmark | Viridian Pretrain | Viridian Midtrain Stage 1 | Viridian Midtrain Stage 2 | Viridian Midtrain Stage 3 | OLMo Hybrid 7B Base | Qwen 3 8B Base | ZGCM-1 7B Base | Instella-MoE-16B-A3B-Base |
|---|---|---|---|---|---|---|---|---|
| Native window | 4K | 4K | 64K | 256K | 64K | 32K | 16K | 64K |
| RULER 4K | 85.1 (99.0) | 88.7 (95.0) | 87.6 (95.4) | 88.4 (94.2) | 78.6 (93.9) | 92.6 (99.4) | 85.4 (99.4) | 84.3 (99.0) |
| RULER 8K | 74.0โ (90.8) | 82.4โ (94.6) | 86.2 (94.4) | 87.1 (93.8) | 77.5 (94.5) | 90.9 (99.9) | 79.9 (98.8) | 81.0 (99.8) |
| RULER 16K | 46.1โ (52.5) | 68.0โ (78.5) | 85.0 (93.8) | 86.0 (92.9) | 72.5 (93.1) | 88.2 (99.9) | 76.0 (98.0) | 79.0 (99.4) |
| RULER 32K | 27.8โ (35.4) | 50.7โ (62.3) | 80.1 (95.4) | 83.6 (93.4) | 70.4 (92.5) | 83.5 (99.1) | 21.9โ (19.9) | 74.4 (97.0) |
| RULER 64K | 12.6โ (11.5) | 43.9โ (57.1) | 76.6 (95.8) | 79.7 (93.5) | 70.3 (93.0) | 75.0โ (96.8) | 35.1โ (40.5) | 69.7 (97.9) |
| RULER 128K | 6.2โ (1.2) | 38.0โ (47.8) | 70.9โ (94.8) | 75.6 (93.2) | 66.3โ (91.9) | 20.4โ (27.3) | 28.1โ (28.0) | 25.0โ (33.4) |
| RULER 256K | 5.8โ (0.4) | 31.8โ (39.0) | 66.7โ (91.9) | 71.0 (93.2) | 64.4โ (88.4) | 0.0โ (0.0) | 26.0โ (27.3) | 4.1โ (0.0) |
| RULER 512K | 5.5โ (0.0) | 19.5โ (19.8) | 56.6โ (78.5) | 69.1โ (92.9) | 60.7โ (87.6) | 0.0โ (0.0) | 21.2โ (20.6) | 3.1โ (0.0) |
โ denotes evaluation beyond the model's native context window.
Instruct model
Coming soon.
Model Details
Architecture
The backbone contains eight groups of three KDA layers followed by one MLA layer, combining compact recurrent state with periodic full causal attention. Attention Residuals use learned weights to combine residual states across blocks. NoPE removes explicit positional encodings; token order is still represented through causal attention, recurrence, and short convolutions.
| Property | Value |
|---|---|
| Architecture | 32 decoder layers: 24 KDA and 8 NoPE MLA layers, with AttnRes |
| Hidden size | 4,096 |
| Vocabulary | 128,256 token IDs |
| Stored parameters (with MTP) | 8,313,537,098 |
| Configured context window | 256K tokens, prompt plus output |
| Weights | EMA, FP32 SafeTensors, seven shards |
| GPU inference dtype | BF16 |
| License | Apache-2.0 for the weights and code |
Training Configuration
Pretraining is followed by three midtraining stages at 4K, 64K, and 256K, before SFT at 32K and 128K. Midtraining retains pretraining replay while shifting the data mixture toward mathematics, code, reasoning, agentic tasks, and Russian-language content. Document masking is disabled during pretraining and the first midtraining stage, then enabled for the longer-context stages; EMA weights are used for stage handoffs.
| Stage | Context length | Training tokens | LR scheduler | Tokens per step | Document masking |
|---|---|---|---|---|---|
| Pretrain | 4K | 5.26 Trillion | Cosine, 3e-4 to 2.6e-5 | 15,728,640 | No |
| Midtrain Stage 1 | 4K | 151.03 Billion | Constant, 1.5e-4 | 8,388,608 | No |
| Midtrain Stage 2 | 64K | 150.86 Billion | Constant, 1.5e-4 | 16,777,216 | Yes |
| Midtrain Stage 3 | 256K | 100.12 Billion | Cosine, 1e-4 to 1e-5 | 134,217,728 | Yes |
| SFT | 32K/128K | 48.9 Billion | Not specified | Not specified | Yes |
Tokens per step are nominal input tokens, calculated as the configured global batch size multiplied by the sequence length. The SFT learning-rate schedule and batch settings have not been specified here.
Bias, Risks, and Limitations
Like other base models and fine-tuned models without safety filtering, Viridian can generate harmful, offensive, sensitive, or biased content. Such outputs may be elicited deliberately or produced unintentionally. Users should assess these risks for their intended application and implement appropriate safeguards. Generated statements can also be inaccurate or misleading, so important factual claims should be checked against reliable sources.
License
The model weights and code are licensed under the Apache License, Version 2.0.