Codumentor logo Codumentor

Inference Metrics Plugin

Measures how the model is generating: time to first token (TTFT) and output speed (tokens/sec). Averages are kept per prompt-size tier over a rolling window. When those averages look slow, the plugin can pause background LLM work so interactive chat stays responsive.

Enabled in the shipped default config. Pairs with Telemetry (overall timing) and Console Report (session summary).

Configuration

plugins:
  - module: codumentor.plugins.inference_metrics
    class: InferenceMetricsPlugin
    args:
      rolling_window_seconds: 180
      ttft_threshold_ms: 6000
      tokens_per_sec_threshold: 40
      min_congestion_samples: 3
      staleness_seconds: 30

All args are optional.

ArgTypeDefaultDescription
rolling_window_secondsfloat180How far back rolling averages look (seconds). At most 100 samples are kept per tier.
ttft_threshold_msfloat6000Average TTFT at or above this is treated as congested.
tokens_per_sec_thresholdfloat40Average tokens/sec at or below this is treated as congested.
min_congestion_samplesint3Minimum samples in the window before congestion can be declared.
staleness_secondsfloat30If the newest sample is older than this and no LLM call is in flight, the system is treated as idle (not congested).

Prompt-size tiers (by prompt tokens): short below 2K, medium 2K–10K, long 10K and above.

Usage

After each turn, a card appears in the transcript (web UI and TUI): TTFT 245ms | 42.5 tok/s. A slow request also shows slow. When the rolling averages are congested, a small hourglass appears on the compact card.

Expand the card for this turn (TTFT, tokens/sec, prompt size, output tokens, and LLM call count when there was more than one) plus a short / medium / long table of recent averages.

At INFO log level each LLM call logs TTFT, tokens/sec, tier, and token counts. See Logging.

With session_report: true, an Inference Performance section is added to the end-of-session report (printed by Console Report). Congestion is labeled Status: CONGESTED when thresholds are exceeded.

Notes