Unified Compiler Optimization and INT8 Quantization for Seq2Seq and Long-Context Transformers
Extend compiler export and quantization pipelines to sequence-to-sequence and sparse-attention transformers so generation and long-document models achieve production latency speedups.
Time
Compute level
Resources
What the paper used
Prerequisites
Scope
The Gap
In Section 5 and Figure 4, deployment optimization is evaluated through ONNX Runtime export for three fixed-length base models (BERT-base-cased, RoBERTa-base, and GPT-2) across CPU, GPU/FP32, and GPU/FP16, while JAX/XLA and TVM support remain early experiments.
“Figure 4 shows experiments run in collaboration with the ONNX team to optimize BERT, RoBERTa, and GPT-2 from the Transformers library.”
Limitation
Production compilation and speedup benchmarks omit sequence-to-sequence architectures with autoregressive beam search and KV-caching (such as BART, T5, and MarianMT), specialized long-distance models (Reformer and Longformer), and INT8 post-training quantization, leaving the highest-latency production models without verified acceleration paths.
Proposed Solution
Develop graph-tracing and static-shape export adapters in PyTorch and TensorFlow that separate encoder forward passes from KV-cached decoder steps, support custom sparse or LSH attention operators in ONNX/TVM/XLA, and integrate dynamic and quantization-aware INT8 calibration into the model export workflow.
The paper’s authors list this direction as future work, so they may already be pursuing it.
Why This Matters
Supporting compiler export and INT8 quantization across conditional generation and long-context models would be expected to substantially reduce inference latency and memory footprint for summarization, translation, and mobile edge deployments.
How to Get Started
How to test it: Test the hypothesis that splitting encoder-decoder graphs with KV-cached ONNX/TVM subgraphs and INT8 quantization achieves at least a 2.5x latency speedup over eager PyTorch without degrading summarization ROUGE-L or translation BLEU by more than 0.5 points on CNN/DailyMail and WMT; stop if dynamic control flow in beam search prevents static graph speedups over native TorchScript.
- Reproduce the Figure 4 ONNX Runtime FP32/FP16 latency baselines for BERT-base-cased, RoBERTa-base, and GPT-2 using the released huggingface/transformers codebase.
- Benchmark eager PyTorch and TorchScript inference latency and ROUGE-L/BLEU baselines for BART-large-cnn and T5-base on CNN/DailyMail and WMT14.
- Implement separated encoder and KV-cached decoder ONNX export wrappers with beam-search loop unrolling and dynamic INT8 quantization.
- Evaluate latency speedup, peak memory usage, and task accuracy across CPU, GPU/FP16, and TVM/XLA targets against the PyTorch baselines.
Suggested by AI. Adapt it to your setup.
Has This Been Done?
The listed papers discuss general inference acceleration frameworks, surveys on LLM serving, and compiler stacks, but none propose specific graph-tracing and static-shape export adapters separating encoder forward passes from KV-cached decoder steps with integrated INT8 calibration.
- DeepSpeed- Inference: Enabling Efficient Inference of Transformer Models at Unprecedented Scale · 2022 · 840 citations
- Optimizing AI Inference Across the Deployment Stack · 2026 · 1 citations
- Towards Efficient Generative Large Language Model Serving: A Survey from Algorithms to Systems · 2025 · 235 citations
We searched OpenAlex and arXiv for “ONNX TVM XLA quantization sequence-to-sequence transformer inference speedup” and “Unified Compiler Optimization and INT8 Quantization for Seq2Seq and Long-Context Transformers” and an AI compared the idea with the top 10 results. A small search can miss relevant work.
Source Paper
HuggingFace's Transformers: State-of-the-art Natural Language ProcessingThomas Wolf, Lysandre Debut, Victor Sanh +19 more · 2019
This paper introduces Transformers, an open-source software library and centralized Model Hub designed to make large-scale pretrained Transformer models accessible for NLP research and industrial deployment. The library unifies dozens of state-of-the-art architectures under a consistent API across PyTorch and TensorFlow while enabling community model sharing and production optimization.
Related Ideas
- Synthetic Trajectory Distillation for Specialized Open-Weight ModelsDeepCode: Open Agentic Coding🟠Medium
- Multi-Shape Generalization and End-to-End Workload Evaluation for NPU Kernel OptimizationAscendGYM: A Cost-Aware Kernel Optimization Benchmark for Real-World Workloads on Ascend NPUs🟠Medium
- Graph-Compatible Dynamic Sparse Attention for End-to-End Prefix CaptureTideway: Phase-Aware Tiered Memory Management for MoE Inference on Consumer Devices🟡Fairly easy
- Dual-Axis KV Sharing: Integrating Joint-KV with Cross-Layer and Prefix-Shared AttentionMulti-Branch Transformer🟠Medium
- Grammar-Constrained Decoding and Header-Aware Retrieval for Industrial Code SynthesisInCoder-32B: Code Foundation Model for Industrial Scenarios🟡Fairly easy