Request model access

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

By requesting access, you confirm your intended use qualifies under the PolyForm Small Business License or is covered by written permission from Trelis Research. You agree to share your details with Trelis and receive one access email.

Log in or Sign Up to review the conditions and access this model content.

gemma-4-E4B-it-conversational

Try Conversational Gemma via API: trelis.com/api/conversational-gemma (OpenAI-compatible chat completions and tool calling; sign in at console.trelis.com).

Use this model to play the caller in a practice conversation or run a compact conversational voice assistant with tool calling. A sales rep can interview a fictional buyer about their needs; a clinician can practice taking a history from a fictional patient using a clinician-reviewed case. The trainee asks the questions, and the caller answers from the case one turn at a time using natural spoken phrasing.

This repository packages standalone merged BF16 weights based on Gemma 4 E4B Instruct alongside text-only GGUF quantizations (Q8_0, Q6_K, and Q4_K_M) for local inference with llama.cpp, Ollama, or LM Studio.

Files and quantization options

For cloud GPU serving, online FP8 quantization in vLLM (--quantization fp8 --limit-mm-per-prompt '{"image":0,"audio":0}') loads in 10.84 GiB of VRAM and holds 62/64 whole-call pass (96.9%) and 91.13% tool accuracy, leaving ample KV cache headroom on a single 48 GB L40S GPU. For local text-only deployment, Q8_0 (7.97 GB) achieves 32/32 openings, 61/64 whole-call pass, and 90.87% tool accuracy (0 malformed), Q6_K (6.17 GB) balances size and precision, and Q4_K_M (5.30 GB) holds 62/64 whole-call pass (96.9%) and 92.14% tool accuracy with zero runaways or repetition loops.

File / format Size SHA-256 Recommended use
Standalone BF16 safetensors (repo root) 15.91 GB - GPU serving (vLLM BF16 or online FP8, transformers, or MLX conversion)
gemma-4-E4B-it-conversational-Q8_0.gguf 7.97 GB 5d7d12323deee386104239fbc732872aee1287e22c7f51089e89f9223b534410 Highest-precision local quant (32/32 openings, 0 malformed tool calls)
gemma-4-E4B-it-conversational-Q6_K.gguf 6.17 GB 31b36283228bb10e844a41cdb8e06cac8053109380bf290838aae7016e78bc8d Balanced local footprint and precision
gemma-4-E4B-it-conversational-Q4_K_M.gguf 5.30 GB 1244c9c708af4753517420746a75b38b88f6c5df85858c88ddb9f9aa8c306f94 Compact local serving (62/64 whole-call pass, 92.14% tool accuracy)

Benchmarks

All arms below were evaluated on the same two suites:

  • Held-out simulated caller suite: 32 held-out phone scenarios across 2 random seeds (64 full calls, up to 20 turns each) against a stock Gemma 4 31B support agent with four agent personas (helpful, rude, wrong, interrupting). All 64-call transcripts and 32 two-turn openings across all arms were graded together in one blinded, shuffled run on gemini-3.8-flash (thinking_level="low", provider default temperature, 0 judge errors).
  • Tool-calling replay suite: 789 unforced tool-calling attempts (263 held-out multi-turn cases x 3 seeds) scored on exact decision agreement and malformed tool syntax.
  • Spoken-phone perplexity (Val PPL): held-out 600-turn spoken telephone validation set (val.jsonl). Stock google/gemma-4-E4B-it scores 57.95 on this set; this release scores 13.96.
Model / Precision Tool acc /789 (malformed) Openings /32 Role /64 Facts /64 Goal /64 Delivery /64 Whole-call pass /64 Runaways / Rep loops Median words/turn
google/gemma-4-31B-it (stock 31B ref) 95.18% (1) 32/32 64 63 64 64 63/64 0 / 0 21.0
Trelis/gemma-4-31B-it-conversational (31B ref) 93.16% (2) 27/32 64 64 61 63 61/64 0 / 3 14.0
This release (BF16, vLLM) 91.63% (0) 32/32 64 64 63 64 63/64 0 / 0 17.0
This release (FP8, vLLM online) 91.13% (1) 31/32 64 63 64 63 62/64 0 / 1 17.0
This release (Q8_0 GGUF, -fa off) 90.87% (0) 32/32 64 62 63 64 61/64 0 / 0 19.0
This release (Q4_K_M GGUF, -fa off) 92.14% (4) 30/32 64 62 64 64 62/64 0 / 0 19.0

Caller: the model is the person calling

Write the caller's facts, then describe what they say up front and what the trainee has to ask about. To reproduce the standard phone-caller prompt and end_call schema locally, use caller.json:

import json
from pathlib import Path
from huggingface_hub import hf_hub_download

caller = json.loads(Path(hf_hub_download("Trelis/gemma-4-E4B-it-conversational", "caller.json")).read_text())
card = caller["card"]  # Replace with your own caller facts and opening instructions.
system = caller["system"].replace("<<CALLER>>", card.strip() + "\n\n" + caller["style"])
messages = [
    {"role": "system", "content": system},
    {"role": "user", "content": "Thanks for calling the shop. How can I help?"},
]
tools = caller["tools"]

The trainee speaks as user; the generated assistant message is the caller. When the caller invokes end_call, its farewell argument is the spoken goodbye.

Assistant: the model is the person answering

Use the same chat template. Replace the caller card and speaking instructions with the assistant's job, what it needs to ask, and when to use its tools. Now user is the caller, and assistant is the support agent. Pass the tool schema separately:

messages = [
    {
        "role": "system",
        "content": "You answer repair calls for a bike shop. Ask for the ticket number if it is missing. To check repair status, use lookup_repair and tell the caller what it returns.",
    },
    {"role": "user", "content": "Is my repair ready? My ticket is B42."},
]
tools = [
    {
        "type": "function",
        "function": {
            "name": "lookup_repair",
            "description": "Look up the status of a repair ticket.",
            "parameters": {
                "type": "object",
                "properties": {"ticket": {"type": "string"}},
                "required": ["ticket"],
            },
        },
    }
]

Your app executes the requested tool, appends the assistant's tool_calls message, appends a role: "tool" message with the matching tool_call_id and tool result, and renders again to generate the spoken reply. When rendering locally with apply_chat_template, pass a Python dictionary for function.arguments.

Load and serve the model

Transformers (BF16)

from transformers import AutoModelForImageTextToText, AutoTokenizer

name = "Trelis/gemma-4-E4B-it-conversational"
tokenizer = AutoTokenizer.from_pretrained(name)
model = AutoModelForImageTextToText.from_pretrained(name, device_map="cuda", dtype="bfloat16")
inputs = tokenizer.apply_chat_template(
    messages,
    tools=tools,
    add_generation_prompt=True,
    enable_thinking=False,
    tokenize=True,
    return_dict=True,
    return_tensors="pt",
).to(model.device)
output = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=1.0, top_p=0.95, top_k=64)
print(tokenizer.decode(output[0, inputs.input_ids.shape[1]:], skip_special_tokens=False))

vLLM (recommended cloud serving: online FP8 on L40S / H100)

vllm serve Trelis/gemma-4-E4B-it-conversational \
  --dtype bfloat16 \
  --quantization fp8 \
  --max-model-len 12288 \
  --limit-mm-per-prompt '{"image":0,"audio":0}' \
  --enable-prefix-caching \
  --enable-auto-tool-choice \
  --tool-call-parser gemma4

Omit --quantization fp8 to serve in BF16. Send structured messages (and tools when needed) to /v1/chat/completions with chat_template_kwargs: {"enable_thinking": false} and Gemma decoding (temperature=1.0, top_p=0.95, top_k=64). On vLLM 0.34.0, online FP8 quantization takes 0.14s at load time and uses 10.84 GiB of GPU memory for weights.

llama.cpp (GGUF)

llama-server -hf Trelis/gemma-4-E4B-it-conversational:Q8_0 \
  --port 8080 -ngl 99 -c 16384 -fa off --jinja

Important llama.cpp CUDA note: Pass -fa off when serving Gemma 4 E4B GGUF weights on CUDA GPUs. Upstream llama.cpp CUDA Flash Attention can corrupt Gemma 4 E4B's mixed head_dim=512 global and head_dim=256 sliding-window layers into repetition loops.

Training summary

This checkpoint was trained in three stages on the language-model layers of google/gemma-4-E4B-it (leaving vision and audio towers unmodified):

  1. Expanded rejection-sampled distillation SFT: Shuffled LoRA fine-tuning (r=64, alpha=128) on 28,560 mixed turns built from 2,558 gold and 272 silver synthetic phone calls generated by Conversational Gemma 4 31B (save 74) across 989 unique training scenarios (combined from 202 original training scenarios and 831 newly authored split-clean scenarios), anchored with 1,500 spoken telephone turns, 2x multi-turn Dialt tool examples (3,554 rows), and 2x teacher-verified leak-free When2Call voice-assistant tool examples (4,212 rows).
  2. Full-sequence reverse-KL tool OPD (40 steps): On-policy reverse-KL distillation from frozen stock google/gemma-4-31B-it over full assistant responses with 2x call-trigger weighting across 2,946 Dialt and When2Call tool turns, paired with a 0.35 gold caller anchor (91.76% tool accuracy, 0 malformed calls).
  3. On-policy caller DPO polish (24 steps): Generated 700 on-policy rollouts from the Stage 2 checkpoint across 350 training scenarios, identified failing turns with gemini-3.8-flash, synthesized and verified 224 exact shared-prompt save 74 replacement turns, and trained length-normalized DPO (beta=0.10) with a positive SFT anchor (0.15) and a verified tool-calling CE anchor (0.35), raising whole-call pass to 63/64 (32/32 openings, 64/64 facts, 0 loops) while preserving 91.63% tool accuracy (0 malformed, 0 schema failures).

Limitations

  • Tuned for spoken English phone conversations; non-English performance and formal long-form writing were not targeted.
  • Tool accuracy (91.63% BF16, 91.13% FP8) trails the 31B flagship (93.16%) by roughly 1.5 points, primarily through conservative missed calls (0 malformed syntax errors and 0 schema failures in BF16).
  • The Q4_K_M GGUF introduces a small number of malformed tool calls (4/789); prefer Q8_0 (0/789 malformed) or Q6_K for strict local tool-calling workflows.
  • The GGUF files contain text-only weights (multimodal encoders omitted for smaller local downloads).

License

The conversational modifications are offered under the PolyForm Small Business License 1.0.0. The original Gemma 4 E4B Instruct weights are licensed under Apache 2.0. This repository incorporates the conversational modifications in merged BF16 and text-only GGUF formats.

Downloads last month
30
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Trelis/gemma-4-E4B-it-conversational

Quantized
(485)
this model

Collection including Trelis/gemma-4-E4B-it-conversational