Skip to content

fix: propagate LightGBM iteration failures - #2684

Closed
小H (xiaoh1024) wants to merge 1 commit into
microsoft:masterfrom
xiaoh1024:fix/propagate-lightgbm-iteration-failures
Closed

fix: propagate LightGBM iteration failures#2684
小H (xiaoh1024) wants to merge 1 commit into
microsoft:masterfrom
xiaoh1024:fix/propagate-lightgbm-iteration-failures

Conversation

@xiaoh1024

Copy link
Copy Markdown

Related Issues/PRs

Related to #569 and #728.

This PR addresses the error-handling behavior described in those issues. It does
not attempt to resolve the underlying causes of worker or network failures.

What changes are proposed in this pull request?

TrainUtils.updateOneIteration currently catches exceptions raised during a
LightGBM iteration and sets state.isFinished = true.

This makes an iteration failure indistinguishable from legitimate training
completion. In distributed training, if one native worker fails, peer workers
can receive errors such as:

Socket recv error, Connection reset by peer

SynapseML then logs the exception as early termination. As a result, the fit can
return a partial model instead of reporting the underlying task failure.

This change:

  • logs the iteration failure and rethrows the original exception;
  • leaves state.isFinished unchanged when an iteration throws;
  • preserves the existing behavior when LightGBM legitimately reports completion;
  • allows existing Spark task and job failure handling to process the error.

It also adds a deterministic regression test using a failing booster. The test
verifies that the original exception is propagated and the training state is not
marked as finished.

How is this patch tested?

  • I have written tests and confirmed the proposed bug fix works.

The focused TrainUtilsSuite passes, including the new regression test:

Iteration failures propagate instead of becoming early termination

Does this PR change any dependencies?

  • No. You can skip this section.
  • Yes. Make sure the dependencies are resolved correctly, and list changes here.

Does this PR add a new feature? If so, have you added samples on website?

  • No. You can skip this section.
  • Yes. Make sure you have added samples following the steps below.

Copilot AI lite review requested due to automatic review settings September 1, 2026 13:30
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Hey 小H (@xiaoh1024) 👋!
Thank you so much for contributing to our repository 🙌.
Someone from SynapseML Team will be reviewing this pull request soon.

We use semantic commit messages to streamline the release process.
Before your pull request can be merged, you should make sure your first commit and PR title start with a semantic prefix.
This helps us to create release messages and credit you for your hard work!

Examples of commit messages with semantic prefixes:

  • fix: Fix LightGBM crashes with empty partitions
  • feat: Make HTTP on Spark back-offs configurable
  • docs: Update Spark Serving usage
  • build: Add codecov support
  • perf: improve LightGBM memory usage
  • refactor: make python code generation rely on classes
  • style: Remove nulls from CNTKModel
  • test: Add test coverage for CNTKModel

To test your commit locally, please follow our guild on building from source.
Check out the developer guide for additional guidance on testing your change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes LightGBM training error-handling so that exceptions thrown during TrainUtils.updateOneIteration are logged and propagated (instead of being treated as “early termination” by setting state.isFinished = true). This aligns distributed training behavior with Spark’s normal task/job failure semantics and prevents returning partial models after worker/network failures.

Changes:

  • Update TrainUtils.updateOneIteration to log iteration failures and rethrow the original exception (leaving state.isFinished unchanged on failure).
  • Add a regression test that uses a failing LightGBMBooster to verify exception propagation and that training state is not marked as finished.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lightgbm/src/main/scala/com/microsoft/azure/synapse/ml/lightgbm/TrainUtils.scala Stop converting iteration exceptions into “finished” state; log and rethrow to let Spark handle failures.
lightgbm/src/test/scala/com/microsoft/azure/synapse/ml/lightgbm/split1/TrainUtilsSuite.scala Add deterministic regression coverage ensuring iteration exceptions propagate and do not set state.isFinished.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@xiaoh1024

Copy link
Copy Markdown
Author

Sorry, I am unable to sign the CLA at this time, so I am closing this pull request. Thank you for your time.

Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Sep 4, 2026
## Summary
Stop treating native LightGBM iteration exceptions as successful early completion. Log and rethrow the original failure so Spark fails the task instead of constructing a partial model, with a deterministic regression test that preserves the exception and unfinished state.

## Prompting Intent
Investigate the value of closed PR microsoft#2684 and the linked distributed LightGBM issue family, then implement evidence-backed actionable work in an isolated worktree and validate it locally and on Microsoft Fabric.

## Linked Sources
- Closed contribution: microsoft#2684
- Historical multiclass report: microsoft#569
- Historical binary socket report: microsoft#728
- Retry diagnostics fix: microsoft#2612

## Rationale
Normal LightGBM completion is already returned by the native update call. An exception represents failure, not early stopping. Rethrowing the same object preserves the native cause and lets Spark apply task and job failure semantics; swallowing it can return an incomplete model that appears valid. This deliberately does not claim to repair every network or executor failure in the broader issue family.

Co-authored-by: Copilot <[email protected]>
Rana Singh (ranadeepsingh) added a commit that referenced this pull request Sep 4, 2026
## Summary
Stop treating native LightGBM iteration exceptions as successful early completion. Log and rethrow the original failure so Spark fails the task instead of constructing a partial model, with a deterministic regression test that preserves the exception and unfinished state.

## Prompting Itent
Investigate the value of closed PR #2684 and the linked distributed LightGBM issue family, then implement evidence-backed actionable work in an isolated worktree and validate it locally and on Microsoft Fabric.

## Linked Sources
- Closed contribution: #2684
- Historical multiclass report: #569
- Historical binary socket report: #728
- Retry diagnostics fix: #2612

## Rationale
Normal LightGBM completion is already returned by the native update call. An exception represents failure, not early stopping. Rethrowing the same object preserves the native cause and lets Spark apply task and job failure semantics; swallowing it can return an incomplete model that appears valid. This deliberately does not claim to repair every network or executor failure in the broader issue family.
@ranadeepsingh

Copy link
Copy Markdown
Collaborator

Thanks for flagging this 小H (@xiaoh1024) I've made a follow up PR and merged the fixed: #2695

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants