← Back to Pull requests

feat: group speculator vLLM settings in SpeculatorVLLMConfig #145

Closed
unknown closed this pull request without merging on Oct 13, 2026 10:06 UTC
View on GitHub
unknown unknown commented on Oct 02, 2026 13:46 UTC
Author

Summary

Add a public API for overriding the managed vLLM sidecar's speculative configuration.
Users set SpeculatorConfig.vllm_speculative_config to a VLLMSpeculativeConfig.
SpeculatorConfig holds the speculator's training and data-generation settings; its
nested vllm_speculative_config field configures the managed vLLM sidecar. The SDK
merges those values into the extraction defaults and sends one complete JSON object
through the RuntimePatch environment variable SPECULATOR_VLLM_SPECULATIVE_CONFIG.
Existing root-level sidecar settings remain unchanged.

Changes

  • Keep vllm_resources, vllm_gpu_memory_utilization, vllm_endpoint, and

  • vllm_readiness_timeout_minutes as root-level trainer parameters with their existing
    behavior and defaults.
  • Export VLLMSpeculativeConfig and expose it as

  • SpeculatorConfig.vllm_speculative_config. This field is specifically for managed
    vLLM speculative-decoding overrides, separate from training/data settings. It has
    named fields enforce_eager, max_model_len, and max_num_seqs, plus actual kwargs
    for additional speculative-config attributes. Values retain their JSON types; the SDK
    does not validate vLLM attribute names or version compatibility. Values must be
    JSON-serializable. Invalid field types produce an error explaining the expected wrapper
    and showing a VLLMSpeculativeConfig(...) example.
  • Keep num_speculative_tokens fixed at 1 for hidden-state extraction; user overrides

  • for that field are not applied.
  • Recursively merge user-supplied values over the extraction defaults and serialize the

  • complete object as SPECULATOR_VLLM_SPECULATIVE_CONFIG. The SDK does not emit an
    engine-argv array, standalone engine flags, or replace the runtime's sidecar command.
  • The runtime launcher must pass the complete environment value as the single

  • --speculative-config argument, falling back to its legacy extraction JSON when the
    variable is absent. This API does not configure general vllm serve engine flags.
  • Add tests for JSON-type-preserving passthrough and the merged RuntimePatch environment

  • value; export and document the public configuration class.

    Example

    from kubeflow.trainer.rhai import (
        SpeculatorConfig,
        VLLMSpeculativeConfig,
    )
    
    config = SpeculatorConfig(
        target_layer_ids=[0, 7, 14, 27],
        vllm_speculative_config=VLLMSpeculativeConfig(
            enforce_eager=True,
            max_model_len=2048,
            parallel_drafting=False,
        ),
    )
    

    parallel_drafting illustrates raw kwargs passthrough; acceptance and effect depend
    on the installed vLLM version and runtime. The SDK sends the complete merged speculative
    JSON through the TrainJob RuntimePatch. The selected runtime must consume
    SPECULATOR_VLLM_SPECULATIVE_CONFIG as --speculative-config; the SDK does not alter the
    launcher or translate these values into engine flags.

    Testing

  • kubeflow/trainer/rhai/speculator_test.py covers passthrough of booleans, numbers,

  • lists, nested objects, and nulls, plus serialization of the merged extraction defaults
    and overrides into the RuntimePatch environment.
  • Ruff lint and formatting checks passed for the changed SDK files; 152 speculator tests

  • and the end-to-end Distributed Workloads tests passed.
  • Manual ONLINE run eagle3-online-vllmconfig-args-17 completed. The TrainJob and pod

  • contained the complete SPECULATOR_VLLM_SPECULATIVE_CONFIG; /proc/1/cmdline showed
    exactly one --speculative-config, and vLLM logged the parsed values and configured
    auxiliary layers. The node generated responses, preprocessed 10 samples, and updated
    the draft configs.
  • That run verified config delivery and workflow completion, not that all speculative

  • overrides alter target-engine behavior: EngineCore reported max_seq_len=40960 and
    enforce_eager=False, and warned that Model Runner V2 does not support parallel
    drafting for extract_hidden_states.

    Checklist

  • Docs included for user-facing changes
  • Diff: 516 lines (+387 / -129) across 6 files Reviewer: hrathina Review duration: 15619m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.76) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.76 · 516 lines diff across 6 files
    0.76
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.374
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.076
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #145"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 75.9% (HIGH) · Higher = larger blast radius
    75.9%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 30.0% · Safe to merge
    30.0%