Skip to content
Computer vision

Gemma 4 26B A4B

управление глубиной рассуждений

2 min readupdated

Перед нами файнтюн мультимодальной модели google/gemma-4-26B-A4B-it (архитектура MoE на 25,81 млрд параметров от Google DeepMind), дообученный автором krystofmitka с помощью GRPO (метод обучения с подкреплением для улучшения рассуждений). Главная задача модели — позволить вам гибко регулировать, насколько подробно нейросеть будет «думать» перед ответом, без смены весов. Один и тот же чекпоинт поддерживает четыре уровня глубины рассуждений (25, 50, 75 и 100), которые задаются первой строкой системного промпта. Модель пригодится разработчикам, которым нужно балансировать между скоростью генерации, расходом токенов и тщательностью анализа сложных задач.

Ключевые особенности

  • Четыре режима «усилий»: поддержка значений 25, 50, 75 и 100 в одном наборе весов без подключения отдельных LoRA.
  • Снижение расхода токенов: на режиме 25 модель тратит в среднем 4 726 токенов размышлений против 11 040 у базовой Gemma 4 при сопоставимой точности.
  • Готовые объединённые веса: адаптер 167-го шага обучения уже вшит в базовую модель формата BF16 вместе с оригинальным токенизатором и шаблоном чата.
  • Поддержка vLLM и Transformers: модель готова к запуску как локально через библиотеку transformers, так и в продакшене через vLLM.

Что можно сделать

  • Оптимизировать стоимость и задержку API: выставить Reasoning Effort: 25 для рутинных запросов, чтобы вдвое сократить длину цепочки рассуждений без потери качества.
  • Глубокий анализ сложных задач: переключать промпт на уровень 75 для научных, математических или логических вопросов, требующих тщательной проверки.
  • Развернуть единый инференс-сервер: поднять модель через vLLM с контекстом до 262 144 токенов и динамически менять глубину мышления для разных пользователей в одном инстансе.

Пример

from transformers import AutoModelForImageTextToText, AutoProcessor
import torch

model_id = "krystofmitka/gemma-4-26B-A4B-effort-checkpoint167"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto")
messages = [
    {"role": "system", "content": "Reasoning Effort: 25 (range 1–100; higher values request more thorough reasoning)"},
    {"role": "user", "content": "Solve 3x + 7 = 28. Explain your answer."},
]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=True, return_dict=True, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=65536, do_sample=True, temperature=1.0, top_p=0.95, top_k=64)
ПодробнееБенчмарк GPQA-Diamond (одиночный прогон, 198 вопросов): точность 81.82% при effort 75 (8 131 токен размышлений) и 81.31% при effort 25 (4 726 токенов) против 79.80% у базовой Gemma 4 (11 040 токенов).
Требования к железу: веса в BF16 занимают около 52 ГБ, плюс память под инференс (оценка проводилась на GPU B300 с Transformers 5.20.2 и PyTorch 2.14.0).
Ограничения: обучение приостановлено на 167-м шаге из 500 запланированных; валидированы только значения 25, 50, 75 и 100, остальные не тестировались; лицензия Apache 2.0.
Discuss Telegram 0 24

Will it run?

Runs in 4-bit

Full precision does not fit, a quantised version does: quality barely changes down to 8 bits, more noticeably at 4 bits.

  • BF16weights 48 GB · ready files53 GB
  • FP8 / INT8recommendedweights 24 GB27 GB
  • 4-bitweights 14 GB15 GB

Tip: go 8-bit.FP8 / INT8 is within about a percent of full precision in quality, takes half the memory and runs faster on RTX 40/50 and H100. Full precision only pays off for fine-tuning.

Estimate: weights plus working memory. Long videos, high resolutions and long contexts need more.

Run it on Massed Compute

The script downloads the model to the rented machine. How to run it is in the model card.

  1. 1. Rent a machine with a fitting GPU

    Open Massed Compute
  2. 2. Paste the script into the machine's terminal

    Connect over SSH (the Massed Compute panel shows the command) or open a terminal on the machine's desktop.

    HF_TOKEN / CIVITAI_TOKENThe script starts with token lines: paste yours between the quotes. The Hugging Face token is for gated models, the Civitai one for Civitai models.

    # krystofmitka/gemma-4-26B-A4B-effort-checkpoint167
    mkdir -p ~/models
    curl -LsSf https://astral.sh/uv/install.sh | sh
    source "$HOME/.local/bin/env"
    uv tool install "huggingface_hub[cli]"
    hf download krystofmitka/gemma-4-26B-A4B-effort-checkpoint167 --local-dir ~/models/gemma-4-26B-A4B-effort-checkpoint167
    # The model is in ~/models. How to run it is in the model card (link above).
  3. 3. Use it

    The model is in ~/models. How to run it is in the model card (link above).

Stop the machine in the panel when you are done: it bills by the minute while it runs.

How to speed it up

Picked for this model type. Choose your hardware above to see what fits you exactly.

  • FlashAttention 44.0.0b40from November 18, 2026new release

    fastest exact attention on B200

    Kernels for Blackwell (beta). Exact attention without quantisation — fine for everything, LLMs included.

    How to enable: pip install flash-attn-4; vLLM and SGLang pick it up themselves.

    Earlier generations (2)
    • FlashAttention 3 — The Hopper (H100/H200) version with FP8.
    • FlashAttention 2 — The standard for RTX 30/40/50 and A100: exact attention without the memory cost of long contexts.
  • torch.compile2.15.0from October 28, 2026new release

    10–30% for free

    Compiles the model for your GPU. Slower first run, faster afterwards.

    How to enable: model = torch.compile(model); in ComfyUI the TorchCompileModel node.

Model family

  1. gemma-4-26B-A4Bfamily root
  2. gemma-4-26B-A4B-it
  3. gemma-4-26B-A4B-effort-checkpoint167

New posts about versions of gemma-4-26B-A4B (quants, finetunes, LoRAs) will show up under the bell.

Quantised versions 12All on Hugging Face
Fine-tunes 12All on Hugging Face
Merges 5All on Hugging Face

About the model

krystofmitka/gemma-4-26B-A4B-effort-checkpoint167
Author
krystofmitka
Category
Computer vision
Released
Posted

On NeyroLearn

Hugging Face

240

Ask AI about this model

Answered by Gemini 4 · the chat is kept only in this tab

Comments

Other

OCEAN-S2

OCEAN-S2