Turn Gemma 4 thinking mode on or off

prompting & control tokens

// what it does

Gemma 4 has a trained-in reasoning mode. Add the <|think|> token at the start of the system instruction (or pass enable_thinking=True to apply_chat_template) and the model emits a hidden chain of thought inside <|channel>thought ... <channel|> before its answer; remove the token to disable it. Use it for math, proofs, coding, and agentic tasks, and skip it for simple lookups to save latency.

// shell

$ llama-cli -hf ggml-org/gemma-4-E4B-it-GGUF -sys "<|think|>You are a math tutor." -p "Solve 3x + 7 = 22."

// gotcha

With thinking disabled, 12B/26B/31B still emit an empty <|channel>thought<channel|> pair (E2B/E4B omit it). This is intentional — it suppresses stray 'ghost' thoughts — but your output parser must tolerate the empty block.

// resources