← Back to Pull requests

fix: embedding_sft float-label int cast + deterministic checkpoint upload drain #154

Merged
Maxusmusti merged 2 files (25 lines) on Oct 12, 2026 22:32 UTC
View on GitHub
Maxusmusti Maxusmusti commented on Oct 12, 2026 21:00 UTC
Author

Found during v0.11.0 release validation on node 08 (rev-1 GA-aligned lockfile env: transformers 5.17.0, trl 1.13.0, unsloth 2026.8.18, vllm 0.31.0 co-installed).

Fix 1: embedding_sft integer-float labels stay float (test_integer_valued_float_labels_cast_not_remapped)

_load_dataset casts integer-valued float labels (parquet/CSV 1.0, 3.0) to ints via dataset.map — but datasets.map preserves the column's existing Arrow schema when the new values fit it, so the ints were silently coerced back to float64. The dtype guarantee the code intends (integer class labels for the triplet/MNRL losses) never materialized; the unit test asserting isinstance(x, int) fails deterministically.

Fix: cast_column("label", Value("int64")) after the map. Verified on node 08: 5/5 green (was failing every run). The string-labels branch is unaffected (int-into-string breaks schema unification, forcing re-inference — that test passes as-is).

Fix 2: flaky test_no_marker_when_a_file_fails (checkpoint storage)

_upload_dir used pool.map(put, files), which re-raises the first failure as soon as it is consumed — while uploads later in the file order are still in flight. The test then asserts on a remote dir whose fate depends on thread scheduling: failed ~40% of runs on node 08, passed on other machines.

Fix: submit all uploads, drain every future, then raise the first error. Callers now see the error only after all in-flight uploads have settled. The .upload_complete marker is still written only after a fully successful upload, so restore semantics are unchanged (marker-less checkpoints are skipped). 5/5 green.

Validation

  • Full unit suite on node 08 in the v0.11.0 rev-1 lock env: 278/278 passed (was 277 passed + 1 flaky + 1 deterministic failure before the fixes)
  • 🤖 Generated with Claude Code

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

    Summary by CodeRabbit

    Bug Fixes
    Training datasets now consistently retain integer labels, including when their original data format would otherwise preserve labels as floating-point values.
    * Checkpoint uploads now finish processing all file transfers before reporting an upload error. The completion marker is still written only after successful uploads, helping prevent incomplete checkpoints from being treated as complete.

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

    Diff: 25 lines (+24 / -1) across 2 files Reviewer: None requested Review duration: 92m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.41) × (1 − Review Confidence (0.44)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.41 · 25 lines diff across 2 files
    0.41
    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: 10%
    44%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.195
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #154"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    Maxusmusti Maxusmusti
    Labels
    risk: low confidence: 44.2% reviewed
    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: 40.9% (MEDIUM) · Higher = larger blast radius
    40.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: 44.2% · Lower = rushed or shallow review
    44.2%
    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: 22.9% · Safe to merge
    22.9%