Instructions to use U2DIA/gemma4-particle-edu-e4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use U2DIA/gemma4-particle-edu-e4b with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="U2DIA/gemma4-particle-edu-e4b", filename="gemma4-physics-edu-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use U2DIA/gemma4-particle-edu-e4b with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_M # Run inference directly in the terminal: llama-cli -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_M # Run inference directly in the terminal: llama-cli -hf U2DIA/gemma4-particle-edu-e4b: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 U2DIA/gemma4-particle-edu-e4b:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf U2DIA/gemma4-particle-edu-e4b: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 U2DIA/gemma4-particle-edu-e4b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_M
Use Docker
docker model run hf.co/U2DIA/gemma4-particle-edu-e4b:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use U2DIA/gemma4-particle-edu-e4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "U2DIA/gemma4-particle-edu-e4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "U2DIA/gemma4-particle-edu-e4b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/U2DIA/gemma4-particle-edu-e4b:Q4_K_M
- Ollama
How to use U2DIA/gemma4-particle-edu-e4b with Ollama:
ollama run hf.co/U2DIA/gemma4-particle-edu-e4b:Q4_K_M
- Unsloth Studio new
How to use U2DIA/gemma4-particle-edu-e4b 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 U2DIA/gemma4-particle-edu-e4b 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 U2DIA/gemma4-particle-edu-e4b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for U2DIA/gemma4-particle-edu-e4b to start chatting
- Pi new
How to use U2DIA/gemma4-particle-edu-e4b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf U2DIA/gemma4-particle-edu-e4b: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": "U2DIA/gemma4-particle-edu-e4b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use U2DIA/gemma4-particle-edu-e4b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf U2DIA/gemma4-particle-edu-e4b: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 U2DIA/gemma4-particle-edu-e4b:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use U2DIA/gemma4-particle-edu-e4b with Docker Model Runner:
docker model run hf.co/U2DIA/gemma4-particle-edu-e4b:Q4_K_M
- Lemonade
How to use U2DIA/gemma4-particle-edu-e4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull U2DIA/gemma4-particle-edu-e4b:Q4_K_M
Run and chat with the model
lemonade run user.gemma4-particle-edu-e4b-Q4_K_M
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_M# Run inference directly in the terminal:
llama-cli -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_MUse 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 U2DIA/gemma4-particle-edu-e4b:Q4_K_M# Run inference directly in the terminal:
./llama-cli -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_MBuild 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 U2DIA/gemma4-particle-edu-e4b:Q4_K_M# Run inference directly in the terminal:
./build/bin/llama-cli -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_MUse Docker
docker model run hf.co/U2DIA/gemma4-particle-edu-e4b:Q4_K_MGemma 4 Particle Edu — E4B Fine-tuned (Q4_K_M GGUF)
Fine-tuned Gemma 4 E4B (4.5B active) for physics simulation parameter generation. Part of the Gemma 4 Particle Edu Kaggle Good Hackathon submission.
What this model does
Given a natural language physics scenario (e.g., "DNA double helix at body temperature"), this model outputs a JSON simulation specification with SI-unit physics parameters:
{
"simulation": {
"prompt": "dna",
"title": "DNA Double Helix",
"domain": "biology",
"physics": {
"gravity": 0,
"damping": 0.99,
"springStiffness": 30,
"particleCount": 22000,
"temperature": 310,
"density": 1700
}
}
}
Training details
- Method: Unsloth QLoRA (r=16)
- Base: Gemma 4 E4B (4.5B active parameters)
- Dataset: 907 Alpaca-format physics simulation pairs
- Hardware: Lambda A10 (24GB)
- Cost: $0.55
- Quantization: llama.cpp Q4_K_M (CPU-only conversion)
Benchmark vs other Gemma 4 sizes
All 4 sizes fine-tuned on the same 907-pair dataset:
| Model | Type | JSON parse | Physics | Time | Cost |
|---|---|---|---|---|---|
| Base Gemma 4 9B | Dense | 30% | 0% | 12.7s | - |
| E4B FT (this model) | QLoRA r=16 | 70% | 77% | 8.9s | $0.55 |
| Base Gemma 4 26B MoE | MoE | 95% | 22% | 9.3s | - |
| 26B FT | QLoRA r=8 | 90% | 31% | 9.3s | $2.40 |
| Base Gemma 4 31B | Dense | 100% | 21% | 20.6s | - |
| 31B shallow FT | r=8, 1ep | 100% | 18% | 21.1s | $2.55 |
| 31B deep FT | r=64, 3ep | 100% | 18% | 20.0s | $2.55 |
Finding: E4B QLoRA is cost-optimal — $0.55 delivers +40%p JSON success and +77%p physics accuracy over the 9B base. Larger bases (26B/31B) already achieve 95-100% JSON parsing, so the 907-pair dataset cannot move them further.
How to use
Ollama (recommended)
# Pull this repo and register with Ollama
huggingface-cli download U2DIA/gemma4-particle-edu-e4b --local-dir ./gemma4-e4b
cd gemma4-e4b
ollama create gemma4-physics-edu -f Modelfile
ollama run gemma4-physics-edu
llama.cpp
./llama-cli -m gemma4-physics-edu-Q4_K_M.gguf -p "Simulate a DNA double helix"
Files
| File | Size | Description |
|---|---|---|
gemma4-physics-edu-Q4_K_M.gguf |
5.3 GB | Merged Q4_K_M quantized weights |
config.json |
6 KB | Hugging Face model config |
tokenizer.json |
31 MB | Tokenizer |
Modelfile |
241 B | Ollama Modelfile |
Related resources
- GitHub: https://github.com/U2SY26/gemma4-particle-edu
- Live Demo: https://gemma4-particle-edu.vercel.app
- Kaggle Writeup: https://www.kaggle.com/competitions/gemma-4-good-hackathon/writeups/gemma-4-particle-edu-free-3d-physics-simulation-v
- Kaggle Benchmark Dataset: https://www.kaggle.com/datasets/syu21125/gemma4-particle-edu-benchmark-300
- Kaggle Ollama Live Demo: https://www.kaggle.com/code/syu21125/gemma-4-particle-edu-ollama-live-demo
- 3dweb (production app, 8,470 installs): https://play.google.com/store/apps/details?id=com.sciencelab.science_lab_flutter
Limitations
- 70% JSON parse rate means ~30% of outputs need retry or fallback
- Physics accuracy was measured on 20 scenarios; full 300-scenario benchmark requires the 31B model
- Fine-tuned on English prompts; Korean prompts fall back to the base model's multilingual capability
- Not suitable for production medical, safety-critical, or regulatory-compliant simulations
Competition
Submitted to Kaggle Gemma 4 Good Hackathon (2026-05-18 deadline).
Tracks: Impact (Education) + Special Technology (Ollama + Unsloth)
Citation
@misc{gemma4-particle-edu-e4b,
author = {Yun (U2DIA)},
title = {Gemma 4 Particle Edu — E4B Fine-tuned},
year = {2026},
publisher = {HuggingFace},
url = {https://huggingface.co/U2DIA/gemma4-particle-edu-e4b}
}
- Downloads last month
- 57
4-bit
Model tree for U2DIA/gemma4-particle-edu-e4b
Evaluation results
- JSON parse rate (%)self-reported70.000
- Physics accuracy (%)self-reported77.000
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_M# Run inference directly in the terminal: llama-cli -hf U2DIA/gemma4-particle-edu-e4b:Q4_K_M