/ Модель

Характеристики

Лицензия
MIT
Библиотека
pytorch
Опубликована
3 окт 2026

minicpm-3b-effective-muon

Генерация текстаТекст → текст

Экспериментальная компактная языковая модель с повторным использованием трансформерного блока для генерации текста и исследований архитектуры Universal Transformer и оптимизатора Muon.

147скачиваний за 30 дней0лайковвеса обновлены3 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

MiniCPM-3B-Effective-Muon — экспериментальная языковая модель antontuzovAI, вдохновлённая MiniCPM и Qwen. Это авторская архитектура Universal Transformer: один блок QwenBlock повторяется 20 раз с добавлением векторов глубины. В блоке используются Grouped Query Attention с 16 головами запросов и 4 головами ключей и значений, RoPE, SwiGLU и RMSNorm. Физический размер модели — около 166 млн параметров; заявленный эффективный объём вычислений соответствует примерно 3,3 млрд параметров. Для матричных весов применялся оптимизатор Muon, для векторов — AdamW.

Модель предназначена для генерации текста, экспериментов с рекурсивными трансформерами и Muon, обучения и прототипирования дальнейшей настройки. Она принимает текст и выдаёт текст. Заявлены английский и русский языки, однако обучающий корпус был преимущественно англоязычным: карточка сообщает, что языковой фильтр не сохранил русские тексты. Контекст ограничен 1024 токенами. Обучение составило около 50 млн токенов за 2000 шагов, поэтому качество ограничено; модель может галлюцинировать и не рекомендуется для производственного или критически важного применения. Для загрузки требуется определить классы пользовательской архитектуры. Лицензия — MIT.

Сценарии применения

  • эксперименты с архитектурой Universal Transformer
  • изучение применения оптимизатора Muon к языковым моделям
  • генерация коротких текстовых продолжений на английском языке
  • прототипирование дообучения языковой модели

Ограничения

Модель обучалась лишь на 50 млн токенов, а обучающий корпус, несмотря на заявленную двуязычность, был преимущественно англоязычным и не содержал отобранных русских текстов. Контекст ограничен 1024 токенами; возможны фактические ошибки, а для загрузки нужно определить классы пользовательской архитектуры.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

MiniCPM-3B-Effective-Muon

🎯 Model Description

MiniCPM-3B-Effective-Muon is a custom Universal Transformer language model inspired by MiniCPM and Qwen architectures. It achieves approximately 3.3B effective parameter depth through recursive application of a single ~166M parameter block, trained with the novel Muon optimizer for matrix parameters.

Key Features

  • 🧠 Universal Transformer: Single block reused 20 times for deep reasoning
  • ⚡ Muon Optimizer: Newton-Schulz orthogonalization for matrix weights (arXiv:2502.16982)
  • 🎯 GQA Attention: Grouped Query Attention with 4:1 ratio (16 Q heads, 4 KV heads)
  • 🌀 RoPE: Rotary Position Embeddings for positional encoding
  • 🔥 SwiGLU FFN: 2.67x expansion ratio (Qwen-style)
  • 🌍 Bilingual: Trained on English and Russian text
  • 💾 Memory Efficient: ~166M physical parameters, fits in 10GB VRAM

🏗️ Architecture

Model Specifications

ParameterValue
Physical Parameters166,354,944 (~166M)
Effective Depth3,327,098,880 (~3.3B)
Universal Passes20
Hidden Size (d_model)1024
Attention Heads16 (Query) / 4 (KV)
Head Dimension64
FFN Dimension2736
Vocabulary Size151,665 (Qwen2.5)
Max Sequence Length1024
RoPE Theta10,000

Universal Transformer Architecture

Unlike traditional Transformers with N stacked layers, this model uses a single QwenBlock reused 20 times with depth embeddings:

for i in range(20):  # Universal passes
    x = x + depth_embedding[i]
    x = checkpoint(block, x, rope_cos, rope_sin)

This creates ~3.3B effective parameter compute while keeping the physical memory footprint at only ~166M parameters.

Components

1. Grouped Query Attention (GQA)

  • Query projections: 16 heads
  • Key/Value projections: 4 heads (shared across 4 query heads each)
  • Efficiency: 4x reduction in KV cache memory vs Multi-Head Attention

2. SwiGLU Feed-Forward Network

def swiglu(x):
    return down(silu(gate(x)) * up(x))
  • Expansion ratio: 2.67× (1024 → 2736 → 1024)
  • No bias terms (Qwen-style)

3. RMSNorm

  • Root Mean Square Layer Normalization
  • Pre-norm architecture (before attention and FFN)
  • No bias parameters

🎓 Training: Muon + AdamW Hybrid Optimizer

This model uses a hybrid optimization strategy inspired by Muon: MomentUm Orthogonalization by Newton-schulz:

Matrix Parameters (2D+): Muon Optimizer

  • Momentum SGD with Nesterov acceleration
  • Newton-Schulz iterations for polar decomposition (orthogonalization)
  • 5 iterations of quintic polynomial approximation
  • Applied to: attention projections, FFN layers

Vector Parameters (1D): AdamW

  • Standard AdamW with weight decay 0.1
  • Betas: (0.9, 0.95)
  • Applied to: embeddings, RMSNorm weights, biases

Optimizer Hyperparameters

OptimizerLearning RateMomentumWeight Decay
Muon0.020.950.0
AdamW3e-4(0.9, 0.95)0.1

📚 Training Data

Dataset: openbmb/Ultra-FineWeb

  • Source: High-quality web text corpus
  • Language Filter: English and Russian
  • Chunk Size: 1024 tokens
  • Total Training Tokens: ~50M (2000 steps × 2 batch × 8 grad_accum × 1024 tokens)

Data Statistics

  • English texts: 60,463
  • Russian texts: 0 (filtered by language field)
  • Total chunks: 50,000
  • Train/Val split: 95% / 5%

Training Configuration

HyperparameterValue
Batch Size2
Gradient Accumulation8
Effective Batch Size16
Max Steps2000
Learning Rate ScheduleCosine Annealing
Min LR3e-5 (10% of initial)
Gradient Clipping1.0
Validation Interval400 steps

📈 Training Results

Final Metrics

MetricValue
Final Training Loss54.66
Best Validation Loss6.61
Initial Val Loss7.57
Improvement12.7%

Training Progress

Step   | Loss    | Val Loss | LR (AdamW)
-------|---------|----------|-----------
25     | 133.12  | -        | 2.39e-04
400    | ~80     | 7.57     | ~2e-04
1000   | ~65     | ~7.0     | ~1e-04
1701   | 55.13   | 7.57     | 4.79e-05
2000   | 54.66   | **6.61** | 8.69e-05

💻 How to Use This Model

⚠️ Important: This is a custom architecture. You must define the model classes before loading weights.

Step 1: Install Dependencies

pip install torch transformers

Step 2: Define Architecture

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.checkpoint import checkpoint as grad_checkpoint

# Copy these classes from the training script:
# - RMSNorm
# - SwiGLU
# - GroupedQueryAttention
# - QwenBlock
# - UniversalQwen

CONFIG = {
    'vocab_size': 151665,
    'd_model': 1024,
    'n_heads': 16,
    'n_kv_heads': 4,
    'd_ff': 2736,
    'num_passes': 20,
    'max_seq_len': 1024,
    'rope_theta': 10000.0,
}

model = UniversalQwen(**CONFIG)

Step 3: Load Weights and Tokenizer

from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer

repo_id = "antontuzovAI/minicpm-3b-effective-muon"

# Download and load weights
weights_path = hf_hub_download(repo_id=repo_id, filename="best_model_weights.pth")
checkpoint = torch.load(weights_path, map_location="cpu", weights_only=False)
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()

# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B", trust_remote_code=True)

Step 4: Generate Text

def generate(prompt, max_new_tokens=150, temperature=0.7):
    tokens = tokenizer.encode(prompt, add_special_tokens=False)
    x = torch.tensor([tokens], dtype=torch.long)
    
    with torch.no_grad():
        for _ in range(max_new_tokens):
            logits = model(x)
            logits = logits[:, -1, :] / temperature
            probs = F.softmax(logits, dim=-1)
            next_token = torch.multinomial(probs, num_samples=1)
            x = torch.cat([x, next_token], dim=1)
            
            if next_token.item() == tokenizer.eos_token_id:
                break
    
    return tokenizer.decode(x[0].tolist(), skip_special_tokens=True)

# Test generation
print(generate("The future of artificial intelligence"))

⚠️ Limitations

  1. Training Scale: This model was trained for only 2000 steps (~50M tokens). For production quality, 10,000+ steps on 1B+ tokens are recommended.
  2. Language Coverage: Despite bilingual intent, the training data was predominantly English due to dataset filtering.
  3. Research Prototype: This is an experimental model demonstrating Universal Transformer + Muon optimizer combination. Not intended for production deployment.
  4. Hallucinations: Like all LLMs, may generate factually incorrect information.
  5. Context Length: Limited to 1024 tokens due to training constraints.

🎯 Intended Use

This model is intended for:

  • Research: Studying Universal Transformer architectures
  • Education: Learning about Muon optimizer implementation
  • Experimentation: Testing hybrid optimization strategies
  • Prototyping: Base for further fine-tuning on specific domains

Not intended for:

  • ❌ Production deployment without additional training
  • ❌ Critical decision-making systems
  • ❌ Generation of harmful, biased, or misleading content

📚 Citation

If you use this model or architecture in your research, please cite:

@misc{minicpm_3b_effective_muon,
  title={MiniCPM-3B-Effective: Universal Transformer with Muon Optimizer},
  author={Your Name},
  year={2026},
  publisher={Hugging Face},
  howpublished={\url{https://huggingface.co/antontuzovAI/minicpm-3b-effective-muon}}
}

Related Work

🙏 Acknowledgments

  • OpenBMB Team: For the Ultra-FineWeb dataset
  • Qwen Team (Alibaba): For the Qwen2.5 architecture and tokenizer
  • Muon Optimizer Authors: For the novel optimization algorithm
  • Hugging Face: For hosting infrastructure and datasets library

This model was trained from scratch using custom PyTorch code. No pre-trained weights from other models were used.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch

Нельзя запустить

Архитектура ? неизвестна transformers в образе рантайма.

Ревизия весов
86aa204

0 моделей