Overview
Local inference allows you to:- Run offline: No internet required once models are downloaded
- Preserve privacy: Data never leaves your machine
- Eliminate API costs: No per-token charges
- Customize models: Use fine-tuned or specialized models
- Control resources: Manage GPU/CPU usage precisely
Quick Start
1. Install Prerequisites
macOS/Linux:2. Download a Model
Goose supports GGUF format models from Hugging Face:~/.cache/goose/models/.
3. Configure Goose
4. Run Goose
- Load the model into memory
- Allocate GPU/CPU resources
- Initialize the inference engine
Supported Models
Goose works with any GGUF model, but these are recommended:Coding Models
General Purpose
Model sizes are approximate. Quantized versions (Q4, Q5, Q6) reduce memory usage at the cost of slight accuracy loss.
Quantization Levels
GGUF models come in various quantization levels:
Example: Download specific quantization:
Configuration
Model Settings
Configure in~/.config/goose/config.yaml:
Environment Variables
Memory Management
Goose automatically estimates memory requirements and adjusts context size.Memory Estimation
Fromcrates/goose/src/providers/local_inference/inference_engine.rs:
Memory Requirements
Typical requirements for Q5_K_M quantization:Performance Tuning
GPU Acceleration
Check GPU usage:CPU Optimization
Flash Attention
Enable for 2-3x faster inference on supported hardware:- CUDA compute capability ≥ 7.0 (RTX 20 series+)
- Metal (macOS M1+)
- ROCm 5.0+
Tool Support
Local models support tool calling through two modes:Native Tools (Preferred)
Models trained with native tool calling (e.g., Qwen 2.5):Emulated Tools
For models without native support, Goose emulates tool calling:Sampling Strategies
Temperature Sampling (Default)
Balanced creativity and coherence:Greedy Sampling
Always select most likely token (deterministic):Mirostat v2
Adaptive sampling for consistent perplexity:Troubleshooting
Model won’t load
Out of Memory (OOM)
Slow generation
Poor quality responses
Advanced: Custom Model Registry
Define custom models in~/.config/goose/local_models.yaml:
Implementation Details
Source Code
- Engine:
crates/goose/src/providers/local_inference/inference_engine.rs - Model registry:
crates/goose/src/providers/local_inference/local_model_registry.rs - Native tools:
crates/goose/src/providers/local_inference/inference_native_tools.rs - Emulated tools:
crates/goose/src/providers/local_inference/inference_emulated_tools.rs - Hugging Face models:
crates/goose/src/providers/local_inference/hf_models.rs
llama.cpp Integration
Goose uses thellama-cpp-2 Rust bindings:
Resources
- llama.cpp: https://github.com/ggerganov/llama.cpp
- GGUF models: https://huggingface.co/models?library=gguf
- Quantization guide: https://github.com/ggerganov/llama.cpp/blob/master/examples/quantize/README.md
- Goose local inference:
crates/goose/src/providers/local_inference/