Skip to content

[ML] Add aten::split and aten::stack for question-answering models#3012

Merged
edsavage merged 1 commit intoelastic:mainfrom
edsavage:fix/add-split-stack-qa-ops
Mar 26, 2026
Merged

[ML] Add aten::split and aten::stack for question-answering models#3012
edsavage merged 1 commit intoelastic:mainfrom
edsavage:fix/add-split-stack-qa-ops

Conversation

@edsavage
Copy link
Contributor

@edsavage edsavage commented Mar 25, 2026

Summary

  • Adds aten::split and aten::stack to the allowlist — needed by deepset/tinyroberta-squad2 for answer span extraction in its question-answering head.
  • These ops only appear when traced with AutoModelForQuestionAnswering rather than AutoModel. Updates the extraction configs to use the correct auto_class.
  • The golden reference file (reference_model_ops.json) shows additional ops (aten::contiguous, aten::squeeze, prim::ListUnpack) in the updated tinyroberta entry — these are already in the allowlist but weren't observed in the previous base-model trace. The switch to AutoModelForQuestionAnswering captures the full QA-head graph which uses these ops.
  • Also verified that sentence-transformers/LaBSE, BAAI/bge-reranker-base, and castorini/bpr-nq-ctx-encoder (from the supported models docs) are all covered by the existing allowlist.

Test plan

  • CI passes (allowlist drift test validates tinyroberta-squad2 with QA auto_class)
  • deepset/tinyroberta-squad2 no longer rejected by graph validator

The deepset/tinyroberta-squad2 model uses aten::split (and
aten::stack per ES node logs) in its answer span extraction logic.
These ops only appear when traced with AutoModelForQuestionAnswering
rather than AutoModel. Update the extraction configs to use the
correct auto_class.

Also verified that LaBSE, BAAI/bge-reranker-base, and
castorini/bpr-nq-ctx-encoder (from the supported models docs) are
all covered by the existing allowlist.

Made-with: Cursor
@prodsecmachine
Copy link

prodsecmachine commented Mar 25, 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.

Copy link

Copilot AI left a comment

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 updates the TorchScript op allowlist and model-tracing configs so question-answering (QA) model graphs (specifically deepset/tinyroberta-squad2 traced via AutoModelForQuestionAnswering) are fully captured and validated by the PyTorch graph validator.

Changes:

  • Add aten::split (and aten::stack) to the C++ allowed-operations allowlist.
  • Update extraction/validation model configs to trace qa-tinyroberta-squad2 using AutoModelForQuestionAnswering.
  • Refresh the golden per-model op reference for qa-tinyroberta-squad2 to reflect the QA-head trace (adds ops like aten::split, prim::ListUnpack, etc.).

Reviewed changes

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

File Description
dev-tools/extract_model_ops/validation_models.json Switch qa-tinyroberta-squad2 to an explicit spec using auto_class=AutoModelForQuestionAnswering for validation tracing.
dev-tools/extract_model_ops/reference_models.json Same auto_class switch so golden extraction traces the QA head rather than the base model.
bin/pytorch_inference/unittest/testfiles/reference_model_ops.json Updates the golden ops list for qa-tinyroberta-squad2 and adds an auto_class field.
bin/pytorch_inference/CSupportedOperations.cc Adds aten::split and aten::stack to the runtime allowlist.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@wwang500 wwang500 left a comment

Choose a reason for hiding this comment

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

LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants