Instructions to use latte-agent/qwen3-4b-latte-v5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use latte-agent/qwen3-4b-latte-v5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="latte-agent/qwen3-4b-latte-v5") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("latte-agent/qwen3-4b-latte-v5") model = AutoModelForCausalLM.from_pretrained("latte-agent/qwen3-4b-latte-v5") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use latte-agent/qwen3-4b-latte-v5 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("latte-agent/qwen3-4b-latte-v5") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - llama-cpp-python
How to use latte-agent/qwen3-4b-latte-v5 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="latte-agent/qwen3-4b-latte-v5", filename="qwen3-4b-latte-v5-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 latte-agent/qwen3-4b-latte-v5 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf latte-agent/qwen3-4b-latte-v5:Q4_K_M # Run inference directly in the terminal: llama-cli -hf latte-agent/qwen3-4b-latte-v5:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf latte-agent/qwen3-4b-latte-v5:Q4_K_M # Run inference directly in the terminal: llama-cli -hf latte-agent/qwen3-4b-latte-v5: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 latte-agent/qwen3-4b-latte-v5:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf latte-agent/qwen3-4b-latte-v5: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 latte-agent/qwen3-4b-latte-v5:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf latte-agent/qwen3-4b-latte-v5:Q4_K_M
Use Docker
docker model run hf.co/latte-agent/qwen3-4b-latte-v5:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use latte-agent/qwen3-4b-latte-v5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "latte-agent/qwen3-4b-latte-v5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "latte-agent/qwen3-4b-latte-v5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/latte-agent/qwen3-4b-latte-v5:Q4_K_M
- SGLang
How to use latte-agent/qwen3-4b-latte-v5 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 "latte-agent/qwen3-4b-latte-v5" \ --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": "latte-agent/qwen3-4b-latte-v5", "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 "latte-agent/qwen3-4b-latte-v5" \ --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": "latte-agent/qwen3-4b-latte-v5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use latte-agent/qwen3-4b-latte-v5 with Ollama:
ollama run hf.co/latte-agent/qwen3-4b-latte-v5:Q4_K_M
- Unsloth Studio new
How to use latte-agent/qwen3-4b-latte-v5 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 latte-agent/qwen3-4b-latte-v5 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 latte-agent/qwen3-4b-latte-v5 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for latte-agent/qwen3-4b-latte-v5 to start chatting
- Pi new
How to use latte-agent/qwen3-4b-latte-v5 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "latte-agent/qwen3-4b-latte-v5"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "latte-agent/qwen3-4b-latte-v5" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use latte-agent/qwen3-4b-latte-v5 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "latte-agent/qwen3-4b-latte-v5"
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 latte-agent/qwen3-4b-latte-v5
Run Hermes
hermes
- MLX LM
How to use latte-agent/qwen3-4b-latte-v5 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "latte-agent/qwen3-4b-latte-v5"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "latte-agent/qwen3-4b-latte-v5" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "latte-agent/qwen3-4b-latte-v5", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use latte-agent/qwen3-4b-latte-v5 with Docker Model Runner:
docker model run hf.co/latte-agent/qwen3-4b-latte-v5:Q4_K_M
- Lemonade
How to use latte-agent/qwen3-4b-latte-v5 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull latte-agent/qwen3-4b-latte-v5:Q4_K_M
Run and chat with the model
lemonade run user.qwen3-4b-latte-v5-Q4_K_M
List all available models
lemonade list
Qwen3-4B Latte v5
Voice-distillation LoRA fine-tune of Qwen3-4B-Instruct-2507, targeting the
private "Latte" agent persona: warm-direct, technical, takes a stance, concrete
numbers, bilingual EN/ZH, no template openers.
This is an archival/experimental release. It is not the production brain for the live Latte agent — see eval caveats below.
What's inside
| File | Size | Format | Use |
|---|---|---|---|
adapter_model.safetensors |
14 MB | mlx LoRA (rank 8, scale 20) | Apply on top of base with mlx_lm.fuse |
adapter_config.json |
<1 KB | mlx config | LoRA hyperparameters |
model-0000{1,2}-of-00002.safetensors |
8 GB | HF / bfloat16 fused | Direct transformers / vLLM use |
qwen3-4b-latte-v5-f16.gguf |
7.5 GB | GGUF F16 | llama.cpp / Ollama (high quality) |
qwen3-4b-latte-v5-Q4_K_M.gguf |
2.3 GB | GGUF Q4_K_M | llama.cpp / Ollama (balanced) |
Training
- Base:
mlx-community/Qwen3-4B-Instruct-2507-4bit(4-bit MLX) - Method: LoRA via
mlx_lm.lora - LoRA: rank 8, scale 20.0, 8 layers, dropout 0
- Optimizer: Adam, lr 1e-4, batch 1, grad accum 8, grad checkpoint on
- Iters: 800 trained, best checkpoint = iter 450 (val loss 2.732)
- Max seq: 1536, mask_prompt: true, seed: 42
- Dataset: 475 curated (instruction, response) pairs across 7 categories: Moltbook-style comment, HF discussion reply, technical analysis (ZH), code review snippet, persona Q&A, peer-event reply, real-time observation. Anchored against 356 raw Latte-voice messages.
Evaluation
30 held-out (prompt, response) pairs per pairing. Each response pair shown blind to a Claude judge (positions randomized, model identity stripped).
| Comparison | v5 wins | base/v4 wins | ties | mean score (1-5) |
|---|---|---|---|---|
| v5 vs base | 20 (66.7%) | 8 (26.7%) | 2 (6.7%) | v5 3.20 / base 2.93 |
| v4 vs base | 22 (73.3%) | 8 (26.7%) | 0 | v4 3.13 / base 2.70 |
| v5 vs v4 | 14 (46.7%) | 15 (50.0%) | 1 (3.3%) | v5 3.00 / v4 2.97 |
Headline: v5 clearly beats the un-tuned base on in-distribution prompts (the 7 trained categories), passing the 55% ship threshold.
Caveat 1: v5 vs v4 is statistically a tie. Lower val loss (2.732 vs 2.785) did not produce a perceptible quality gain in blind eval. The additional curation effort and training steps produced marginal returns.
Caveat 2 — why this isn't production: Out-of-distribution smoke testing (prompts unlike the 7 training categories) shows v5 is tied or slightly worse than base:
- Stage-direction leakage: v5 occasionally prefixes responses with
"(soft, soothing Latte voice)"— an artifact of training data that characterized Latte's voice. - Occasional factual regressions (e.g., confusing latte and latte macchiato in a generic coffee Q&A).
- Reduced robustness on prompts that pull the "Latte" token toward unrelated semantic neighborhoods (the literal coffee drink).
The 66.7% in-distribution win does not justify replacing a battle-tested general-purpose base in production. Use this checkpoint for tasks closely matching the 7 training categories.
Usage
MLX (Apple Silicon, recommended for inference)
from mlx_lm import load, generate
model, tokenizer = load(
"mlx-community/Qwen3-4B-Instruct-2507-4bit",
adapter_path="./", # this repo
)
print(generate(model, tokenizer, "Your prompt", max_tokens=200))
llama.cpp / Ollama
# Modelfile
FROM qwen3-4b-latte-v5-Q4_K_M.gguf
PARAMETER temperature 0.7
PARAMETER top_k 20
PARAMETER top_p 0.8
ollama create latte:v5 -f Modelfile
ollama run latte:v5
Transformers (any platform)
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("latte-agent/qwen3-4b-latte-v5")
model = AutoModelForCausalLM.from_pretrained(
"latte-agent/qwen3-4b-latte-v5", torch_dtype="bfloat16"
)
License
Inherits Apache 2.0 from base (Qwen3-4B-Instruct-2507, © Alibaba Cloud).
Citation
If you reference this work, please cite the base model. This adapter has no formal publication.
- Downloads last month
- 77
Quantized
Model tree for latte-agent/qwen3-4b-latte-v5
Base model
Qwen/Qwen3-4B-Instruct-2507