ninfer-perplexity
Causal perplexity evaluator for NInfer artifacts
TLDR
SYNOPSIS
ninfer-perplexity model.ninfer (--corpus manifest.json [--quick] | --text file) [options]ninfer-perplexity --help
DESCRIPTION
ninfer-perplexity measures fixed-window truncated-context causal perplexity of a v3 `.ninfer` artifact. It loads Text weights only: Vision and speculative components are not required. It is an offline evaluator, not an HTTP server and not a logits-export API.Exactly one of --corpus or --text is required. The repository corpus `ninfer-ppl-1m-v1` is 16 UTF-8 streams (English reference, English long-form, Chinese reference, and NInfer C++/CUDA). --quick keeps one stream per domain; omit it for the full set. --text scores a single UTF-8 file.Default protocol is --context 4096 and --stride 2048. Every token after the first is scored once. Each window starts from empty state, so tokens before the window origin are excluded. Reported metric:
perplexity = exp(mean_nll)
PARAMETERS
--corpus manifest.json
JSON manifest of evaluation streams. Mutually exclusive with --text.--text file
One UTF-8 file to score. Mutually exclusive with --corpus.--quick
Score one stream per domain. Requires --corpus.--context N
Window length in tokens (default 4096). Must be at least 2.--stride N
Target tokens advanced per window (default 2048). Must satisfy 1 <= stride < context.--device N
CUDA device (default 0).--tp 1|2 / --devices A,B
Tensor parallel. --devices is required with --tp 2.--kv-dtype bf16|int8|fp8|nvfp4|k8v4
KV-cache storage (default fp8). --tp 2 accepts bf16, int8, or nvfp4.--embedding-host
Read the token embedding table from one pinned host copy instead of a copy per GPU. Scores match.--output directory
Empty directory for `report.json` instead of `profiles/perplexity/`.--log-level trace|debug|info|warning|error|critical|off
stderr verbosity (default info).
CAVEATS
The first argument is a `.ninfer` artifact. Compare runs with the same corpus, context, stride, and execution flags except the variable under test. Compare --tp 2 runs with other --tp 2 runs. Token counts in the corpus name are a scale label; exact scored counts come from the artifact tokenizer and are stored in the report.
HISTORY
Part of NInfer / capy-flash (`apps/perplexity`). Apache License 2.0. Status with capy-flash v0.5.4 (2026-10-16).
SEE ALSO
ninfer(1), ninfer-serve(1), llama-cli(1), llama.cpp(1), vllm(1), nvidia-smi(1)
