Skip to content

Align cross-framework training defaults#311

Merged
shenweichen merged 14 commits into
masterfrom
codex/cross-framework-training
Jul 9, 2026
Merged

Align cross-framework training defaults#311
shenweichen merged 14 commits into
masterfrom
codex/cross-framework-training

Conversation

@shenweichen

Copy link
Copy Markdown
Owner

Summary

Align DeepCTR-Torch training defaults and shared layer behavior with DeepCTR TensorFlow while preserving native PyTorch Adam.

What changed

  • use mean-reduced training loss with sample-weighted epoch accounting
  • align L2 regularization coverage across shared tabular models
  • centralize TensorFlow-compatible Glorot initialization for DNN and output projections
  • align CIN channel ordering and initialization
  • align SENET, bilinear, attention, and CrossNetMix initialization
  • fix CrossNetMix output shape for batch size 1
  • remove the unused final weight in BilinearInteraction each mode
  • align AutoInt and DIFM attention widths and default DNN depths with TensorFlow
  • add focused regression tests for layer equations, initialization policies, L2 routing, and model defaults

Compatibility and impact

AutoInt and DIFM now use TensorFlow-compatible default attention capacity, so their default parameter counts and runtime differ from the previous PyTorch defaults. Existing explicit constructor arguments remain supported.

The proposed wide-linear initializer alignment was tested separately and reverted because paired Criteo2M runs showed repeatable AUC regression for IFM and DIFM. This PR intentionally keeps the existing PyTorch wide-linear initialization.

Validation

  • DeepCTR-Torch suite: 122 passed
  • same-weight DNN forward and gradients: floating-point equivalent
  • CIN, CrossNet, CrossNetMix, AFM, SENET, bilinear, and attention layer forward/gradient checks passed
  • DIFM same-weight TensorFlow/PyTorch prediction error: 1.19e-7
  • DIFM analytic parameter-gradient error: 6.71e-8

Effectiveness non-inferiority

A paired Criteo screen used a fixed split, one epoch, batch size 1024, and seeds 2026–2028.

  • ten common tabular models improved mean AUC versus DeepCTR-Torch master
  • full Criteo2M DIFM mean AUC delta: +0.00019
  • full Criteo2M IFM mean AUC delta: -0.00082, within the predefined -0.001 non-inferiority limit
  • no NaN, OOM, parameter-count mismatch, or prediction-contract failures were observed

Notes

This PR focuses on shared training and layer defaults. Cross-framework mathematical contracts and benchmark reports are maintained separately in ctr-model-lab.

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.19%. Comparing base (70f31d7) to head (64e7c5a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #311   +/-   ##
=======================================
  Coverage   93.19%   93.19%           
=======================================
  Files          35       35           
  Lines        2483     2484    +1     
=======================================
+ Hits         2314     2315    +1     
  Misses        169      169           
Flag Coverage Δ
pytest 93.19% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codacy-production

codacy-production Bot commented Jul 4, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🔴 Metrics 17 complexity · 5 duplication

Metric Results
Complexity 17 (≤ 20 complexity)
Duplication ⚠️ 5 (≤ 1 duplication)

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@shenweichen

Copy link
Copy Markdown
Owner Author

GPU Criteo2M validation completed for this PR.

Protocol:

  • Dataset: criteo_x1_2m.csv, 2,000,000 rows
  • Split seed: 2026
  • Training seeds: 2026, 2027, 2028
  • Epochs: 1
  • Batch size: 1024
  • Device: CUDA
  • GPU: NVIDIA GeForce RTX 4070 SUPER
  • PyTorch: 2.11.0+cu128
  • Compared branches: master vs this PR

Both sides completed 27/27 runs.

Mean PR - master deltas:

Model Δ AUC Δ logloss
AutoInt +0.004272639 -0.003814076
DCN +0.001653506 -0.001346745
DCNMix -0.000604725 +0.000477067
DeepFM +0.004707122 -0.004310376
FiBiNET +0.004783232 -0.003540088
NFM +0.002900113 -0.002681815
ONN +0.002035045 -0.001494168
WDL +0.003874650 -0.003317158
xDeepFM +0.004484985 -0.003457365

Conclusion:

  • AUC improves on 8/9 tested models.
  • Logloss improves on 8/9 tested models.
  • DCNMix is the only model with worse mean metrics, with AUC delta -0.000604725, which is still above the -0.001 non-inferiority threshold used for this validation.
  • No broad model-quality regression was observed on this GPU Criteo2M protocol.

@shenweichen shenweichen changed the title [codex] Align cross-framework training defaults Align cross-framework training defaults Jul 9, 2026
@shenweichen
shenweichen marked this pull request as ready for review July 9, 2026 11:21
@shenweichen
shenweichen merged commit 3b970d1 into master Jul 9, 2026
13 of 14 checks passed
@shenweichen
shenweichen deleted the codex/cross-framework-training branch July 9, 2026 11:30
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.

1 participant