Skip to main content

Serving design

poot-serve is an OpenAI-compatible HTTP server. It parses and bounds requests, loads any registered model as a ModelHandle, and serves /v1/completions and /v1/chat/completions from one scheduling loop over the driver's step. /v1/embeddings, /v1/rerank and the LoRA administration routes run on the same engine thread, as encode steps and adapter operations between requests. Operator guides live under Serving.

API​

EndpointDescription
POST /v1/chat/completionsChat completion, streaming (SSE) or buffered JSON
POST /v1/completionsRaw text completion
POST /v1/embeddingsEmbedding vectors (an encoder, or a decoder's embedding pass)
POST /v1/rerankReranking scores (an encoder, or a decoder's embedding pass)
GET /v1/modelsList the served model(s)
GET /v1/models/{id}Describe one served model
/v1/lora_adaptersLoRA administration: list, hot-load, unload
GET /metricsServer metrics as JSON
GET /metrics/prometheusServer metrics in Prometheus exposition format
GET /healthLiveness probe

The scheduling loop​

Continuous batching 1 2. In-flight requests share one batch per token; when one finishes, a waiting request takes its slot before the next step, so the batch never drains.

Static: slot idles until the whole batch finishes. Next batch waits for the slowest request.
slot 0slot 1slot 20481216202428323640idleidleABCDEtoken step58% util

Because the graph has static shapes, the prepared entries are sized to the engine's row capacity and every step runs at that width, with empty rows masked out, so a changing batch composition compiles nothing. The driver reserves a request's paged KV blocks for its whole max_tokens when the loop opens the sequence, so a running request is never starved and none is preempted; a request that finds no room waits for a running one to finish. The loop (batch/engine.rs) is the only scheduler: admission, the per-step prefill token budget, token commit (end-of-sequence, stop strings, max_tokens) and terminal delivery; see Continuous batching.

Streaming. Tokens are emitted as SSE events through a bounded channel, so a slow client applies back-pressure.

Sampling. Greedy, temperature, top-k and top-p 3, with logit bias, penalties and logprobs. Generation picks the next token on-device for every request (a sampling step appended to the decode graph itself, reading back only the chosen token, a non-finite flag and any top-n logprob alternatives); full logits come back only when a caller asks for them.

Guided decoding. Regex, JSON schema (guided_json, response_format), GBNF grammar, choice lists and forced tool calls are parsed and validated. They constrain sampling with a CPU automaton that masks disallowed tokens. The mask is built on the host while the forward pass runs and applied in the on-device sampling step.

Speculative decoding is a policy of the driver: a decode row proposes drafts (prompt lookup or a second model) and verifies them in one step, and the scheduling loop does not change. poot-serve takes the policy with --draft-lookup or --draft-model. See Speculative decoding.

Weights, adapters and multiple GPUs​

Quantized checkpoints. The library loads a single GGUF file or a safetensors directory. Packed projections stay packed at load time. Dense packed contractions and embedding gathers decode as they consume the weight, and a packed MoE expert stack is read by one indexed packed contraction that decodes only the selected experts' blocks; no expert table is materialized.

FormatPacked on GPU
GGUF K-quants and Q4_0/Q8_0-style quants 4Yes, by default
MXFP4 (routed MoE experts)Packed at load; read in place by the indexed packed contraction
GPTQ 5, AWQ 6Packed 4-bit projections by default
FP8 (compressed-tensors)Packed E4M3 per-channel projections on the supported loader path

Mixed K-quant files such as Q4_K_M widen some layers, as the ggml quantizer writes them. KV-cache quantization is not implemented. Operator detail: Using quantized checkpoints.

LoRA adapters 7 use the PEFT 8 layout. poot-serve loads, selects and unloads them while it runs. Adapters apply to the seven attention and MLP projections of dense decoder families that use those projections (the feature matrix lists the families). See Using LoRA adapters.

Tensor parallelism divides the weights by role and the paged KV pool by KV heads over the ranks of a group. A multi-device coordinator in poot-executor runs pipeline and tensor-parallel programs over PTX peer-to-peer copies, and the server plans and fits each rank against its own GPU. A tensor group and a layer pipeline have served requests on a two-GPU NVLink A100 PTX pair (greedy and sampled requests match single-GPU, with per-rank admission), and world-4 tensor-parallel decode matched the single-device oracle on a four-GPU A100 pod. Not covered: serving a group of four through the server, a real checkpoint, and GPUs reachable only across CPU sockets. Backends other than PTX are not supported. See Tensor parallelism.

Metrics​

Every value is produced by poot itself, never read from sysfs or a vendor CLI. The generation counters, the batching and KV-pool gauges and the device-bytes gauge (the executor's live accounting of weights, KV pool and workspace) come from its loop.

MetricTypeDescription
poot_ttft_msHistogramTime to first token (streaming requests)
poot_itl_msHistogramInter-token latency
poot_request_e2e_msHistogramEnd-to-end request latency
poot_queue_wait_msHistogramTime a request waited for a free decode slot
poot_requests_totalCounterGeneration requests served
poot_requests_completed_totalCounterRequests that finished normally
poot_requests_cancelled_totalCounterRequests evicted on client disconnect
poot_requests_errored_totalCounterRequests that ended in an engine error
poot_prompt_tokens_totalCounterPrompt (prefill) tokens processed
poot_completion_tokens_totalCounterCompletion (decode) tokens generated
poot_inflight_requestsGaugeRequests currently being processed
poot_queue_depthGaugeRequests waiting for a free decode slot
poot_batch_sizeGaugeActive batched-decode slots in the last engine step
poot_slot_capacityGaugeBatched-decode slot capacity
poot_kv_cache_usage_ratioGaugePaged KV-cache block utilization (0..1)
poot_kv_cache_blocks_usedGaugePaged KV-cache blocks in use
poot_kv_cache_blocks_totalGaugePaged KV-cache blocks in the shared pool
poot_prefix_cache_hit_rateGaugeCumulative prefix-cache hit rate (0..1)
poot_prefix_cache_hit_tokens_totalCounterPrompt tokens served from a cached prefix
poot_prefix_cache_query_tokens_totalCounterPrompt tokens looked up against the prefix cache
poot_gpu_active_ratioGaugeGPU-active fraction (GPU-step / total decode-step wall time, 0..1)
poot_gpu_weight_bytesGaugeModel weight bytes resident in GPU memory
poot_gpu_kv_cache_bytesGaugeKV-pool bytes resident in GPU memory
poot_gpu_resident_bytesGaugeResident GPU memory the engine tracks (weights + KV pool)
poot_gpu_vram_used_bytesGaugeDevice bytes the engine holds (weights, KV pool, workspace), from the executor's live accounting
poot_gpu_vram_total_bytesGaugeDevice memory the engine plan found available at start
poot_decode_dispatch_countGaugePer-token GPU dispatch count of the optimized decode graph
poot_decode_activation_peak_bytesGaugePeak transient activation bytes of the decode graph
poot_prefill_dispatch_countGaugeGPU dispatch count of the optimized prefill (TTFT) graph
poot_prefill_activation_peak_bytesGaugePeak transient activation bytes of the prefill graph
poot_cpu_percentGaugeSystem CPU utilization since the last scrape
poot_mem_used_megabytesGaugeUsed system memory
poot_mem_total_megabytesGaugeTotal system memory
poot_uptime_secondsGaugeServer uptime

References​

Footnotes​

  1. Yu, G. et al., "Orca: A Distributed Serving System for Transformer-Based Generative Models," OSDI, 2022. https://www.usenix.org/conference/osdi22/presentation/yu ↩

  2. Kwon, W. et al., "Efficient Memory Management for Large Language Model Serving with PagedAttention," SOSP, 2023. https://arxiv.org/abs/2309.06180 ↩

  3. Holtzman, A. et al., "The Curious Case of Neural Text Degeneration," ICLR, 2020. https://arxiv.org/abs/1904.09751 ↩

  4. Gerganov, G. et al., llama.cpp / ggml GGUF format. https://github.com/ggerganov/llama.cpp ↩

  5. Frantar, E. et al., "GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers," ICLR, 2023. https://arxiv.org/abs/2210.17323 ↩

  6. Lin, J. et al., "AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration," MLSys, 2024. https://arxiv.org/abs/2306.00978 ↩

  7. Hu, E. et al., "LoRA: Low-Rank Adaptation of Large Language Models," ICLR, 2022. https://arxiv.org/abs/2106.09685 ↩

  8. Hugging Face PEFT. https://github.com/huggingface/peft ↩