Skip to content

[ML] Reapply: Harden pytorch_inference with TorchScript model graph validation#3008

Merged
edsavage merged 5 commits intoelastic:mainfrom
edsavage:revert/pr-3006
Mar 24, 2026
Merged

[ML] Reapply: Harden pytorch_inference with TorchScript model graph validation#3008
edsavage merged 5 commits intoelastic:mainfrom
edsavage:revert/pr-3006

Conversation

@edsavage
Copy link
Contributor

@prodsecmachine
Copy link

prodsecmachine commented Mar 22, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

The prepacked .multilingual-e5-small model uses aten::norm for
normalization, which was not in the allowlist. This caused the
model to be rejected with "Unrecognised operations: aten::norm".

Made-with: Cursor
Extracted ops from intfloat/multilingual-e5-small (base and Eland
text_embedding variant) and added both to the reference golden file.

The base model uses standard XLM-RoBERTa ops. The Eland variant adds
pooling/normalization ops (linalg_vector_norm, clamp, etc.). The
prepacked .multilingual-e5-small model bundled with Elasticsearch uses
aten::norm (added to the allowlist in the previous commit).

Made-with: Cursor
The prepacked .multilingual-e5-small model uses aten::norm, which was
missing from the allowlist and caused production failures. This test
loads a tiny (24KB) model that mirrors the real prepacked model's graph
structure (including aten::norm) and verifies graph validation passes.

The test model was created by tracing a minimal XLM-RoBERTa-like
architecture with normalization, then patching the TorchScript IR to
use aten::norm (which modern PyTorch decomposes into
aten::linalg_vector_norm, so it can't be generated via tracing).

Made-with: Cursor
@edsavage
Copy link
Contributor Author

buildkite run_qa_tests

Copy link
Contributor

@valeriy42 valeriy42 left a comment

Choose a reason for hiding this comment

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

LGTM

@valeriy42
Copy link
Contributor

buildkite test this

@edsavage edsavage merged commit aca9bb1 into elastic:main Mar 24, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants