← Back to Pull requests

feat(frontend): return optional activation scores with generated tokens #19723

Open
unknown opened this pull request with 313 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 30, 2026 17:38 UTC
Author

Overview

Clients that display a score beside each generated token otherwise have to join two streams themselves. Single-choice chat and text completions can now return both together. Scores follow token positions, even when the same token ID occurs twice.

Request extension

{"nvext":{"extra_fields":["activation_scores"]}}

Response excerpt

{"nvext":{"completion_token_ids":[42,42,19],"activation_scores":[{"cyber":[0.2]},null,{"cyber":[0.7]}]}}

Key Changes

  • Streaming waits up to 50 ms by default per token-bearing chunk. Non-streaming waits once at completion. Delivery

  • A missing score yields a null row at that position. The next chunk can continue the same scorer read while generation proceeds. Score reader
  • Validation

    The chat and text HTTP test checks repeated IDs, streaming, and a stalled scorer. In a two-node H200 SGLang run, the first request returned eight inline nulls. Its handle recovered all eight scores. The next three requests delivered all 24 scores inline.

    Issues and Ongoing Work

    Builds on #19720. Inline delivery requires frontend tokenization. A scorer that falls behind generation can still produce inline nulls.

    <details>
    <summary>Pull Request Checklist</summary>

  • I used Dynamo's /pr-checklist skill.
  • </details>

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Added support for requesting activation scores inline with generated tokens or receiving a handle to retrieve scores later.
    Added a monitor-scores endpoint that routes score lookups to configured scorer services.
    Added support for activation-score requests in SGLang and vLLM, with validation for unsupported request configurations.
    Bug Fixes
    Improved SGLang token-budget calculation by using the configured maximum request length when available.
    Documentation
    Documented activation-score requests, score lookup, configuration, and unavailable-score behavior.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 313 lines (+234 / -79) across 3 files Reviewer: neilkg Review duration: 1486m
    All Vouch review confidence checks passed
    Residual risk 0.34 = Change Risk (0.64) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.64 · 313 lines diff across 3 files
    0.64
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.344
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.064
    Real PR Conversation Timeline
    1 comments
    "Review active on #19723"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 63.5% (MEDIUM) · Higher = larger blast radius
    63.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 33.9% · Safe to merge
    33.9%