/ Модель

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

Контекст
40 960 токенов
Параметры
3,7 млрд
Размер весов
9,5 ГБ
Лицензия
Apache 2.0
Архитектура
qwen3_mamba3 · dense
Базовая модель
Qwen3-4B
Библиотека
transformers
Опубликована
10 сен 2026

qwen3-4b-mamba3-hybrid-stage1-align-bias0

Генерация текстаТекст → текст3 профессии

Экспериментальный промежуточный чекпойнт Qwen3-4B с гибридными слоями Mamba-3 и полного внимания для исследования дистилляции и замены внимания.

103скачиваний за 30 дней0лайковвеса обновлены11 сен 2026

Бенчмарки

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

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

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

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

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

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

arianraje/qwen3-4b-mamba3-hybrid-stage1-align-bias0 — промежуточный экспериментальный чекпойнт, созданный в исследовании гибридной архитектуры на основе Qwen3-4B. В нём 27 из 36 слоёв внимания заменены на Mamba-3 MIMO-миксеры, а каждый четвёртый слой сохраняет исходное полное внимание. Веса опубликованы в формате safetensors; модель содержит около 4,7 млрд параметров и использует контекст до 40 960 токенов.

Чекпойнт прошёл только первый этап выравнивания скрытых состояний: 100 млн токенов, последовательности длиной 4096 и обучение миксеров при замороженных остальных компонентах. Он предназначен для изучения перехода от полного внимания к гибридной архитектуре и сравнения вариантов миксеров, а не для готового диалогового или генеративного применения. Для загрузки требуется Transformers с trust_remote_code=True и пользовательским кодом архитектуры; для эффективной работы миксеров нужен upstream-ядро Mamba-3, иначе доступна значительно более медленная эталонная реализация.

В README приведены только промежуточные метрики обучения и валидации; качество на прикладных задачах не проверялось. На этапе 1 модель не обучалась завершать генерацию токеном конца текста, поэтому свободная генерация не останавливается сама. Базовая модель — Qwen/Qwen3-4B, лицензия Apache-2.0.

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

  • изучение гибридных архитектур Mamba-3 и полного внимания
  • сравнение Mamba-3 MIMO с альтернативными последовательностными миксерами
  • проверка выравнивания скрытых состояний с учительской моделью Qwen3-4B
  • эксперименты с дистилляцией языковой модели на длинных контекстах

Ограничения

Это промежуточный чекпойнт первого этапа, не прошедший оценку на прикладных бенчмарках; генерация не завершается автоматически токеном конца текста. Для производительной работы требуется пользовательский код архитектуры и ядро Mamba-3, а эталонная реализация работает медленно.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

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

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

Открыть на Hugging Face

qwen3-4b-mamba3-hybrid-stage1-align-bias0

Stage-1 endpoint, bias-0 arm -- per-layer hidden-state alignment, 100M tokens at sequence length 4096, mixers only (LR 1e-3, micro-batch 16, 1,526 steps on 4x B200). Each converted layer takes the teacher's hs[i] and regresses onto the teacher's hs[i+1], so the 27 losses are independent and no error propagates between them. Final val mean rel-MSE 0.00397 (GDN arm 0.0208, Mamba2 arm 0.0175 at the same budget), worst layer 0 at 0.0371, wikitext-2 PPL 26.54. Stage 1 never trains an end-of-text token, so free generation does not terminate at this stage in any arm. Intermediate checkpoint, published for the ladder.

Loading

This is a custom container (model_type: qwen3_mamba3), not a stock architecture, so trust_remote_code=True is required. The modeling code is bundled in this repo (modeling_qwen3_mamba3.py) and needs no other checkout:

from transformers import AutoModelForCausalLM, AutoTokenizer
m = AutoModelForCausalLM.from_pretrained(REPO, trust_remote_code=True, dtype="bfloat16")
tok = AutoTokenizer.from_pretrained(REPO)

Kernel. The mixers call upstream's fused Mamba-3 MIMO kernel, mamba_ssm.ops.tilelang.mamba3.mamba3_mimo, from state-spaces/mamba at commit e9594ce (TileLang + Triton; the pip mamba_ssm 2.2.6.post3 predates Mamba-3, so install from source). If that import fails the model warns once and every mixer runs mamba3_mimo_reference, a sequential fp32 torch transcription of the kernel's semantics: numerically equivalent (fwd rel err 6e-3 vs the kernel in bf16), and slow -- fine for a decode-parity check, not for throughput. Set Qwen3Mamba3Mixer.force_reference = True to opt into it explicitly.

Training with the kernel. Upstream's mamba3_mimo.py backward at e9594ce reads ctx.saved_tensors twice, which PyTorch's non-reentrant activation checkpointing (use_reentrant=False, HF's default) rejects with CheckpointError: Unpack is being triggered for a tensor that was already unpacked once. The fix is a one-line change (read it once); the training runs below used a local commit with that change. Inference is unaffected.

The study

Full-attention Qwen3-4B converted to a Mamba-3 hybrid: 27 of 36 layers have their attention replaced by a Mamba-3 MIMO mixer, with every 4th layer (indices 3, 7, 11 ... 35) retained as full attention -- the u4 pattern. Retained layers are literal Qwen3DecoderLayers, so retention is bit-exact. Mixer geometry: 32 heads x 128 head_dim, 8 B/C groups, d_state 128, MIMO rank 4, expand 1.6, chunk 8, RoPE on half of the state dims, the pre-gate grouped RMSNorm fused into the kernel. Parameter layout and math are upstream's exactly (in_proj rows [z | x | B | C | dd_dt | dd_A | trap | angles], rank-major (r g n) B/C), so the upstream kernel is called unchanged. 4,741,428,416 params, of which the 27 mixers are 1,426,756,032 (30.1%).

Capability is recovered by staged distillation rather than pretraining: surgery/init -> stage-1 per-layer hidden-state alignment (100M tok) -> stage-2a forward-KL KD @4k (600M) -> stage-2b long-context KD @32k (294M) -> stage-3 on-policy distillation. Teacher: Qwen/Qwen3-4B. This arm exists to isolate the mixer: it shares the teacher, the packed data, the token budgets and the schedules with the Gated DeltaNet and Mamba2 arms trained identically.

Inherited init

The mixer starts as the teacher's attention head, not as a random SSM (inherited fraction 99.95%): per converted layer, x head h <- v_proj head h // 4; B[r, g] <- k_proj head g; C[r, g] <- q_proj head 4g + r; out_proj <- o_proj; C_norm / B_norm <- q_norm / k_norm. The dd_dt, dd_A, trapezoid and angle rows of in_proj are zero (per-head constant dt, A = -1, trapezoid 1/2, no rotation; all keep gradient). dt_bias is the softplus-inverse of exp(U(log 1e-3, log 1e-1)) (the repaired dt init of the Mamba2 arm; horizons of 10-1000 tokens). mimo_x is a random simplex over ranks per (head, dim) so the ranks get distinct gradients while the init state equals upstream's uniform 1/R; mimo_o selects each head's own rank; mimo_z, D and the norm weights are 1. At init a converted head equals the teacher's head with softmax replaced by causal decay (tested to 3e-8).

B/C bias. Upstream initializes the B/C biases to 1.0. On an inherited head that adds sum(q) + sum(k) + 128 to every score, which looked like it would swamp the teacher's structure, so the primary arm used 0 and a second arm kept upstream's 1.0. Measured: bias 1 led at every stage-1 and stage-2a evaluation (below). Both arms are published; bias 1 is now the default.

Results so far (trainer metrics only)

stagebias 0bias 1Qwen GDN (dtfix)Qwen Mamba2 (dtfix)
stage 1: val mean rel-MSE / worst layer / wikitext2 PPL0.00397 / L0 0.0371 / 26.540.00376 / L0 0.0357 / 25.350.0208 / - / -0.0175 / - / -
stage 2a (4k): val KL / top1 agreement / PPL0.1297 / 0.8580 / 12.490.1258 / 0.8601 / 12.410.1437 / 0.8515 / 12.830.1819 / 0.8295 / 12.60
stage 2b (32k): val KL / top1 agreement / PPL0.2021 / 0.8056 / 11.930.1957 / 0.8089 / 11.810.2177 / 0.7985 / -0.2336 / 0.7875 / -

Val KL is the forward KL to the teacher over the full vocabulary on held-out packed text at the stage's sequence length; PPL is wikitext-2 at 4096 context. Mamba-3 enters stage 2a at KL 0.50 (Mamba2: 1.08) and passes Mamba2's final KL by step 20 of 287.

Not yet evaluated. No downstream battery (commonsense, RULER needle-in-a-haystack, GSM8K / MATH / AIME, MMLU) has been run on any Mamba-3 checkpoint; the numbers above are the trainers' own validation metrics. Stage 2b (32k KD) is complete for both arms. Stage 3 (on-policy distillation) has not been run. Intermediate checkpoints, published for the ladder.

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

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

GPU в ailist

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

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

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
Qwen3Mamba3ForCausalLM
Ревизия весов
8958d5c

0 моделей