Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    ollama fit optimizer

    1

    Tune Ollama models for 100% VRAM residency and peak throughput by finding the exact zero-spill layer and context limits.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    ollama fit optimizer

    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

    MetricValueStatus
    True Layer Count660-spill Verified
    Peak Throughput22.4 TPS@ 8K Context
    Balanced Knee18.1 TPS@ 128K Context
    Max Safe Context196,608 (192K)0-spill Limit
    VRAM Usage23.03 / 23.03 GB100% 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

    1. Update your coder profile or application environment variables to use the new qwen-optimized model name.
    2. Run a warmup call to trigger the initial CUDA-graph compilation before measuring real-time latency.
    3. Monitor nvidia-smi during 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Permissions

    Terminal / Shell
    Network Access
    Listed2 months ago
    Updated8 days ago

    What's inside

    Frequently Asked Questions

    This skill automates the tedious process of finding the exact 'num_gpu' and 'num_ctx' values that keep a model entirely on your GPU, preventing the performance-killing 'single layer spill' to CPU common in Ollama's default auto-fitting.

    It is compatible with any Linux or WSL2 environment running Ollama and requires Python 3. The 'bake' feature specifically requires an ext4 filesystem to persist optimized settings into your Modelfiles.

    Yes, the tool uses Ollama’s internal evaluation metrics and NVIDIA-SMI to perform a sweep across different context sizes, identifying the threshold where VRAM usage exceeds capacity (OOM).

    You receive the full Python-based toolset, including the probing scripts, the throughput benchmarking engine, and the automation utility for baking optimized parameters into new Modelfiles via the HTTP API.

    No, the tool operates through the Ollama HTTP API, meaning it can optimize and benchmark any model currently supported by your local or remote Ollama instance regardless of architecture.

    New in LLM Ops