Skip to content

[KDA] Eagerly load Paddle training imports - #3

Merged
SigureMo merged 1 commit into
paddle/kda-compactfrom
agent/paddle-kda-eager-runtime-imports
Jul 30, 2026
Merged

[KDA] Eagerly load Paddle training imports#3
SigureMo merged 1 commit into
paddle/kda-compactfrom
agent/paddle-kda-eager-runtime-imports

Conversation

@huangjiyi

Copy link
Copy Markdown
Collaborator

Summary

Move the Paddle KimiDeltaAttention training-path imports out of ShortConvolution and CP convolution runtime methods so a single import fla loads the complete training closure before Paddle compatibility is disabled. The CP convolution PyLayer now returns gradients only for the Tensor inputs tracked by Paddle.

The regression test monitors __import__ and sys.modules across dense, padding-mask, varlen, and CP convolution forward/backward. It fails if FLA executes an import after bootstrap or adds/removes an FLA module key.

Test plan

  • python -m pytest --confcutdir=tests/paddle -q tests/paddle/test_kimi_delta_attention.py: 6 passed
  • python -m pytest --confcutdir=tests/paddle -q tests/paddle: 11 passed; the two existing dense dt_bias checks remain at error ratio 0.008083792 against tolerance 0.008
  • Two-rank Paddle KDA CP: passed
  • Training import monitor: 0 runtime imports from FLA and no FLA sys.modules changes after a 50-module bootstrap
  • Static AST audit of 14 training-contract files: 0 nested imports
  • python -m pre_commit run --files ...: passed

Benchmark / NCU

Not applicable; no kernel or numerical algorithm changes.

Breaking changes

None.

@huangjiyi
huangjiyi marked this pull request as ready for review July 30, 2026 07:08
@SigureMo
SigureMo merged commit 683b34f into paddle/kda-compact Jul 30, 2026
1 check passed
@SigureMo
SigureMo deleted the agent/paddle-kda-eager-runtime-imports branch July 30, 2026 07:13
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.

2 participants