RS Infer
Setup

Configuration

Every server, model, and CLI option in a reference table.

The server reads a YAML file (default config.yaml). A fully-commented example lives at configs/config.example.yaml.

The file has two top-level sections: server (global options) and models (a list of model definitions).

CLI

Serve mode (the default) takes a single flag:

FlagShortDefaultDescription
--config <PATH>-cconfig.yamlPath to the YAML config file
rsinfer-server --config configs/config.example.yaml

rsinfer-server download <repo> <out>

Downloads a model's ONNX graph + tokenizer files from the Hugging Face Hub into <out> (created if missing), so it can be referenced with path: and served without any startup download:

rsinfer-server download Xenova/multilingual-e5-small models/e5-small
FlagDefaultDescription
--revision <REF>mainBranch, tag, or commit hash
--file <PATH>autoPin an exact graph path (e.g. onnx/model_fp16.onnx); overrides the model.onnx > fp16 > quantized preference
--subfolder <DIR>unsetSubfolder inside the repo to look in
--tokenizer-hf <REPO>unsetRepo to take tokenizer.json / config.json from, for model-only ONNX repos

HF_HOME (or HF_TOKEN for gated repos) are honored; the download lands in <out> as a self-contained folder (graph keeps its repo-relative path, e.g. onnx/model.onnx + onnx/model.onnx_data, with tokenizer.json and config.json at the folder root).

Verbosity is controlled by the RUST_LOG environment variable (see Logging).

Server options

server:
  bind: 0.0.0.0:8080
  max_body_mb: 32
  request_timeout_ms: 120000
  max_queue: 256
  queue_timeout_ms: 30000
  # hf_cache_dir: .hf-cache
KeyTypeDefaultDescription
bindstring0.0.0.0:8080host:port to bind the HTTP server to.
max_body_mbint32Hard cap on request body size (MiB). Larger requests are rejected with 413.
request_timeout_msint120000Overall per-request timeout (ms); exceeded → 408.
max_queueint256Max HTTP connections waiting for a session slot per model; overflow → 429.
queue_timeout_msint30000How long a request waits for a session slot; slow queue → 503.
hf_cache_dirpath(unset)Directory used for Hugging Face downloads. Defaults to HF_HOME or ~/.cache/huggingface.

Model options

Each entry in models selects a kind (pipeline) and a model source (hf repo id or a local path). Options common to all kinds:

KeyTypeDefaultDescription
namestring(required)Unique model id; referenced by clients as model in requests.
kindstring(required)Pipeline: embedding, rerank, zeroshot, pii.
hfstring(required if no path)Hugging Face repo id, e.g. Xenova/multilingual-e5-small. Downloaded into the cache at startup.
pathpath(required if no hf)Local directory containing model.onnx + tokenizer.json (+ config.json).
revisionstringmainHF repo branch/tag/commit.
subfolderstring(unset)Subdirectory inside the repo/path to look for files, e.g. onnx.
filestring(unset)Pin an exact graph filename (e.g. onnx/model_quantized.onnx); overrides the automatic model.onnx > fp16 > quantized preference.
tokenizer_hfstringhfRepo to take tokenizer.json/config.json from, for model-only ONNX exports.
max_lenint(unset)Tokenizer truncation length.
replicasint2Number of concurrent ORT sessions (pool replicas) — a memory vs throughput dial.
intra_threadsint0intra-op threads per session; 0 = ORT default.
epslist[string][cpu]Execution provider priority list (see Execution providers).
defaultboolfalseMake this model the default for its kind (requests without a model field use it). If unset, the single model of a kind is the default.
ort_log_levelstringwarnORT native log level: verbose, info, warn, error. error silences CoreML/TensorRT graph-partition chatter.
device_idint0GPU device index for CUDA/TensorRT/NVRTX.

Kind-specific options

Embedding (kind: embedding)

KeyTypeDefaultDescription
poolingstringautoauto (from 1_Pooling/config.json), cls, mean, last.
normalizebooltrueL2-normalize output vectors.
dimensionsint(unset)Matryoshka truncation (request may override).

Rerank (kind: rerank)

KeyTypeDefaultDescription
scoringstringautoauto, sigmoid, softmax, yes_no (all → relevance score in (0,1)), or logit (raw, unbounded scores). yes_no covers Qwen3-Reranker-style vocabulary scoring.

Zero-shot / true-false (kind: zeroshot)

KeyTypeDefaultDescription
hypothesis_templatestringThe text is about {label}.Template used for zero-shot classification.
entailment_labelstringentailmentLabel treated as entailment.
contradiction_labelstringcontradictionLabel treated as contradiction.

PII / NER (kind: pii)

KeyTypeDefaultDescription
thresholdfloat0.5Minimum token probability; below it the token is treated as outside any entity.

Execution providers

eps is a priority list. Entries not compiled into the binary, or absent from the linked ONNX Runtime build, are skipped with a warning; CPU is always the final fallback. GET /v1/models reports what each model actually uses.

ValueRequires cargo featurePlatform
cpu(always)everywhere
coremlep-coremlmacOS
cudaep-cudaLinux + CUDA/cuDNN
tensorrtep-cuda,ep-tensorrtLinux (datacenter GPUs)
nvrtxep-nvrtx,lax-ep-matchingLinux (consumer GeForce/RTX, ORT 1.22+)

CoreML caveat: for small BERT-size encoders CoreML often ends up slower than CPU (ORT splits the graph into many CPU↔CoreML partitions). Default to eps: [cpu] for small encoders and benchmark per model.

models:
  - name: e5-small
    kind: embedding
    hf: Xenova/multilingual-e5-small
    max_len: 512
    replicas: 2
    eps: [coreml, cpu]
    pooling: mean
    normalize: true

Logging

Logging uses tracing and is configured via the RUST_LOG environment variable:

RUST_LOG=info ./target/release/rsinfer-server --config config.yaml   # startup + request summaries
RUST_LOG=debug ./target/release/rsinfer-server --config config.yaml  # + EP/session/file-resolution detail
LevelWhat you see
errorErrors only
warnWarnings + errors
info (default)Startup, model loading completion, HTTP request summaries (method, route, status, duration_ms)
debugPer-file hub resolution, session construction, EP probing
traceEverything, incl. tokenizers/ORT internals (noisy)

Per-crate overrides are supported, e.g. RUST_LOG=info,hf_hub=debug to watch downloads only.

On this page