/ Модель

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

Контекст
131 072 токена
Параметры
4,7 млрд
Размер весов
15,5 ГБ
Лицензия
Apache 2.0
Архитектура
gemma4_text · dense
Базовая модель
cellgemma-e4b
Библиотека
mlx
Опубликована
2 дек 2026

cellgemma-e4b-mlx-bf16

Генерация текстаТекст → текст
587скачиваний за 30 дней0лайковвеса обновлены4 дек 2026

Описание модели

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

Экспорт CellGemma E4B для MLX на Apple Silicon предсказывает изменения экспрессии генов после лекарственных и генетических воздействий.

bsisduck подготовил экспорт Google DeepMind CellGemma E4B для запуска на Apple Silicon с MLX. Модель предназначена для предсказания изменений экспрессии генов после клеточных воздействий, например обработки препаратом или подавления гена. Экспорт включает языковую модель, 13 декодеров экспрессии, контрольные образцы и описания генов; дополнительного обучения не проводилось.

Это плотная причинная языковая модель семейства Gemma 4 с 4,7 млрд параметров и контекстом до 131 072 токенов. Репозиторий содержит веса MLX в формате BF16 и распространяется по лицензии Apache 2.0. В метаданных для модели указан английский язык; её биологическая специализация — эксперименты с клеточными возмущениями и транскриптомикой.

Экспорт прошёл технические проверки: значения 665 BF16-тензоров совпали с исходными, а все 13 декодеров были сопоставлены с PyTorch-версией. Это не подтверждает биологическую точность, эквивалентность научным оценкам исходной модели или стабильность производительности: в README описаны тайм-ауты Metal GPU и незавершённые запуски. Модель предназначена для исследований, а не для диагностики или выбора лечения; результаты следует проверять экспериментально, особенно для новых типов клеток, анализов и возмущений.

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

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

Ограничения

Это исследовательская модель, не предназначенная для диагностики или рекомендаций по лечению; предсказания требуют экспериментальной проверки, особенно вне обучающего распределения. Эквивалентность биологическим результатам исходной модели и стабильная производительность MLX-экспорта не установлены; README сообщает о тайм-аутах Metal GPU.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

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

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

Открыть на Hugging Face

CellGemma E4B MLX BF16 for Apple Silicon

Run Google's CellGemma E4B on Apple Silicon with MLX. This BF16 export predicts how gene expression changes after a perturbation, such as a drug treatment or a gene knockdown. It includes the language model, all 13 expression decoders, sample controls and gene descriptions.

Converted by bsisduck from google/cellgemma-e4b. Google DeepMind developed the original model and decoders. No additional training was performed for this export.

Choose a format

MLX 4-bitMLX BF16
Language-model weights on disk4.35 GB15.46 GB
Model with supporting assetsAbout 4.49 GBAbout 15.60 GB
Weight format4-bit affine, group size 64Bfloat16, unquantized
UseLocal experiments with lower memory useReference weights and conversion checks
Original weight valuesQuantizedAll 665 model tensors checked for exact equality

Sizes use decimal GB and exclude the Python environment. The 4-bit language-model files are about 72% smaller. The expression decoders retain their original weights in both exports.

This repository is the BF16 version. Its language-model weights preserve the source BF16 tensor values. Numerical agreement of complete MLX and PyTorch generation has not been established.

Run the supplied example

Runtime status, 4 December 2026: this example has completed 4-bit inference, but a later scheduled run hit a Metal GPU timeout with both formats during warmup. The cause is unresolved. See the measurement records below; this stack is not yet a consistently reproducible performance baseline.

The commands below use Python 3.12 and the versions tested on an Apple M2 Max with macOS 27.0. The installed MLX 0.32.5 binary in this test requires macOS 27. An older macOS installation needs a compatible MLX build; that combination has not been tested here.

python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install \
  mlx==0.32.5 mlx-lm==0.32.2 transformers==5.25.0 \
  huggingface-hub==2.5.0 numpy==2.5.5 safetensors==0.8.0

hf download bsisduck/cellgemma-e4b-mlx-bf16 \
  --local-dir cellgemma-e4b-mlx-bf16

python cellgemma-e4b-mlx-bf16/examples/predict.py \
  --model cellgemma-e4b-mlx-bf16 \
  --dataset tahoe --max-tokens 512 --output tahoe-preview

This runs the supplied Tahoe control cell 0 with Panobinostat at 0.5 uM. The example script constructs the prompt, generates signed gene ranks and reconstructs continuous expression with the matching decoder. It runs locally and uses files from the downloaded directory. An HF token is not required for this public repository.

The output directory contains:

FileContents
expression.csvOne row per gene: control, mean baseline, predicted expression and change
residual_genes.txtRaw signed gene sequence from the language model
benchmark.jsonTiming, memory, sampling settings, environment and truncation status

The Tahoe example has 19,720 rows. change means predicted expression minus control in normalized log1p units. It is not a raw fold-change ratio. Genes absent from the generated sequence retain the mean-shift prediction; absence does not establish that a gene is unaffected.

For the supplied K562 control and a MYC knockdown:

python cellgemma-e4b-mlx-bf16/examples/predict.py \
  --model cellgemma-e4b-mlx-bf16 \
  --dataset k562 --knockdown-gene MYC --max-tokens 512 \
  --output k562-myc-preview

K562 has 18,238 genes. The script uses the supplied knowledge-graph description of MYC. Choose a new output directory for each invocation to preserve earlier results.

A 512-token run is a preview. If truncated is true, generation reached the limit. Use --max-tokens 8192 for the upstream output budget. The example enforces the upstream documented 16K context, even though the configuration's max_position_embeddings value is larger. Longer generation changes both the ranks available to the decoder and its reconstructed values.

Local performance measurements

The 4-bit series below completed on 3 December 2026 using an Apple M2 Max with 32 GiB unified memory and macOS 27.0. It used Tahoe control cell 0, the supplied Panobinostat prompt, 4,128 input tokens and 128 generated tokens. One warmup was followed by three measured runs. All outputs reached the 128-token limit.

Values are median (minimum to maximum) across the three measured runs. Other desktop applications remained open, so these are observations under shared system load, not an isolated hardware benchmark or a guaranteed speed.

Measurement4-bit: median (minimum to maximum)
Time to first token10.73 s (10.51 to 15.24)
Prediction and reconstruction23.22 s (18.01 to 43.61)
Generation throughput10.51 tokens/s (4.55 to 17.79)
Peak MLX allocation5.05 GB (5.03 to 5.05)

Raw 4-bit report, including warmup, every measured run and the environment. The two formats do not have a completed, matched repeat benchmark.

An earlier, single BF16 validation run reported 9.83 generation tokens/s and 16.36 GB peak MLX allocation for 128 output tokens. Those figures are retained in the original BF16 validation report. It used a different validation procedure and had no repeated measurements, so it is not a direct speed comparison with the table above.

Later attempts did not reproduce a complete series:

AttemptOutcome
Preliminary 4-bit attempt on 3 DecemberMetal GPU timeout before a measured result
BF16 on 3 DecemberWarmup stopped after 269 seconds following model loading; no completed prediction
4-bit on 4 DecemberMetal GPU timeout during warmup; zero measured runs
BF16 on 4 DecemberMetal GPU timeout during warmup; zero measured runs

The 4 December attempt ran sequentially through macOS launchd at background CPU priority. Nine unit tests passed before generation. The records do not isolate whether the GPU failures came from MLX, Metal, system state or scheduling. The successful 4-bit series is retained as a dated observation, not evidence that the later failures are fixed. Leave room for macOS and other applications when planning memory; peak allocation is not a minimum RAM requirement.

These measurements describe inference on a supplied example. They do not measure biological accuracy, performance on unseen perturbations or parity with Google's published evaluation. The original model's scientific benchmark results are in Google's model card. Those scores have not been re-established for this MLX conversion.

To collect timing measurements on your Mac:

python cellgemma-e4b-mlx-bf16/examples/predict.py \
  --model cellgemma-e4b-mlx-bf16 \
  --dataset tahoe --cell-index 0 --max-tokens 128 \
  --warmup 1 --runs 3 --seed 42 --output local-benchmark

The script records every run, including warmup, and computes median, minimum and maximum across the measured runs. No prompt cache is reused. It uses a 256-token prefill batch, temperature 0.7, top-p 0.95 and top-k 64. Timing excludes downloading, model loading and input preparation. First-token latency includes prompt processing. Prediction time includes generation and expression reconstruction. MLX peak allocation is not total process or system memory.

Conversion checks

The validation report contains the original technical checks. Its total duration includes loading and parity checks, so use the separate benchmark reports for inference timing:

CheckResult
Dataset decoders compared with a PyTorch reference13 of 13 passed
Largest absolute decoder difference on the test inputs0.00000566245
BF16 model tensors compared with the source665 exactly equal
Original Tahoe generation smoke test4,128 input tokens; 128 output tokens
Recognized signed entries in that smoke test32 positive and 32 negative for each format
Reconstructed valuesFinite for all tested genes

Decoder comparison used 20 synthetic feature/control rows per dataset decoder, with rtol=3e-4 and atol=3e-5. It checks the implementation on those inputs. The BF16 equality result applies to the BF16 export, not the quantized weights. The smoke-test outputs for 4-bit and BF16 differ, including their gene order. A recognized gene sequence is not an accuracy score.

Input and decoder contract

CellGemma expects a specific perturbation prompt rather than a chat question. The example keeps the upstream preamble and these sections in order: perturbation description, Source:, Mean Global prediction: and Target:. It uses the Gemma turn delimiters, a single beginning-of-sequence token, and <turn|> as an additional stop token. Do not apply a generic chat template on top of it.

For your own data, follow the upstream preprocessing instructions. Inputs must be normalized log1p expression with matching gene symbols and an assay-appropriate decoder. A decoder from a different assay changes the baseline and reconstruction. The supplied controls are useful for checking the inference path; they are not a held-out evaluation set.

Decoder foldersAssay group
tahoe, l1000, emeraldbay, sciplexSmall-molecule perturbations
hepg2, jurkat, k562, rpe1, vcc, normanGenetic perturbations
parse, dong, tischCytokine or clinical datasets

All 13 decoders are included. Only Tahoe and K562 have bundled control examples, with 100 cells each. The command-line example supports those two datasets.

Files and provenance

PathPurpose
*.safetensors, config.jsonMLX language-model weights and configuration
tokenizer.json, tokenizer_config.jsonCellGemma tokenizer with the upstream gene vocabulary
decoders/<dataset>/ExpressionDecoder weights, configuration and mean deltas
controls_sample.jsonSupplied Tahoe and K562 controls
kg_sentences.jsonGene descriptions for genetic perturbation prompts
conversion.jsonSource revision, conversion format and package versions
validation.jsonConversion checks from the initial publication
benchmarks/Completed 4-bit measurements and records of incomplete or failed attempts
examples/Runnable MLX example and its prompt/decoder helpers
UPSTREAM_MODEL_CARD.md, LICENSEOriginal model documentation and Apache 2.0 license

Source: google/cellgemma-e4b at 6212145e0131d3744171739ea5232afc6aaa7c76. The conversion used mlx-lm==0.32.2, mlx==0.32.5 and transformers==5.25.0. E4B describes effective computation, not a 4 GB file or a count of all stored parameters.

The expression decoders and supporting data were copied from the source export. Their original safetensors names are retained; the MLX decoder helper reads them directly. The original 4-bit weight revision and BF16 weight revision remain available for reproducibility. Later documentation commits do not change those weight files.

Scope and limitations

This is a research model for cell perturbation experiments. It is not a diagnostic system or a treatment recommender. Outputs need experimental validation, especially for a new assay, cell type or perturbation outside the training distribution. Quantization can alter generated ranks and reconstructed expression. Neither the technical checks nor the local performance measurements establish clinical suitability or biological equivalence.

The model, source assets and example code are distributed under Apache 2.0. See the original model card for training data, intended use and limitations. Report conversion or example-code problems in this repository's Community tab, with the model revision, package versions, hardware and a non-sensitive reproducer.

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

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

GPU в ailist

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

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

MLX-модели работают только на Apple Silicon, на GPU NVIDIA они не запускаются.

Класс архитектуры
Gemma4ForCausalLM
Ревизия весов
f649f09

0 моделей