Mortdecai 5775978899 docs: merge tooling findings into SYNTHESIS/GOTCHAS/CORPUS_* and add handoff
Patches the top-level corpus docs with the 13 findings flagged during the
2026-04-18 canonical tooling research pass. tooling/README.md now marks each
finding [merged: <file>] or [flagged] for provenance.

- CORPUS_ollama_variants.md: annotate gemma4:26b as MoE (25.2B total / 3.8B
  active, 8-of-128 experts + 1 shared). Note Q4_K_M inference is standard
  (the "MoE quality degrades at 4-bit" caveat is training-only). Add note
  that audio on E-series is NOT available via Ollama — llama.cpp mmproj
  or vLLM only.
- CORPUS_capabilities.md: native system role, configurable thinking mode,
  first trained tool use (vs Gemma 1/2/3 proof-of-concept), native object
  detection with bbox output in 1000x1000 coords, pointer to EmbeddingGemma
  for retrieval (Gemma 4 has no embedding mode).
- CORPUS_tool_calling_format.md: add Chat Template Context section
  documenting the <|turn>/<turn|> asymmetric brackets (new in Gemma 4,
  replaced <start_of_turn>/<end_of_turn>) plus <|think>, <|channel>,
  <|image>, <|audio> tokens. Add HF transformers Alternative section
  showing processor.parse_response with response_schema.
- GOTCHAS.md: add MEDIUM gotcha for abandoned google/gemma_pytorch (no
  Gemma 4 support since 2025-05-30). Expand fine-tuning section with FA2/FA4
  head_dim=512 break, fused LoRA kernel issues, 26B A4B training-quant
  guidance, new tool-call tokens as learned embeddings.
- SYNTHESIS.md: add banner pointing to tooling/ for canonical upstream
  material. Add embeddinggemma row to Model Selection table.

Also:
- Add .gitignore excluding .backup/ (local scratch per global CLAUDE.md
  convention, not needed in tracked history) and __pycache__/.
- Add .claude/handoffs/2026-04-18-canonical-tooling-research.md so future
  sessions can pick up cold — facts verified, open threads, what changed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:48:26 -04:00

gemma4-research

Research corpus and implementation guidance for Google Gemma 4, based on production use in Seth's homelab.

Files

File What When to Read
SYNTHESIS.md Start here. Opinionated guide — how to build with Gemma 4 Before any new Gemma 4 implementation
GOTCHAS.md Known issues and workarounds, severity-ranked When debugging Gemma 4 issues or starting a new project
IMPLEMENTATIONS.md Patterns from Simon and AI_Visualizer When designing a new Gemma 4 integration
CORPUS_architecture.md Model architecture details (layers, attention, PLE, MoE) When you need to understand WHY Gemma 4 behaves a certain way
CORPUS_ollama_variants.md Available models, sizes, VRAM, Ollama settings When choosing a model variant or configuring Ollama
CORPUS_capabilities.md Modalities (vision, audio, video, tools), what it can/can't do When scoping what Gemma 4 can handle
CORPUS_benchmarks.md Full benchmark table vs Gemma 3, arena scores, agentic scores When comparing Gemma 4 to alternatives
CORPUS_tool_calling_format.md Native token format + JSON API format for function calling When implementing tool calling
tooling/ Canonical upstream tooling — real scripts, notebooks, model cards, and configs pulled from Google / HF / framework maintainers (147 files). Subdirs: google-official/, huggingface/, inference-frameworks/, gemma-family/, fine-tuning/. See tooling/README.md for index and findings that update the older CORPUS_* docs When you need authoritative source material — model cards, chat templates, fine-tuning recipes, serving commands for vLLM / llama.cpp / MLX, or to scope a specialized sibling (ShieldGemma, EmbeddingGemma, etc.)

Source Projects

  • Simon (~/bin/FreibergFamily/simon/) — Multi-turn chat agent with 6 tools, genealogy historian
  • AI Visualizer (~/bin/AI_Visualizer/) — Music video generator, 4-stage Gemma pipeline + vision

Key Insight

Gemma 4 is ultra-compliant and highly capable but doesn't know who it is. It needs explicit system prompts, not hand-holding. Due to fast local inference, sequential tool calls beat long JSON requests.

S
Description
Gemma 4 research corpus, gotchas, and implementation patterns for local inference
Readme 5.4 MiB
Languages
Jupyter Notebook 79.5%
HTML 12.5%
Python 7.5%
Jinja 0.4%