/ Модель

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

Размер весов
8,6 ГБ
Лицензия
Gemma
Архитектура
gemma3 · dense
Базовая модель
medgemma-4b-it
Опубликована
4 мар 2026

ClinicDx

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

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

136скачиваний за 30 дней3лайкавеса обновлены16 мар 2026

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

ClinicDx V1 — мультимодальная модель поддержки клинических решений, разработанная на основе google/medgemma-4b-it. Это дообученная и объединённая с базовыми весами Gemma 3 модель с 4,3 млрд параметров; репозиторий также содержит компоненты аудиотракта для голосового ввода и GGUF-квантизацию Q8_0. Система рассчитана на автономное развертывание через llama.cpp на потребительском оборудовании.

Модель формирует структурированные клинические оценки по описанию пациента: определяет срочность, обобщает клинические данные, предлагает дифференциальные диагнозы и дальнейшие действия, выделяет риски и готовит краткую сводку. В связке с базой из 27 860 фрагментов клинических рекомендаций WHO и MSF использует поиск по источникам и может включать цитаты в ответы. Голосовой сценарий реализуется отдельными компонентами MedASR и аудиопроектором; основная модель также наследует от MedGemma визуальный модуль, однако README указывает, что он не используется в сценариях CDS и Scribe.

Модель ориентирована на клиническую поддержку и извлечение наблюдений из голосового ввода, прежде всего в контексте клинических рекомендаций. Карточка описывает английский язык. Модель не заменяет профессиональное клиническое решение; качество зависит от контекста и найденных источников. Лицензия — Gemma.

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

  • подготовка структурированной оценки состояния пациента
  • сортировка клинических случаев по срочности
  • формирование дифференциального списка диагнозов
  • подбор первичных обследований и действий по клиническим рекомендациям
  • выделение тревожных признаков, противопоказаний и рисков
  • извлечение клинических наблюдений из голосового ввода

Ограничения

Модель предназначена для поддержки клинических решений и не заменяет профессиональную оценку; ответы зависят от качества входных данных и контекста извлечённых рекомендаций. Визуальный модуль унаследован от базовой модели, но README указывает, что в описанных сценариях CDS и Scribe он не используется.

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

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

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

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

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

Открыть на Hugging Face

ClinicDx V1

ClinicDx V1 is a fine-tuned multimodal clinical decision support (CDS) model based on google/medgemma-4b-it. It is trained to generate structured, evidence-grounded clinical assessments from patient presentations, integrating a retrieval-augmented knowledge base (KB) pipeline and an audio input pathway for voice-driven clinical observation extraction.

ClinicDx is an open-source trimodal inference system for edge clinical AI — combining a medical ASR encoder, a learned audio projector, and a fine-tuned 4B clinical LLM in a single llama.cpp binary, deployable fully offline on consumer hardware. For research contributions, open problems, and comparison to prior work, see RESEARCH.md on GitHub.

GitHub · Website · npm Package

This repository contains all four artifacts needed to run the full system with llama-server:

FileSizeDescription
clinicdx-v1-q8.gguf3.9 GBClinicDx V1 language model (Q8_0 quantisation)
medasr-encoder.gguf401 MBMedASR Conformer encoder (frozen, 105M params)
audio-projector-v3-best.gguf46 MBAudioProjector v3 — best checkpoint (step 40000, val LM 0.1042)
who_knowledge_vec_v2.mv21.1 GBWHO/MSF knowledge base v2.1 (27,860 chunks, BM25 + semantic hybrid)

Knowledge Base

The who_knowledge_vec_v2.mv2 index contains 27,860 chunks from WHO and MSF clinical guidelines, built via a Docling + HybridChunker pipeline with safety keyword detection for life-threatening conditions.

The retrieval pipeline uses hybrid search (BM25 + EmbedGemma 300M semantic, merged via Reciprocal Rank Fusion) followed by a 4-slot clinical intent reranker that extracts condition, severity, population, and task from each query and rescores hits with multiplicative penalties (×0.12 for off-condition, ×0.35 for severity mismatch, ×0.30 for wrong population) and additive boosts for slot alignment. The reranker covers 30+ clinical conditions with inclusion/exclusion patterns and condition-specific overrides.

During CDS inference, the model controls its own retrieval via a multi-turn ReAct loop — emitting <KB_QUERY> tags that the middleware resolves against this index and injects as <KB_RESULT> context, for up to 5 retrieval turns per request.


Model Description

ClinicDx V1 is a LoRA-fine-tuned and fully merged version of MedGemma 4B Instruct. It was trained with input masking (only model output turns are trained; user and KB turns are masked) on a quality-filtered dataset of 27,592 clinical conversations augmented with KB retrieval.

The model generates structured 6-section responses with inline citations sourced from retrieved knowledge base content.


Training Details

ParameterValue
Base modelgoogle/medgemma-4b-it
Training methodLoRA (r=64, α=128) — fully merged
Training cycleCycle 2 — Masked
Datasetproduction_run_v2 (quality-filtered)
Train samples27,592
Validation samples1,452
Input masking64% masked (user + KB turns), 36% trainable (model turns only)
Best eval loss0.4758
Best eval accuracy86.25%
Best checkpointStep 4000
Epochs trained2.32 (early stopped, patience=5)
LoRA target modulesq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
LoRA dropout0.05
Max sequence length8192
Precisionbfloat16

Output Schema

Each response is structured into 6 sections:

  1. Alert Level — Urgency classification (e.g. Routine / Urgent / Emergency)
  2. Clinical Assessment — Summary of presenting findings and clinical reasoning
  3. Differential Considerations — Ranked differential diagnoses with rationale
  4. Recommended Actions — Investigations and immediate management steps
  5. Safety Alerts — Red-flag signs, drug interactions, contraindications
  6. Key Points — Concise summary for handover or documentation

KB integration uses an EXTRACTED/BANKED think-block pattern with inline [WHO: source] citations in the final response.


Architecture

  • Base: Gemma3ForConditionalGeneration (4.3B parameters)
  • LoRA adapters: Merged into base weights — no adapter files needed at inference
  • Vision tower: Present (inherited from MedGemma base, frozen, not used in CDS or Scribe)
  • Audio projector: Included in this repository as audio-projector-v3-best.gguf

Audio Projector & Voice Input

The ClinicDx production server combines this model with a MedASR encoder and a lightweight AudioProjector to enable voice-to-CDS inference. The architecture mirrors how Gemma3 integrates vision — a frozen encoder feeds a trainable projector whose output is injected into the LLM's embedding sequence.

Full System Architecture

Patient audio (16kHz mono WAV)
        |
        v
MedASR Conformer Encoder  (frozen, 105M params)
  Mel spectrogram (128 bins, hop=160, n_fft=512)
  Natural log + 1e-5 clamp normalisation
  -> 17-layer Conformer encoder, 512 hidden dim
  -> [B, T_enc, 512]  (T_enc ≈ audio_seconds × 50)
        |
        v
AudioProjector v3  (trainable, 11,806,720 params)
  Frame stacking  k=4:   [B, T_enc, 512] -> [B, T_enc/4, 2048]
  Linear(2048 → 2560, bias=False)
  RMSNorm(2560)
  GELU
  Linear(2560 → 2560, bias=False)
  LayerNorm(2560)  [ln_final — added in v3]
  Pad (learned padding embedding) or truncate to 64 tokens
  -> [B, 64, 2560]   (MedGemma embedding space)
        |
        v
ClinicDx V1 Language Model  (4.3B params)
  <image_soft_token> × 64 placeholders in the text sequence
  are replaced with projected audio embeddings via masked_scatter
  (reuses Gemma3's image token injection mechanism)
        |
        v
Structured medical observations (key: value format)

AudioProjector Architecture Detail

The Gemma3AudioProjector is the only trainable component during audio projector training. It is a 2-layer MLP with frame stacking and a final LayerNorm:

class Gemma3AudioProjector(nn.Module):
    # Input:  [B, T_enc, 512]  — MedASR encoder output
    # Step 1: Frame stacking (k=4): [B, T_enc/4, 2048]
    # Step 2: proj = Sequential(
    #             Linear(2048 → 2560, bias=False),
    #             RMSNorm(2560),
    #             GELU(),
    #             Linear(2560 → 2560, bias=False),
    #         )
    # Step 3: ln_final = LayerNorm(2560)
    # Step 4: Pad (learned audio_padding_emb) or truncate to 64 tokens
    # Output: [B, 64, 2560]

Trainable parameters breakdown (11,806,720 total):

TensorShapeParameters
audio_padding_emb[1, 1, 2560]2,560
proj.0.weight (Linear 1)[2560, 2048]5,242,880
proj.1.weight (RMSNorm)[2560]2,560
proj.3.weight (Linear 2)[2560, 2560]6,553,600
ln_final.weight (LayerNorm)[2560]2,560
ln_final.bias (LayerNorm)[2560]2,560

Token budget per audio duration (16kHz, hop=160, ~50 frames/sec encoder output, 4× stacking):

Audio lengthEncoder framesAfter stackingAfter pad/trunc
1 second~50~1364 (padded)
3 seconds~150~3864 (padded)
5 seconds~250~6364 (padded)
10 seconds~500~12564 (truncated)
20 seconds~1000~25064 (truncated)

AudioProjector Training

The projector was trained independently from the CDS LoRA on a clinical audio dataset:

ParameterValue
Configtrain_config_mvp.yaml
Trainable params11,806,720 (projector only)
Frozen params~4.5B (base model + MedASR encoder)
Training data47,500 pre-computed audio clips (MVP audio dataset)
Validation data2,500 clips (5% held-out split)
Batch size8
Learning rate5.0e-4 (AdamW)
Warmup steps500
Gradient clipping1.0
Epochs10
Best checkpointStep 40000 (epoch 6 of 10)
Best val LM loss0.1042
Best val key accuracy84.0%
Precisionbfloat16

Validation history:

StepVal LM LossKey Accuracy
5,0000.149677.1%
10,0000.126277.9%
15,0000.119877.9%
20,0000.116979.4%
25,0000.111584.7%
30,0000.109482.4%
35,0000.106280.9%
40,0000.1042 ✓84.0%
45,0000.112384.7%
50,0000.120086.3%

Step 40,000 produced the best generalisation (lowest val LM loss). Training continued for an additional 15,000 steps but did not improve val LM loss, indicating overfitting onset. The audio-projector-v3-best.gguf file contains the weights from this step.

Loss functions:

L_lm          — Cross-entropy on target output tokens (main loss)
L_contrastive — Cosine similarity between projected audio embeddings
                and concept text embeddings (single-phrase clips only)
L_total = L_lm + 0.1 × L_contrastive

Audio Token Details

The audio pathway reuses Gemma3's existing image token injection mechanism. The audio soft token (<image_soft_token>, ID 262144) is repurposed as the audio placeholder. No new tokens are added to the vocabulary.

TokenIDPurpose
<start_of_image>255,999Begin-of-audio delimiter (reused for audio)
<end_of_image>256,000End-of-audio delimiter (reused for audio)
<image_soft_token>262,144Audio embedding placeholder (×64 per clip)

The system prompt uses <start_of_audio> / <end_of_audio> as human-readable markers in the text, while the tokenised form uses the image token IDs above for embedding injection.


Running with llama-server (GGUF — Recommended)

The fastest deployment path uses the three GGUF files in this repository with a CUDA-enabled llama-server build that includes --medasr-encoder and --audio-proj support.

Prerequisites

  • NVIDIA GPU with ≥8 GB VRAM (≥12 GB recommended for full Q8 + encoder + projector)
  • llama-server built with CUDA and MedASR/audio-projector support
  • ffmpeg available on the host (for audio transcoding to 16kHz PCM-16 WAV)

Download GGUFs

pip install huggingface_hub
python - <<'EOF'
from huggingface_hub import snapshot_download
snapshot_download(
    repo_id="ClinicDx1/ClinicDx",
    allow_patterns=["*.gguf"],
    local_dir="./clinicdx-gguf"
)
EOF

Start the Server

llama-server \
  --model             ./clinicdx-gguf/clinicdx-v1-q8.gguf \
  --medasr-encoder    ./clinicdx-gguf/medasr-encoder.gguf \
  --audio-proj        ./clinicdx-gguf/audio-projector-v3-best.gguf \
  --n-gpu-layers      999 \
  --ctx-size          8192 \
  --parallel          1 \
  --threads           8 \
  --host              0.0.0.0 \
  --port              8180

Note: --parallel 1 is required. The audio extraction endpoint (/v1/audio/extract) performs a blocking llama_decode on the shared context; parallel slots cause assertion failures.

Audio Inference (via REST API)

# Transcode browser audio to required format first
ffmpeg -i input.webm -ar 16000 -ac 1 -c:a pcm_s16le output.wav

# Send to the audio extraction endpoint
curl -X POST http://localhost:8180/v1/audio/extract \
  -H "Content-Type: audio/wav" \
  --data-binary @output.wav

The endpoint returns structured key: value observations matching the clinical manifest provided in the system prompt.


Usage (Text CDS — no audio)

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "ClinicDx1/ClinicDx"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

prompt = """<start_of_turn>user
Patient: 45-year-old male, 2 days of fever (39.2°C), productive cough, right-sided pleuritic chest pain, decreased breath sounds right base.
<end_of_turn>
<start_of_turn>model
"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.1, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Intended Use

  • Clinical decision support for trained healthcare professionals
  • Structured differential diagnosis generation
  • Evidence-grounded treatment planning with KB citations
  • Voice-driven clinical observation extraction in low-resource clinical settings
  • Not intended for direct patient-facing use or autonomous clinical decision making

Limitations and Open Problems

  • No formal clinical validation. Accuracy metrics (86.25% CDS, 84% Scribe key accuracy) are measured on held-out synthetic data, not on real clinical encounters. A prospective evaluation with practicing clinicians is the highest-priority gap.
  • English only. All CDS outputs, Scribe extraction, and KB retrieval operate in English. Multilingual support (Swahili, Amharic, Hausa, Yoruba) is not yet implemented.
  • Audio token norm mismatch. Projected audio token norms are 360-620x larger than text token norms in the LLM embedding space. The current mitigation uses adaptive norm alignment loss, but this remains an active area of investigation.
  • Synthetic training data. Trained on curated synthetic/augmented clinical data — real-world performance may vary.
  • KB-dependent for best results. Knowledge base integration requires the ClinicDx retrieval pipeline; standalone use generates structure but without live KB citations.
  • Audio projector trained on synthetic speech. Accuracy on natural conversational speech, accented English, or noisy clinical environments may be lower.
  • Q8 quantization chosen empirically. Q8_0 was selected over Q4 variants because lower quantization degraded structured output behavior (THINK block coherence, KB query emission) more than perplexity. No systematic ablation study has been conducted.
  • No ARM / low-power benchmarks. Validated on x86_64 with NVIDIA GPUs and CPU-only mode. Latency on ARM edge devices is unknown.
  • The model may produce plausible-sounding but incorrect clinical information — always verify with a qualified clinician.

License

This model is released under the Gemma Terms of Use. Use is subject to those terms.

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

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

GPU в ailist

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

Можно запустить

Подбираем GPU…

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

0 моделей