Works with the AI Agents you already use
ollama fit optimizer
Tune Ollama models for 100% VRAM residency and peak throughput by finding the exact zero-spill layer and context limits.
$5
ollama fit optimizer
Example session with this skill installed
Find the peak TPS and maximum safe context for qwen3.8:27b on gpu-node:11434. I already know 66 layers fit. Bake the final config into a new model named qwen-optimized.
- Read your context and instructions
- Compiled the ollama fit optimizer
Found optimal settings for qwen3.8:27b. The model achieved 100% VRAM residency with 66 layers. Performance testing indicates a throughput cliff beyond 192K context on this hardware configuration.
Optimization Results: qwen3.8:27b
| Metric | Value | Status |
|---|---|---|
| True Layer Count | 66 | 0-spill Verified |
| Peak Throughput | 22.4 TPS | @ 8K Context |
| Balanced Knee | 18.1 TPS | @ 128K Context |
| Max Safe Context | 196,608 (192K) | 0-spill Limit |
| VRAM Usage | 23.03 / 23.03 GB | 100% Resident |
The configuration has been baked into a new model.
# Verification of baked parameters
ollama show --modelfile qwen-optimized | grep -i 'num_gpu\|num_ctx'
# Output:
# PARAMETER num_gpu 66
# PARAMETER num_ctx 196608
Next steps
- Update your coder profile or application environment variables to use the new
qwen-optimizedmodel name. - Run a warmup call to trigger the initial CUDA-graph compilation before measuring real-time latency.
- Monitor
nvidia-smiduring the first high-context request to confirm 0-spill residency.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
Ollama's auto-fit algorithm frequently leaves a single model layer on the CPU despite available VRAM, causing a significant performance drop. Identifying the exact layer count and maximum context window for zero-spill operation manually requires dozens of slow model reloads.
What it does
- Probes the true layer count by testing forced GPU residency until 0-spill is verified at 65K context.
- Sweeps context sizes to identify the peak throughput (TPS), the balanced performance sweet spot, and the absolute OOM ceiling.
- Measures accurate tokens per second using Ollama's internal eval metrics rather than unreliable character counting.
- Bakes optimized parameters (num_gpu, num_ctx) directly into new Modelfiles via the HTTP API to persist performance gains.
Frameworks & tools
Ollama HTTP API, NVIDIA SMI, Linux/WSL environments, Python 3.
Why this beats prompting it yourself
Generic prompts cannot verify VRAM residency or measure real-time TPS across context sweeps. This tool automates the hardware-specific probing required to bypass Ollama's "off-by-one" auto-fit bug, saving hours of manual trial and error per model.
Use cases
- Maximizing context windows on consumer GPUs (e.g., RTX 3060) without spilling to system RAM.
- Benchmarking different quantization levels to find the fastest decode speed for real-time avatar or TTS applications.
- Automating the creation of optimized model variants with baked-in performance parameters.
- Auditing remote Ollama instances for VRAM residency and throughput consistency.
Known limitations
The bake command requires the Ollama blob store to be on a filesystem supporting chtimes (ext4). NTFS-backed stores support measuring but may fail during the final bake step.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
Requires Ollama HTTP API access. Bake functionality may fail on NTFS-mounted blob stores due to filesystem permission constraints. Long sweeps should be run in background to avoid SIGTERM.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 8 days ago