ninfer: inference engine on V100

ninfer: local inference engine on the V100

ninfer is the local inference engine that serves large LLM models on the NVIDIA Tesla V100-32GB via an OpenAI-compatible API. It is the component that supports the laboratory's 35B MoE models. This article documents its real-world configuration, management workflow, and the lessons learned from day-to-day operations.

What is it and where does it run

ninfer runs as a Docker container (image ninfer-v100:bench) in the main laboratory node, and exposes an API endpoint. The weights reside in a local models directory and the engine binary lives within the image.

Registered models (verified status)

  • qwen3.8-35b-a3b — MoE of ~36·109 activatable parameters, 65,536 token context window, multimodal (text, image, and video), 22.4 GiB on disk. Status: loaded (loaded).
  • gemma-4 — Gemma 4 model (26B-A4B, QAT-Q4_0, MTP variant). Status: not loaded (unloaded), available for on-demand loading.

The complete inventory of disk artifacts can be consulted with the manager.

Engine start flags

The engine is launched with the following real parameters (as seen in the state reported by the API):

--max-context 65536 --max-concurrency 4 --default-max-tokens 8192
--unload-idle-seconds 300 --prefill-cublas --prefill-chunk 2048
--spec mtp --vision --media-cache-mib 1024 --media-live-mib 2048
--kv-dtype rk4v4

For the Gemma model, the KV-dtype decreases to bf16 and draft-tokens a 2. The Qwen family adds specific flags (--lm-head-draft, --mtp-experts-q4, --gdn-state-fp16) that the engine rejects outside of that family.

Management workflow

Engine management relies on a set of scripts that start, stop, load, and unload models:

  • Start/stop: they lift or stop the engine in the container by applying flags by artifact family. The engine ignore SIGTERM: TERM/KILL must be sent, anchored to the engine binary.
  • Model manager: subcommands {list|status|ps|load <modelo> [ctx] [conc] [draft]|unload|restart} and alias for each artifact. The unload download and check with nvidia-smi that the VRAM is released.
  • Router: exposes the IDs seen in the Hermes dropdown (field model (from the request), in llama.cpp format ([*] global, [id] (by model). Download the model after a period without requests (unload-idle-seconds) so as not to leave the V100 tied up.
  • Service unit of systemd for automatic startup.

Example of use

# Load model with alias, context, and concurrency
ninfer-mgr.sh load <alias> 65536 1 3

# Status and listing
ninfer-mgr.sh status
ninfer-mgr.sh list

# Completely free VRAM
ninfer-mgr.sh unload

Lessons learned

  • VRAM is the absolute limit. The KV-cache occupies space per layer depending on the dtype (rk4v4 it is moderate; increase to q8 add ~244 MiB per layer — always confirm the fit within 32 GiB before adjusting).
  • Model swapping is costly (Qwen ↔ Gemma about 45-70 s: full download + recharge). Do not use if rapid changes are required; the unload-idle from the router minimizes the bound GPU.
  • SIGTERM is ignored by design. Correctly stopping implies TERM/KILL of the anchored binary; ignoring this rule leaves the VRAM locked and causes the next boot to fail.
  • ninfer does not substitute other engines. For embeddings or small loads, the environment uses OVMS on the iGPU; reserve the V100 for large models.
  • Announced context ≠ production context. Setting the window to 65,536 does not improve tasks of a few thousand tokens; 1 slot with 65,536 ctx is sufficient for normal use.