Instructions to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF", filename="Gemma-4-31B-Fable-5-Distill.bf16.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Use Docker
docker model run hf.co/TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with Ollama:
ollama run hf.co/TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
- Unsloth Studio
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF to start chatting
- Pi
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- Docker Model Runner
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with Docker Model Runner:
docker model run hf.co/TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
- Lemonade
How to use TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Gemma-4-31B-Fable-5-Agent-Distill-GGUF-Q4_K_M
List all available models
lemonade list
llm.create_chat_completion(
messages = "No input example has been defined for this model task."
)Gemma 4 31B it - Claude Fable 5 Distilled
The following model was trained on claude-code traces, with some chat data provided by the community.
I recommend using the model with claude-code or pi, though other harnesses should work without issues.
The data for this model was easily extracted, formatted, and masked for training with Teich ![]()
📋 Stage Details & Benchmarks
Reasoning was left un-touched
Benchmarks coming soon
Deep Dive Analysis: For more comprehensive insights regarding the base capabilities of the Gemma 4 architecture, please refer to this Analysis Document.
🌟 Core Skills & Capabilities
Thanks to its robust base model and high-effort reasoning distillation, this model is highly optimized for the following use cases:
- 💻 Coding: Advanced code generation, debugging, and software architecture planning.
- 🔬 Science: Deep scientific reasoning, hypothesis evaluation, and analytical problem-solving.
- 🔎 Deep Research: Navigating complex, multi-step research queries and synthesizing vast amounts of information.
- 🧠 General Purpose: Highly capable instruction-following for everyday tasks requiring high logical coherence.
Getting Started
You can use all Gemma 4 models with the latest version of Transformers. To get started, install the necessary dependencies in your environment:
pip install -U transformers torch accelerate
Once you have everything installed, you can proceed to load the model with the code below:
from transformers import AutoProcessor, AutoModelForCausalLM
MODEL_ID = "google/gemma-4-31B-it"
# Load model
processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
dtype="auto",
device_map="auto"
)
Once the model is loaded, you can start generating output:
# Prompt
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a short joke about saving RAM."},
]
# Process input
text = processor.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False
)
inputs = processor(text=text, return_tensors="pt").to(model.device)
input_len = inputs["input_ids"].shape[-1]
# Generate output
outputs = model.generate(**inputs, max_new_tokens=1024)
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
# Parse output
processor.parse_response(response)
To enable reasoning, set enable_thinking=True and the parse_response function will take care of parsing the thinking output.
Best Practices
For the best performance, use these configurations and best practices:
1. Sampling Parameters
Use the following standardized sampling configuration across all use cases:
temperature=1.0top_p=0.95top_k=64
2. Thinking Mode Configuration
Compared to Gemma 3, the models use standard system, assistant, and user roles. To properly manage the thinking process, use the following control tokens:
- Trigger Thinking: Thinking is enabled by including the
<|think|>token at the start of the system prompt. To disable thinking, remove the token. - Standard Generation: When thinking is enabled, the model will output its internal reasoning followed by the final answer using this structure:
<|channel>thought\n[Internal reasoning]<channel|> - Disabled Thinking Behavior: For all models except for the E2B and E4B variants, if thinking is disabled, the model will still generate the tags but with an empty thought block:
<|channel>thought\n<channel|>[Final answer]
Note that many libraries like Transformers and llama.cpp handle the complexities of the chat template for you.
🙏 Acknowledgements
- Google: For providing an exceptional open weights model. Read more about Gemma 4 on the Google Innovation Blog.
- Unsloth: For assembling ready-to-use, cutting-edge fine-tuning environments that make this work possible.
- PawanKrd, victor and armand0e: For creating and sharing their awesome Fable datasets with the community.
📖 Citation
If you use this model in your research or projects, please cite:
@misc{teichai_gemma4_31b_fable_5_agent_distilled,
title = {TeichAI/Gemma-4-31B-Fable-5-Agent-Distill},
author = {TeichAI},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/TeichAI/Gemma-4-31B-Fable-5-Agent-Distill}}
}
- Downloads last month
- 798
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="TeichAI/Gemma-4-31B-Fable-5-Agent-Distill-GGUF", filename="", )