请求加入做种队列,或现在用 pf download antontuzovAI/minicpm-3b-effective-muon 获取(CLI 指南)。
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.
| Parameter | Value |
|---|---|
| Physical Parameters | 166,354,944 (~166M) |
| Effective Depth | 3,327,098,880 (~3.3B) |
| Universal Passes | 20 |
| Hidden Size (d_model) | 1024 |
| Attention Heads | 16 (Query) / 4 (KV) |
| Head Dimension | 64 |
| FFN Dimension | 2736 |
| Vocabulary Size | 151,665 (Qwen2.5) |
| Max Sequence Length | 1024 |
| RoPE Theta | 10,000 |
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.
def swiglu(x):
return down(silu(gate(x)) * up(x))
This model uses a hybrid optimization strategy inspired by Muon: MomentUm Orthogonalization by Newton-schulz:
| Optimizer | Learning Rate | Momentum | Weight Decay |
|---|---|---|---|
| Muon | 0.02 | 0.95 | 0.0 |
| AdamW | 3e-4 | (0.9, 0.95) | 0.1 |
| Hyperparameter | Value |
|---|---|
| Batch Size | 2 |
| Gradient Accumulation | 8 |
| Effective Batch Size | 16 |
| Max Steps | 2000 |
| Learning Rate Schedule | Cosine Annealing |
| Min LR | 3e-5 (10% of initial) |
| Gradient Clipping | 1.0 |
| Validation Interval | 400 steps |
| Metric | Value |
|---|---|
| Final Training Loss | 54.66 |
| Best Validation Loss | 6.61 |
| Initial Val Loss | 7.57 |
| Improvement | 12.7% |
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
⚠️ Important: This is a custom architecture. You must define the model classes before loading weights.
pip install torch transformers
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)
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)
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"))
This model is intended for:
Not intended for:
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}}
}
This model was trained from scratch using custom PyTorch code. No pre-trained weights from other models were used.
有文件?提交种子。
发布种子best_model_weights.pth 1.2 GiBcheckpoint_step_1800.pth 1.2 GiBcheckpoint_step_2000.pth 1.2 GiBinterrupted_checkpoint_step_1427.pth 1.2 GiBinterrupted_checkpoint_step_1701.pth 1.2 GiBinterrupted_checkpoint_step_latest.pth 1.2 GiB