Instructions to use twinkle-ai/gemma-3-4B-T1-it-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="twinkle-ai/gemma-3-4B-T1-it-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("twinkle-ai/gemma-3-4B-T1-it-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
Use Docker
docker model run hf.co/twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "twinkle-ai/gemma-3-4B-T1-it-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "twinkle-ai/gemma-3-4B-T1-it-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
- SGLang
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "twinkle-ai/gemma-3-4B-T1-it-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "twinkle-ai/gemma-3-4B-T1-it-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "twinkle-ai/gemma-3-4B-T1-it-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "twinkle-ai/gemma-3-4B-T1-it-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with Ollama:
ollama run hf.co/twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
- Unsloth Studio
How to use twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for twinkle-ai/gemma-3-4B-T1-it-GGUF to start chatting
- Pi
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf twinkle-ai/gemma-3-4B-T1-it-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": "twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with Docker Model Runner:
docker model run hf.co/twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
- Lemonade
How to use twinkle-ai/gemma-3-4B-T1-it-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma-3-4B-T1-it-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-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 twinkle-ai/gemma-3-4B-T1-it-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
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 twinkle-ai/gemma-3-4B-T1-it-GGUF to start chattingUsing HuggingFace Spaces for Unsloth
# No setup required# Open https://huggingface.co/spaces/unsloth/studio in your browser
# Search for twinkle-ai/gemma-3-4B-T1-it-GGUF to start chattingGemma 3 4B T1-it GGUF Collection
GGUF quantized models converted from twinkle-ai/gemma-3-4B-T1-it for use with llama.cpp.
About
Gemma 3 4B T1-it is a small language model fine-tuned on Taiwan-focused datasets, supporting both English and Traditional Chinese. This repository provides multiple quantization formats optimized for different use cases.
Available Models
| Model | Size | Use Case |
|---|---|---|
twinkle-ai-gemma-3-4B-T1-it-BF16.gguf |
Largest | Best quality, highest precision |
twinkle-ai-gemma-3-4B-T1-it-F16.gguf |
Large | High quality, good precision |
twinkle-ai-gemma-3-4B-T1-it-Q8_0.gguf |
Medium | Balanced quality and speed |
twinkle-ai-gemma-3-4b-t1-it-q4_k_m.gguf |
Smallest | Fastest inference, lower memory |
Quick Start
Option 1: Using Hugging Face Hub (Recommended)
Install llama.cpp via Homebrew:
brew install llama.cpp
Run inference directly from Hugging Face:
llama-cli --hf-repo thliang01/gemma-3-4B-T1-it-Q8_0-GGUF \
--hf-file gemma-3-4b-t1-it-q8_0.gguf \
-p "Your prompt here"
Start as a server:
llama-server --hf-repo thliang01/gemma-3-4B-T1-it-Q8_0-GGUF \
--hf-file gemma-3-4b-t1-it-q8_0.gguf \
-c 2048
Option 2: Build from Source
Step 1: Clone llama.cpp repository
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
Step 2: Build llama.cpp
Basic build (CPU only):
LLAMA_CURL=1 make
Hardware-specific build options:
NVIDIA GPU (Linux):
LLAMA_CUDA=1 LLAMA_CURL=1 makeApple Silicon (Mac):
LLAMA_METAL=1 LLAMA_CURL=1 makeAMD GPU (ROCm):
LLAMA_HIPBLAS=1 LLAMA_CURL=1 make
Step 3: Run inference
./llama-cli --hf-repo thliang01/gemma-3-4B-T1-it-Q8_0-GGUF \
--hf-file gemma-3-4b-t1-it-q8_0.gguf \
-p "Your prompt here"
Step 4: Start server (optional)
./llama-server --hf-repo thliang01/gemma-3-4B-T1-it-Q8_0-GGUF \
--hf-file gemma-3-4b-t1-it-q8_0.gguf \
-c 2048
Advanced Usage
Choosing the Right Model
Select a model based on your needs:
- Best Quality: Use
BF16orF16versions (requires more memory) - Balanced: Use
Q8_0version (recommended for most users) - Resource Constrained: Use
q4_k_mversion (suitable for devices with limited memory)
Common Parameters
-p "prompt": Your input text for the model to respond to-c 2048: Context length (maximum number of tokens that can be processed)--hf-repo: Hugging Face repository name--hf-file: Model file name to use
Adjusting Generation Parameters
llama-cli --hf-repo thliang01/gemma-3-4B-T1-it-Q8_0-GGUF \
--hf-file gemma-3-4b-t1-it-q8_0.gguf \
-p "Your prompt here" \
--temp 0.7 \
--top-p 0.9 \
--repeat-penalty 1.1
Parameter explanations:
--temp: Temperature (0.0-2.0), higher values produce more random output--top-p: Nucleus sampling parameter (0.0-1.0)--repeat-penalty: Repetition penalty to avoid repetitive content
Model Information
- Base Model: twinkle-ai/gemma-3-4B-T1-it
- Languages: English, Traditional Chinese
- License: Gemma
- Format: GGUF (converted via GGUF-my-repo)
Training Data
- Taiwan reasoning and instruction datasets
- Contract review and legal documents
- Multimodal and long-form content
- Instruction-following examples
Benchmarks
- TMMLU+: 47.44% accuracy
- MMLU: 59.13% accuracy
- TW Legal Benchmark: 44.18% accuracy
Troubleshooting
Common Issues
Q: Getting out of memory errors?
A: Try using a smaller quantized version like q4_k_m, or reduce the context length parameter -c.
Q: How can I speed up inference?
A:
- Use GPU acceleration (add hardware-specific flags during compilation)
- Choose a smaller quantized model (like
q4_k_m) - Reduce context length
Q: What prompt format does the model support?
A: This is an instruction-tuned model. Use a clear instruction format, for example:
Please analyze the main clauses of the following contract: [contract content]
Links
Contributing
If you have any questions or suggestions, please feel free to open a discussion in the Hugging Face repository.
Note: On first run, llama.cpp will automatically download the model file from Hugging Face. Please ensure you have a stable internet connection.
- Downloads last month
- 151
4-bit
8-bit
16-bit
Model tree for twinkle-ai/gemma-3-4B-T1-it-GGUF
Datasets used to train twinkle-ai/gemma-3-4B-T1-it-GGUF
lianghsun/tw-reasoning-instruct
lianghsun/tw-contract-review-chat
Collection including twinkle-ai/gemma-3-4B-T1-it-GGUF
Evaluation results
- single choice on tmmlu+test set self-reported47.440
- single choice on mmlutest set self-reported59.130
- single choice on tw-legal-benchmark-v1test set self-reported44.180

Install Unsloth Studio (macOS, Linux, WSL)
# Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for twinkle-ai/gemma-3-4B-T1-it-GGUF to start chatting