Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIGitHub CopilotGitHub CopilotGemini CLIGemini CLI+20 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

    30-day refund guarantee

    Converts to your local currency at checkout

    0 installsSecurity 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.

    What you get

    Force 100% VRAM residency to fix Ollama CPU-spill performance drops.Identify the maximum safe context window before OOM for any GGUF model.Measure real-time decode TPS to select the fastest model for low-latency apps.Automate Modelfile creation with optimal num_gpu and num_ctx parameters.

    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.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 6 days ago

    • Passed all security checks, Safe to install

    Listed6 days ago

    What's inside

    Frequently Asked Questions