/ Модель

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

Лицензия
Apache 2.0
Архитектура
coreai-aimodel · dense
Базовая модель
gemma-4-31B-it-qat-q4_0-unquantized
Библиотека
coreai
Опубликована
13 июн 2026

Gemma-4-31B-CoreAI

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

Gemma-4-31B-CoreAI — конвертация модели Google Gemma 4 31B, выполненная сообществом пользователем mlboydaisuke для запуска в формате .aimodel на Apple Core AI.

623скачиваний за 30 дней1лайквеса обновлены25 сен 2026

Бенчмарки

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

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

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

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

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

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

Модель предназначена для локальной генерации текста, диалогов, суммаризации и других задач, поддерживаемых текстовыми языковыми моделями, полностью на устройстве без обязательной передачи данных в облако. Она ориентирована на компьютеры Mac с Apple Silicon и интеграцию через CoreAIKit или совместимые инструменты Core AI.

Это плотный текстовый декодер Gemma 4 с 60 слоями, скрытым размером 5376, 32 головами внимания и словарём из 262 144 токенов. Архитектура использует чередование скользящего и глобального внимания в соотношении 5:1; размер головы составляет 256 для скользящего внимания и 512 для глобального. Модель подвергнута int4-квантизации на основе QAT-релиза Google, занимает около 19 ГБ и имеет заявленную скорость декодирования 17,2 токена в секунду на M4 Max. Поддерживаются только текстовые входы и выходы; сведения о языках и максимальном размере контекста в README не указаны.

К сильным сторонам относятся запуск крупной 31-миллиардной модели на стандартном конвейерном движке Core AI, выполнение вычислений локально на GPU или Neural Engine и отсутствие необходимости в специальной модификации движка благодаря пользовательскому Metal-ядру для декодирования внимания. Ограничения включают высокие требования к памяти, размер загрузки около 20,1 ГБ, совместимость прежде всего с Mac-классом устройств и отсутствие заявленной поддержки iPhone. Модель распространяется по лицензии Apache 2.0.

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

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

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

Также подходит для

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

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

Открыть на Hugging Face

Core AI is Apple's on-device ML runtime in iOS 27 / macOS 27 and the successor to Core ML: PyTorch models are exported with Apple's coreai-torch (LLMs: coreai.llm.export) into .aimodel bundles that run on the GPU or the Neural Engine, e.g. Qwen3-8B 4-bit decodes at 94 tok/s on an M4 Max GPU, MLX 90 under the same protocol (apple-silicon-llm-bench, macOS 27 beta 26A5353q, 2026-06-11).

This model has no row on DeviceMark, the on-device LLM leaderboard.

Gemma 4 31B (dense) — Core AI

Apple Core AI (.aimodel) conversion of Google's Gemma 4 31B dense text decoder, ported directly from the QAT release google/gemma-4-31B-it-qat-q4_0-unquantized. Decode-only, runs on the stock pipelined engine on Apple Silicon (Mac-class, ~16 GB).

Frontier dense, unblocked by a custom Metal kernel. Gemma 4 31B's full (global) attention layers have a 32-head × 512 Q tensor that overflows MPSGraph's GPU decode scratch heap — the stock SDPA crashes at the first token (apple/coreai-models#27, the same bug as the 12B). This bundle ships a custom flash-decode SDPA kernel on the full layers (block-GQA over the 31B's 4 global KV heads) that removes the offending op, so the model runs.

Use it

New to Core AI? Start with CoreAIKit 0.7.3. Follow its requirements and first-run steps for qwen3-0.6b, then open the same release's ChatDemo. The README records the tested OS/SDK and download size; model and device coverage is stated per example.

⚡ One line — run the kit's task op on this model (import CoreAIOps; no session, no model plumbing, downloads on first use):

let tldr = try await CoreAI.summarize(text, options: .model("gemma-4-31b"))

Every op, one shape — Cookbook.

▶️ Run it (source) — the ChatDemo runner (GUI + CLI, one app for every chat model in the catalog):

git clone --branch 0.7.3 --depth 1 https://github.com/john-rocky/coreai-kit
export DEVELOPER_DIR=/Applications/Xcode-27.0.0-RC.app/Contents/Developer
open -a /Applications/Xcode-27.0.0-RC.app coreai-kit/Examples/ChatDemo/ChatDemo.xcodeproj
# → Run, then pick "Gemma 4 31B" in the model picker

# agents / headless (macOS):
cd coreai-kit/Examples/ChatDemo
swift run -c release chat-cli --model gemma-4-31b --prompt "What can you do, offline?"

Use Xcode build 27A266a from the release's .xcode-pin; adjust the app path if your installation is named differently.

💻 Build with it — complete; the glue is kit API, copy-paste runs:

import CoreAIKit

let id = "gemma-4-31b"
let chat: ChatSession
if id == "qwen3-0.6b" {
    // Freeze the release starter; other selections retain the live catalog's
    // model-specific dispatch (including paired Gemma bundles).
    guard let model = ModelCatalog.builtin.entry(id: id)?.modelID else {
        throw CoreAIKitError.modelNotAvailableOnPlatform(id: id)
    }
    chat = try await ChatSession(model: model)
} else {
    chat = try await ChatSession(catalog: "gemma-4-31b")
}
let reply = try await chat.respond(to: prompt)
// reply: the answer, generated fully on-device

When Apple's FoundationModels built-in model isn't enough, keep your session code and swap the model — one line. CoreAIKit's KitLanguageModel plugs supported chat bundles into the system LanguageModelSession. Tool calling depends on the model's dialect; guided generation also requires a compatible sequential engine. Check the linked support matrix before using either capability.

The take-home is Examples/ChatDemo/Sources/QuickStart.swift — this exact code as one typed function, no UI; the CLI is an argument shell over it, and the GUI drives the same ChatSession across turns for its transcript. Multi-turn? Hold the ChatSession and call respond(to:) per turn — it keeps the conversation history; streamResponse(to:) yields tokens as they decode.

Integration checklist

  • SPM: https://github.com/john-rocky/coreai-kit (exact 0.7.3) → product CoreAIKit
  • Info.plist: none needed
  • Entitlements: none needed (macOS)
  • First run downloads the model — ~20,121 MB (Mac) — then it loads from the local cache (Application Support; progress via the downloadProgress callback)
  • Measure in Release — Debug is ~3× slower on per-token host work

Bundle (gpu-pipelined/)

bundlequantsizedecode (M4 Max)
gemma4_31b_qat_decode_int4linsym_msdpa_g8int4 (q4_0-aligned absmax)19 GB17.2 tok/s (prefill 22.1)

int4 from Google's QAT checkpoint (q4_0 grid). A frontier 31B at int4 is bandwidth-bound, so decode is in the MLX-parity range — the value is "Core AI runs a frontier dense model the stock engine cannot." Mac-only (exceeds the iPhone memory budget). The _g8 suffix is the higher-occupancy flash-decode kernel (8 SIMD-groups per head split the global layers' KV scan; same numerics).

Architecture

Clean dense gemma4 text decoder — no PLE / AltUp / Laurel / MoE / KV-sharing. 60 layers, hidden 5376, 32 heads, vocab 262144, softcap 30, tied embeddings. 5:1 sliding:full; dual head_dim (sliding 256 / full global_head_dim 512); full layers use num_global_key_value_heads 4 with attention_k_eq_v (value = raw k_proj). Both attention shapes ride one growing KV pair, so the bundle loads on the stock CoreAIPipelinedEngine (2 states, no engine patch); the full layers' SDPA runs as a custom Metal flash-decode kernel.

Usage

huggingface-cli download mlboydaisuke/Gemma-4-31B-CoreAI \
    --include "gpu-pipelined/gemma4_31b_qat_decode_int4linsym_msdpa_g8/*" \
    --local-dir ./gemma4-31b-coreai

COREAI_CHUNK_THRESHOLD=1 llm-runner \
    --model ./gemma4-31b-coreai/gpu-pipelined/gemma4_31b_qat_decode_int4linsym_msdpa_g8 \
    --prompt "What is the capital of France?" --max-tokens 64 --chunk-size 1

Conversion

Community zoo: github.com/john-rocky/coreai-model-zoo → zoo/gemma4-31b.md.

License

Gemma 4 is released under the Apache License 2.0 — see the base card google/gemma-4-31B-it-qat-q4_0-unquantized and Google's Gemma 4 license page. The conversion (Core AI bundles) adds no additional restrictions.


More models in this format: Core AI Model Zoo — 75 models, each with the recipe that produced it.

Want a different model on-device? Open a request — free, open weights only; the export and its measured numbers get published publicly.

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

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

GPU в ailist

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

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

Библиотека «coreai» рантаймом не поддерживается.

Ревизия весов
b5c53b4

0 моделей