{
  "_published": {
    "source": "docs/measurements/ollama-num-ctx-2026-11-02.json",
    "published": "2026-11-05",
    "publisher": "J4SGON S.L., vorluxai.com",
    "index": "https://vorluxai.com/data/",
    "cleaned": "Copied from our internal repository by scripts/publish_measurements.py. Every number is unchanged. Redacted: private IP addresses -> <prime> / <second-box> / <private-ip> (2). Hostnames (spark-43d5, spark-7180) and the PRIME / spark2 labels are kept: the posts use them.",
    "redactions": {
      "private_ip": 2
    }
  },
  "title": "Ollama loaded size vs num_ctx and parallel slots",
  "date": "2026-11-02",
  "client_host": "spark-43d5",
  "method": "per model and num_ctx: unload (keep_alive 0, wait), load with one /api/generate carrying options.num_ctx and num_predict 8 (think=false where supported), read /api/ps size, size_vram and context_length while resident, MemAvailable before/after on the server, load_duration from the generate response; unload after. OLLAMA_NUM_PARALLEL is a server setting and is recorded per run, not set by the script",
  "memory_rule": "MemAvailable >= 40.0 GB and PSI full avg10 < 2 before each load; no model file over 20.0 GB",
  "runs": [
    {
      "label": "PRIME (spark-43d5), temporary Ollama instance on :11437 sharing the model store, OLLAMA_NUM_PARALLEL=1",
      "ollama": "http://127.0.0.1:11437",
      "ollama_version": "0.30.10",
      "num_parallel": 1,
      "measured_at": "2026-11-02T11:28:47+00:00",
      "resident_before": [],
      "command": "python3 scripts/bench/ollama_num_ctx.py --ollama http://127.0.0.1:11437 --num-parallel 1 --models gemma4:26b --ctx 4096,32768,131072 --label PRIME (spark-43d5), temporary Ollama instance on :11437 sharing the model store, OLLAMA_NUM_PARALLEL=1 --min-avail-gb 40 --append --out docs/measurements/ollama-num-ctx-2026-11-02.json",
      "models": [
        {
          "model": "gemma4:26b",
          "file_gb": 18.0,
          "architecture": "gemma4",
          "trained_context": 262144,
          "block_count": 30,
          "kv_heads": null,
          "quantization": "Q4_K_M",
          "parameter_size": "25.8B",
          "baked_parameters": "top_p                          0.95\ntemperature                    1\ntop_k                          64",
          "thinking": true,
          "rows": [
            {
              "num_ctx": 4096,
              "ps_size_gb": 17.2,
              "ps_size_vram_gb": 17.2,
              "ps_context_length": 4096,
              "mem_available_before_gb": 68.6,
              "mem_available_after_gb": 49.7,
              "mem_available_drop_gb": 18.9,
              "load_duration_s": 32.0,
              "wall_s": 46.2,
              "response": "OK"
            },
            {
              "num_ctx": 32768,
              "ps_size_gb": 17.47,
              "ps_size_vram_gb": 17.47,
              "ps_context_length": 32768,
              "mem_available_before_gb": 68.6,
              "mem_available_after_gb": 47.0,
              "mem_available_drop_gb": 21.6,
              "load_duration_s": 9.2,
              "wall_s": 9.4,
              "response": "OK"
            },
            {
              "num_ctx": 131072,
              "ps_size_gb": 18.36,
              "ps_size_vram_gb": 18.36,
              "ps_context_length": 131072,
              "mem_available_before_gb": 66.7,
              "mem_available_after_gb": 46.4,
              "mem_available_drop_gb": 20.3,
              "load_duration_s": 10.2,
              "wall_s": 10.4,
              "response": "OK"
            }
          ]
        }
      ]
    },
    {
      "label": "PRIME (spark-43d5), temporary Ollama instance on :11438 sharing the model store, OLLAMA_NUM_PARALLEL=4",
      "ollama": "http://127.0.0.1:11438",
      "ollama_version": "0.30.10",
      "num_parallel": 4,
      "measured_at": "2026-11-02T11:30:09+00:00",
      "resident_before": [],
      "command": "python3 scripts/bench/ollama_num_ctx.py --ollama http://127.0.0.1:11438 --num-parallel 4 --models llama3.1:8b,gemma4:26b --ctx 4096,32768 --label PRIME (spark-43d5), temporary Ollama instance on :11438 sharing the model store, OLLAMA_NUM_PARALLEL=4 --min-avail-gb 40 --append --out docs/measurements/ollama-num-ctx-2026-11-02.json",
      "models": [
        {
          "model": "llama3.1:8b",
          "file_gb": 4.9,
          "architecture": "llama",
          "trained_context": 131072,
          "block_count": 32,
          "kv_heads": 8,
          "quantization": "Q4_K_M",
          "parameter_size": "8.0B",
          "baked_parameters": "num_ctx                        32768\nstop                           \"<|start_header_id|>\"\nstop                           \"<|end_header_id|>\"\nstop                           \"<|eot_id|>\"",
          "thinking": false,
          "rows": [
            {
              "num_ctx": 4096,
              "ps_size_gb": 7.0,
              "ps_size_vram_gb": 7.0,
              "ps_context_length": 4096,
              "mem_available_before_gb": 68.3,
              "mem_available_after_gb": 61.0,
              "mem_available_drop_gb": 7.3,
              "load_duration_s": 7.5,
              "wall_s": 7.6,
              "response": "OK"
            },
            {
              "num_ctx": 32768,
              "ps_size_gb": 22.38,
              "ps_size_vram_gb": 22.38,
              "ps_context_length": 32768,
              "mem_available_before_gb": 68.4,
              "mem_available_after_gb": 39.7,
              "mem_available_drop_gb": 28.7,
              "load_duration_s": 6.4,
              "wall_s": 6.5,
              "response": "OK"
            }
          ]
        },
        {
          "model": "gemma4:26b",
          "file_gb": 18.0,
          "architecture": "gemma4",
          "trained_context": 262144,
          "block_count": 30,
          "kv_heads": null,
          "quantization": "Q4_K_M",
          "parameter_size": "25.8B",
          "baked_parameters": "top_k                          64\ntop_p                          0.95\ntemperature                    1",
          "thinking": true,
          "rows": [
            {
              "num_ctx": 4096,
              "ps_size_gb": 18.67,
              "ps_size_vram_gb": 18.67,
              "ps_context_length": 4096,
              "mem_available_before_gb": 62.4,
              "mem_available_after_gb": 40.8,
              "mem_available_drop_gb": 21.6,
              "load_duration_s": 8.7,
              "wall_s": 8.9,
              "response": "OK"
            },
            {
              "num_ctx": 32768,
              "ps_size_gb": 19.84,
              "ps_size_vram_gb": 19.84,
              "ps_context_length": 32768,
              "mem_available_before_gb": 61.0,
              "mem_available_after_gb": 43.4,
              "mem_available_drop_gb": 17.6,
              "load_duration_s": 9.2,
              "wall_s": 9.3,
              "response": "OK"
            }
          ]
        }
      ]
    },
    {
      "label": "spark2 (spark-7180), production Ollama 0.34.0, OLLAMA_NUM_PARALLEL=8, OLLAMA_CONTEXT_LENGTH=32768 in the unit; gemma4-32k resident throughout",
      "ollama": "http://<second-box>:11434",
      "ollama_version": "0.34.0",
      "num_parallel": 8,
      "measured_at": "2026-11-02T11:31:43+00:00",
      "resident_before": [
        "gemma4-32k:latest",
        "qwen3.6:35b"
      ],
      "command": "python3 scripts/bench/ollama_num_ctx.py --ollama http://<second-box>:11434 --num-parallel 8 --mem-host spark2 --models llama3.1:8b,qwen3.6:35b --ctx 4096,16384,32768 --label spark2 (spark-7180), production Ollama 0.34.0, OLLAMA_NUM_PARALLEL=8, OLLAMA_CONTEXT_LENGTH=32768 in the unit; gemma4-32k resident throughout --min-avail-gb 45 --max-model-gb 25 --append --out docs/measurements/ollama-num-ctx-2026-11-02.json",
      "models": [
        {
          "model": "llama3.1:8b",
          "file_gb": 4.9,
          "architecture": "llama",
          "trained_context": 131072,
          "block_count": 32,
          "kv_heads": 8,
          "quantization": "Q4_K_M",
          "parameter_size": "8.0B",
          "baked_parameters": "num_ctx                        16384\nstop                           \"<|start_header_id|>\"\nstop                           \"<|end_header_id|>\"\nstop                           \"<|eot_id|>\"",
          "thinking": false,
          "rows": [
            {
              "num_ctx": 4096,
              "ps_size_gb": 9.15,
              "ps_size_vram_gb": 9.15,
              "ps_context_length": 4096,
              "mem_available_before_gb": 81.8,
              "mem_available_after_gb": 53.0,
              "mem_available_drop_gb": 28.8,
              "load_duration_s": 4.8,
              "wall_s": 5.0,
              "response": "OK"
            },
            {
              "num_ctx": 16384,
              "ps_size_gb": 22.32,
              "ps_size_vram_gb": 22.32,
              "ps_context_length": 16384,
              "mem_available_before_gb": 62.9,
              "mem_available_after_gb": 40.0,
              "mem_available_drop_gb": 22.9,
              "load_duration_s": 3.3,
              "wall_s": 3.4,
              "response": "OK"
            },
            {
              "num_ctx": 32768,
              "ps_size_gb": 39.27,
              "ps_size_vram_gb": 39.27,
              "ps_context_length": 32768,
              "mem_available_before_gb": 63.1,
              "mem_available_after_gb": 23.2,
              "mem_available_drop_gb": 39.9,
              "load_duration_s": 3.6,
              "wall_s": 3.7,
              "response": "OK"
            }
          ]
        },
        {
          "model": "qwen3.6:35b",
          "file_gb": 23.9,
          "architecture": "qwen35moe",
          "trained_context": 262144,
          "block_count": 40,
          "kv_heads": null,
          "quantization": "Q4_K_M",
          "parameter_size": "36.0B",
          "baked_parameters": "repeat_penalty                 1\ntemperature                    1\ntop_k                          20\ntop_p                          0.95\nmin_p                          0\nnum_ctx                        16384\npresence_penalty               1.5",
          "thinking": true,
          "rows": [
            {
              "num_ctx": 4096,
              "ps_size_gb": 22.72,
              "ps_size_vram_gb": 22.72,
              "ps_context_length": 4096,
              "mem_available_before_gb": 63.0,
              "mem_available_after_gb": 38.3,
              "mem_available_drop_gb": 24.7,
              "load_duration_s": 4.6,
              "wall_s": 4.8,
              "response": "OK"
            },
            {
              "num_ctx": 16384,
              "ps_size_gb": 23.1,
              "ps_size_vram_gb": 23.1,
              "ps_context_length": 16384,
              "mem_available_before_gb": 63.0,
              "mem_available_after_gb": 37.9,
              "mem_available_drop_gb": 25.1,
              "load_duration_s": 4.3,
              "wall_s": 4.5,
              "response": "OK"
            },
            {
              "num_ctx": 32768,
              "ps_size_gb": 23.47,
              "ps_size_vram_gb": 23.47,
              "ps_context_length": 32768,
              "mem_available_before_gb": 63.1,
              "mem_available_after_gb": 37.6,
              "mem_available_drop_gb": 25.5,
              "load_duration_s": 4.4,
              "wall_s": 4.5,
              "response": "OK"
            }
          ]
        }
      ]
    },
    {
      "label": "PRIME (spark-43d5), temporary Ollama instance on :11437 sharing the model store, OLLAMA_NUM_PARALLEL=1",
      "ollama": "http://127.0.0.1:11437",
      "ollama_version": "0.30.10",
      "num_parallel": 1,
      "measured_at": "2026-11-02T11:37:23+00:00",
      "resident_before": [],
      "command": "python3 scripts/bench/ollama_num_ctx.py --ollama http://127.0.0.1:11437 --num-parallel 1 --models llama3.1:8b --ctx 4096,32768,131072 --label PRIME (spark-43d5), temporary Ollama instance on :11437 sharing the model store, OLLAMA_NUM_PARALLEL=1 --min-avail-gb 40 --append --out docs/measurements/ollama-num-ctx-2026-11-02.json",
      "models": [
        {
          "model": "llama3.1:8b",
          "file_gb": 4.9,
          "architecture": "llama",
          "trained_context": 131072,
          "block_count": 32,
          "kv_heads": 8,
          "quantization": "Q4_K_M",
          "parameter_size": "8.0B",
          "baked_parameters": "num_ctx                        32768\nstop                           \"<|start_header_id|>\"\nstop                           \"<|end_header_id|>\"\nstop                           \"<|eot_id|>\"",
          "thinking": false,
          "rows": [
            {
              "num_ctx": 4096,
              "ps_size_gb": 5.27,
              "ps_size_vram_gb": 5.27,
              "ps_context_length": 4096,
              "mem_available_before_gb": 66.0,
              "mem_available_after_gb": 59.5,
              "mem_available_drop_gb": 6.5,
              "load_duration_s": 5.5,
              "wall_s": 5.6,
              "response": "OK"
            },
            {
              "num_ctx": 32768,
              "ps_size_gb": 9.21,
              "ps_size_vram_gb": 9.21,
              "ps_context_length": 32768,
              "mem_available_before_gb": 65.3,
              "mem_available_after_gb": 58.1,
              "mem_available_drop_gb": 7.2,
              "load_duration_s": 5.8,
              "wall_s": 5.9,
              "response": "OK"
            },
            {
              "num_ctx": 131072,
              "ps_size_gb": 22.79,
              "ps_size_vram_gb": 22.79,
              "ps_context_length": 131072,
              "mem_available_before_gb": 67.8,
              "mem_available_after_gb": 44.1,
              "mem_available_drop_gb": 23.7,
              "load_duration_s": 6.7,
              "wall_s": 6.8,
              "response": "OK"
            }
          ]
        }
      ]
    }
  ]
}
