• Stefy Lanza (nextime / spora )'s avatar
    ocr: size the VLM share to the measured footprint and cap its batch (v0.2.26) · f25592dc
    Stefy Lanza (nextime / spora ) authored
    Live measurement on the 24 GB 3090 settled what the 0.35 share could never do. Two
    boots of surya-ocr-2: a 9.57 GiB budget reported `Available KV cache memory: -1.54 GiB`,
    a 14.31 GiB budget reported `+3.18 GiB` — a fixed footprint of 11.11 and 11.13 GiB,
    i.e. ~11.1 GiB (weights 1.37 + CUDA graphs 0.30 + ~9.4 GiB activation peak) before a
    single KV block. 0.35 of this card is 8.4 GiB: under the floor, so it could not start
    no matter what else was resident, and the 06:41 boot that finally succeeded did so only
    because 6.1 GB held by other models inflated the old add-back to an absolute 0.604.
    
    Those same two data points show vLLM charges only its OWN allocations against
    total × gmu — if other residents counted, they would imply activation peaks of 8.3 and
    3.6 GiB rather than one consistent 11.1. So:
    
    - effective_gmu no longer adds back what others hold. It made the budget depend on
      unrelated residents and asked for share*total for this instance while `used` stayed
      held by someone else — at 0.60 that would have been 20+ GiB of a 24 GB card. The
      evict-first pass (prelaunch_free_gb) is what clears the card, which is the honest
      mechanism; the log line now states the share, its GB and what else is resident.
    - vlm_gpu_memory_utilization default 0.35 -> 0.60 (14.4 GiB, ~3 GiB of KV cache).
    - New ocr.vlm_max_num_batched_tokens (4096), vlm_max_num_seqs (16) and vlm_max_model_len
      (0 = inherit), plumbed through ensure_service/_launch_cmd via base.vlm_serve_limits().
      This is the better lever: the 9.4 GiB peak is profiled for the batch size, and a VLM
      OCR engine otherwise inherits the LLM backend's ctx=18432. Chunked prefill is on, so
      capping tokens per batch shrinks the peak without shrinking the usable context — lower
      it enough and OCR fits beside an LLM instead of needing 60% of the card.
    
    9 new tests (the caps, the launch command, the footprint floor); the share tests that
    asserted the add-back now assert its absence, with the reason.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_0182DhR1eFNPQyGmDrpHbedY
    f25592dc
test_ocr_olmocr.py 17.9 KB