acceptodds
Under review as a conference paper at ICLR 2027

DanLing NestedTensor: Composable Multi-Ragged Tensors for Deep Learning

Abstract

Variable-size inputs are common in deep learning, but dense batching allocates a shared envelope and spends computation on padding. The cost multiplies across varying axes: an explicit pair state allocates positions instead of . Packing removes that waste, but composing packed operations still requires the logical axes and sample boundaries a flat buffer no longer exposes. We present DanLing NestedTensor, a PyTorch tensor abstraction that makes multi-ragged structure a property of the tensor itself. Packed values carry tensor-backed partitions and logical dimension order, so broadcasting creates ragged axes, feature transformations retain them, and reductions consume them. The same representation carries through autograd and both eager and compiled execution. On an A100, the geometric-mean speedup over same-mode padding is 2.74 eager and 3.39 compiled across four BERT scales, and 1.97 eager across four FCN backbones. A four-block Pairformer-style workload runs 2.40-4.32 faster than a padded reference using native PyTorch kernels across square length regimes in eager execution, with peak allocation falling from 38.08 to 5.41 GiB on its high-variation batch. The tensor interface lets model code built from its supported operators compose efficient variable-size computation without managing offsets at any call site. Code will be released publicly upon publication.

Primary area:
infrastructure, software libraries, hardware, systems, etc.
Keywords:
nested tensors, ragged tensors, machine learning systems, tensor programming, automatic differentiation, dynamic shapes, efficient deep learning

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_GUnCOpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper presents DanLing NestedTensor, a PyTorch tensor abstraction that carries multiple ragged axes (including non-leading axes and N×N or N×M pair states) as part of the tensor itself. Values are stored in a packed buffer together with size, offset, dimension-order, and row-split metadata. Operator handlers, covering 404 operators through __torch_function__ and __torch_dispatch__, create ragged axes through broadcasting, preserve them through feature transformations, and consume them through reductions, so model code does not manage offsets. The representation also supports autograd and torch.compile, with the structural schema fixed at compile time and sizes passed as runtime inputs. Experiments on a single A100 with randomly initialized models measure step time and peak memory. Against padding, the paper reports geometric-mean speedups of 2.74× (eager) and 3.39× (compiled) on BERT and 1.97× on FCN, and 2.40–4.32× on a four-block Pairformer-style workload, which compiles only under DanLing. Additional controls compare against attention-only packing and explicit packing, and separate the interface overhead (≤1.6%) from the gain of batch-level segmented execution.

Critical strengths

1. A clean, composable abstraction with substantial engineering. Ragged axes are created by broadcasting, preserved by feature transformations, and consumed by reductions, and the representation also works through autograd and torch.compile. As a result, multi-ragged model code (e.g., the pair block in Fig. 3) needs no offset bookkeeping. This is the paper's main contribution and what a user would actually gain from it.

2. Honest and well-controlled performance analysis. The matched-granularity controls separate the interface overhead (≤1.6%) from the execution-strategy gain, and the bucketing experiment shows how much of the padding cost can be recovered without the method. Failed cells are reported rather than hidden. This makes it clear where the gains come from, even though it also shows that they come mostly from existing kernels rather than from the representation.

Critical weaknesses

1. The contribution is incremental: the representation does not solve the hard problem. Efficient ragged computation ultimately depends on kernels that natively handle ragged inputs, and the paper does not address this. The paper's own data shows that the gains come from existing kernels rather than from the representation. The interface itself adds ≤1.6% overhead and no speedup, while the 1.5–3.9× gain on the Pairformer workload comes from batch-level segmented calls into an external kernel library (Table 7). Without such kernels, execution falls back to per-sample calls: the non-leading and rectangular regimes gain only 1.19–1.32× over padding and match explicit packing. Representing multi-ragged tensors and mapping a subset of ops to dense kernels is therefore a limited step beyond existing ragged representations.

2. The evaluation does not target workloads that actually need the method, and accuracy is never validated. BERT, GPT-2, the WMT Transformer, and ViT need only one ragged dimension, which existing tools already support. For models that genuinely need two ragged dimensions, mainstream practice is already efficient. Segmentation training typically crops to fixed sizes, which the paper does not compare against, and on DETR the method is about 24% slower than conventional padding (Table 5). The method also changes the computation relative to the standard pipelines of these vision models, yet all models are randomly initialized and no accuracy is reported. A focused study on models that current tools cannot handle well (e.g., real pair-representation models), with both accuracy and performance evaluation, would be more convincing than a general claim of ragged-tensor support.

Questions for authors

See my concerns in the Weakness section.

1 comment

We have revised the paper to include the complete pretrained AlphaFold2 model and PointNeXt-XL, and to explain how their variable-size representations interact with shared tensor operations and existing kernels. On one A100 with BF16, AlphaFold2 inference reaches 1.81× padded throughput with 65.1% lower peak allocated memory; PointNeXt-XL reaches 1.32× padded throughput. The revised method section also illustrates the MSA, pair, and point-cloud structures used by these models.

Reviewer_7538OpenReview ↗
Rating
2
Confidence
3
Informativeness
1
Presentation
3
Soundness
2
Read review
Paper summary

DanLing NestedTensor implements ragged tensors with multiple variable-size axes in PyTorch. It keeps values packed while tracking sample boundaries and logical axes across operators, autograd, and compiled execution. Experiments on Transformer, vision, and Pairformer-style workloads show speed and memory improvements over padding.

Critical strengths
  • The representation and operator behavior are clearly explained and illustrated.

  • The implementation appears substantial, with detailed experimental controls.

Critical weaknesses
  1. The Transformer experiments are quite weak. Efficient variable-length attention already exists, and FFNs process tokens independently, so there is no intrinsic reason to retain this much padding in an optimized Transformer implementation. The authors' own controls make this clear: compiled hand-packed BERT matches DanLing within 0.19%, and bucketing reduces the gains to 1.01x eager and 1.17x compiled. These results mostly demonstrate the cost of an unnecessarily padded baseline.

  2. The novelty is unclear. Ragged tensors, including multiple ragged dimensions, have been available for years. The authors cite TensorFlow RaggedTensor, Awkward, and CoRa, but do not clearly establish what the new technical idea is beyond broader PyTorch support. The Pairformer results do not resolve this: the speedups also include different kernels and per-batch instead of per-sample execution. Admittedly, the authors include a matched-granularity control, but this primarily demonstrates low interface overhead. In the simpler example in Table 1, DanLing is 25–34% slower than hand packing.

The implementation appears solid, but the novelty is unclear and the large performance gains depend on avoidable padding or different execution strategies. I therefore recommend a weak reject.

Questions for authors

I understood the authors' intent and the manuscript. I do not have specific questions that need to be addressed.

1 comment

We have updated the paper to clarify what the shared tensor abstraction contributes beyond existing packed kernels. The revised method section shows how structural handling is reused across PyTorch operations, autograd, and compilation. In the updated eager benchmarks, NestedTensor reaches 98.9% and 98.1% of Hugging Face padding-free throughput on Llama and Qwen, respectively. The revised paper also includes explicit-packed controls for multi-axis programs.

Reviewer_EGoPOpenReview ↗
Rating
2
Confidence
1
Informativeness
2
Presentation
3(+1)
Soundness
3
Read review
Paper summary

The paper addresses efficient deep learning on batches whose examples vary along multiple logical axes. In this scenario, dense padding is especially costly for persistent pair representations. It proposes DanLing NestedTensor, a PyTorch tensor abstraction that stores packed values together with ragged partitions and logical-axis metadata. This design enables broadcasting, feature operations, reductions, autograd, and dynamic compilation to compose. The proposed technique is evaluated against padding, explicit packing, and native jagged tensors on language, vision, and Pairformer-style workloads.

Critical strengths
  1. I think the most important strength is that the paper identifies and addresses a real compositional gap in packed computation. Sections 3.1 and 3.2 talks about the packed payload, logical-to-packed indexing, and ragged-axis reduction. Figure 2 explains the distinction between sample offsets and hierarchical row splits (a small suggestion here: revise this figure). Additionally, single-pair-single program demonstrates that the representation can create, preserve, and consume multiple ragged axes without exposing offset bookkeeping in model code.

  2. Besides, the performance analysis provides several needed explanations and supports the claims. Figure 4 and Section 4.4 show that whole-program packing exceeds attention-only packing. Matched-granularity control described in Section 4.4 separates interface overhead from segmented execution. The paper also reports that bucketing reduces the BERT advantage to near parity in eager execution and that the near-uniform Pairformer gain comes primarily from fused kernels. In sum, the resulting efficiency claims are proper, supported by experiments.

Critical weaknesses

The core weakness, in my view, is that I can find solid engineering design in this paper, but the current narrative style makes the scientific contribution seem weak. The utilized components can be found in existing works, and I suggest the authors may use figures and special explanations to explain the technical contributions. Additionally, the authors may discuss more about the differences compared to previous works.

Additionally, can the proposed method be adapted to larger models that are frequently used, like the Qwen family, the LLaMA family, etc.? Would the speed-up be maintained?

Questions for authors

Since I am not very familiar with this area, there may be no further "questions" besides weaknesses. Do you have plans on releasing code and artifacts? Besides, if my questions are addressed properly, I may consider to raise the score.

Comments on the paper

4 comments
AuthorsOpenReview ↗

Updated Manuscript & Supplementary

Thank you to the reviewers and area chairs for the constructive discussion. We have uploaded the revised paper and supplementary material, incorporating the presentation changes and updated experiments discussed in our responses.

Contribution and presentation. DanLing NestedTensor is reusable PyTorch infrastructure for packed tensors with multiple variable-size axes. Its shared operators maintain sample partitions and logical-axis mappings through broadcasting, transformations, reductions, autograd, and compilation. The revised paper explains these mechanisms in Figures 2–3 and shows how they are reused in standard PyTorch modules and integrated with existing numerical kernels across models (Table 1). We have also expanded the comparison with TensorFlow RaggedTensor, Awkward, and CoRa.

Evaluation on larger models. The revised evaluation includes Llama-3.1-8B, Qwen3.5-9B, PointNeXt-XL, and the complete pretrained AlphaFold2 model:

ModelBatchNT / padded throughputNT / upstream packed throughputPeak memory: padded → NT
Llama-3.1-8B41.73×98.9%59.53 → 37.53 GiB
Qwen3.5-9B41.77×98.1%73.06 → 41.82 GiB
PointNeXt-XL321.32×—35.75 → 17.01 GiB
AlphaFold241.81×—41.05 → 14.32 GiB

These eager measurements use one A100 GPU and BF16. Llama, Qwen, and PointNeXt measure forward, loss, and backward; AlphaFold2 measures inference. The evaluation also includes explicit-packed controls for multi-axis programs, together with padding fractions and separate eager and compiled results.

Updated protocol and artifacts. The revised results supersede the numbers in our earlier rebuttal: Llama and Qwen now use 60 WikiText-2 validation articles at batch size 4, while PointNeXt and AlphaFold2 use BF16. The revised paper provides the complete settings and results, and the supplementary material includes the NestedTensor implementation and benchmark code.

Thank you for following up. We have now uploaded the revised paper and supplementary material. Following your suggestion, the revision clarifies the technical contribution and its relationship to prior work, revises Figure 2, and includes the large-model results and experimental settings. The supplementary material provides the implementation and benchmark code.

Reviewer_EGoPOpenReview ↗

Response to authors

Thank you for your further clarification!

I will raise the presentation score, and since I'm not very familiar with what a "novel contribution" should be in this area, I will see the discussions with other reviewers.

Thank you for your constructive feedback and for recognizing the improvements in presentation.

We would also like to clarify that this paper is submitted in the infrastructure and software libraries area. Our central contribution is the design and implementation of a reusable PyTorch tensor abstraction that makes operations on data with multiple ragged dimensions composable through a shared representation. This allows models to reuse these capabilities, reducing the need for model-specific packing, indexing, and shape bookkeeping. We hope this context helps clarify the nature of the contribution in the discussion with the other reviewers.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.