Skip to content

Implement an LWTNN neural network node#333

Merged
nsmith- merged 15 commits into
masterfrom
lwtnn
Jun 12, 2026
Merged

Implement an LWTNN neural network node#333
nsmith- merged 15 commits into
masterfrom
lwtnn

Conversation

@nsmith-

@nsmith- nsmith- commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Also:

  • fixes up a few bad practices in C++ (leading underscore) and starts to break out of the single file implementation a bit
  • records the forwards/backwards incompatibility breaks we have had

Closes #35

* Fix correction config paths for editable installs

* Link lwtnn-stat on MSVC builds

* Added comment about editable configuration check and ran formatting

* Match pre-commit import ordering in test_binding

* updating spooky spaces that might be causing a problem?

* Preserve correctionlib version variables across lwtnn subproject

* updating version call

* Update lwtnn submodule for MSVC warning flags

* Point lwtnn submodule to fork for MSVC fix validation
@github-actions

github-actions Bot commented Apr 16, 2026

Copy link
Copy Markdown

CVMFS benchmarks

Top 25 slowest-loading corrections, sorted by mean time:

Benchmark Mean (ms) Stddev (ms) Rounds
test_load[JME/Run2-2017-UL-NanoAODv9/latest/jet_jerc.json.gz] 1007.121 6.879 5
test_load[JME/Run2-2017-UL-NanoAODv9/latest/fatJet_jerc.json.gz] 841.473 1.076 5
test_load[JME/Run3-24Prompt-Winter24-NanoAODv14/latest/jet_jerc.json.gz] 697.731 0.815 5
test_load[JME/Run3-24CDEReprocessingFGHIPrompt-Summer24-NanoAODv15/latest/fatJet_jerc.json.gz] 611.321 1.201 5
test_load[JME/Run3-24CDEReprocessingFGHIPrompt-Summer24-NanoAODv15/latest/jet_jerc.json.gz] 610.416 1.134 5
test_load[JME/Run3-25Prompt-Winter25-NanoAODv15/latest/fatJet_jerc.json.gz] 415.905 0.379 5
test_load[JME/Run3-25Prompt-Winter25-NanoAODv15/latest/jet_jerc.json.gz] 415.582 1.091 5
test_load[JME/Run3-23CSep23-Summer23-NanoAODv12/latest/fatJet_jerc.json.gz] 339.967 2.304 5
test_load[JME/Run3-23CSep23-Summer23-NanoAODv12/latest/jet_jerc.json.gz] 339.671 0.797 5
test_load[JME/Run2-2018-UL-NanoAODv9/latest/jet_jerc.json.gz] 338.939 2.027 5
test_load[JME/Run2-2016preVFP-UL-NanoAODv9/latest/jet_jerc.json.gz] 277.488 0.403 5
test_load[JME/Run2-2018-UL-NanoAODv9/latest/fatJet_jerc.json.gz] 265.791 0.752 5
test_load[JME/Run3-22EFGSep23-Summer22EE-NanoAODv12/latest/jet_jerc.json.gz] 264.398 1.941 5
test_load[JME/Run3-22EFGSep23-Summer22EE-NanoAODv12/latest/fatJet_jerc.json.gz] 263.307 2.646 5
test_load[JME/Run2-2016postVFP-UL-NanoAODv9/latest/jet_jerc.json.gz] 255.191 0.399 5
test_load[JME/Run3-23DSep23-Summer23BPix-NanoAODv12/latest/jet_jerc.json.gz] 245.397 0.573 5
test_load[JME/Run3-23DSep23-Summer23BPix-NanoAODv12/latest/fatJet_jerc.json.gz] 245.084 0.516 5
test_load[JME/Run2-2016preVFP-UL-NanoAODv9/latest/fatJet_jerc.json.gz] 244.511 9.588 5
test_load[JME/Run2-2017-UL-NanoAODv15/latest/fatJet_jerc.json.gz] 237.874 1.646 5
test_load[JME/Run2-2017-UL-NanoAODv15/latest/jet_jerc.json.gz] 237.432 0.772 5
test_load[JME/Run2-2016postVFP-UL-NanoAODv9/latest/fatJet_jerc.json.gz] 228.741 4.555 5
test_load[JME/Run2-2018-UL-NanoAODv15/latest/fatJet_jerc.json.gz] 228.039 0.459 5
test_load[JME/Run2-2018-UL-NanoAODv15/latest/jet_jerc.json.gz] 227.913 0.702 5
test_load[JME/Run3-22Prompt-Winter22-NanoAODv12/latest/jet_jerc.json.gz] 225.729 0.595 5
test_load[JME/Run3-22Prompt-Winter22-NanoAODv12/latest/fatJet_jerc.json.gz] 225.372 1.979 5

sbein and others added 5 commits May 7, 2026 08:10
Comment thread src/lwtnn.cc Outdated
Comment thread tests/test_lwtnn.py
nsmith- and others added 2 commits May 17, 2026 08:23
Wrap lwt::parse_json in a try/catch so malformed or missing fields in
the 'opaque' blob produce a clear RuntimeError rather than an opaque
boost exception. Add a test to cover the error path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nsmith- nsmith- marked this pull request as ready for review June 12, 2026 13:04
nsmith- and others added 3 commits June 12, 2026 09:00
C++ (lwtnn.cc):
- Widen try/catch to cover full constructor, wrapping LightweightNeuralNetwork
  construction errors with a correctionlib-prefixed message
- Reject string-typed correction inputs at construction time, consistent with
  all other numeric node types
- Guard against empty outputs list in the lwtnn model

Python (schemav2.py):
- _validate_input: add empty-inputs guard, None-name guard, and finalizer
  variable cross-check against opaque outputs
- _summarize: add explicit `used` flag to _SummaryInfo and set it in all
  branches (including new Formula and LWTNN cases); use it instead of the
  min/max sentinel to detect unused inputs
- Factor _artifact_base_dir into util.artifact_base_dir and apply to both
  cli.py and binding.py so editable-install path resolution is consistent

Partially Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nsmith- nsmith- added this pull request to the merge queue Jun 12, 2026
Merged via the queue into master with commit a0b860f Jun 12, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

LWTNN node

2 participants