Train once, assemble many: flexible compression for seq2seq Transformers

June 4, 20236 min

Overview

Decision SnapshotReady For Pilot

Paper shows repeated experiments on T5-base/large across multiple datasets and ablations, but code/repro scripts are not provided and larger backbones were not tested.

Citations1

Evidence Strength0.80

Confidence0.85

Risk Signals9

Trust Signals

Findings with numeric evidence: 2/3

Findings with evidence refs: 3/3

Results with explicit delta: 4/4

Reproducibility

Status: Partial assets available

Open source: Unknown

At A Glance

Cost impact: 70%

Production readiness: 70%

Novelty: 70%

Authors

Wangchunshu Zhou, Ronan Le Bras, Yejin Choi

Links

Abstract / PDF / Data

Why It Matters For Business

Train once and ship one compact artifact that can be reconfigured at inference for different memory or latency targets, saving repeated retraining and storage costs while maintaining task quality.

Who Should Care

Summary TLDR

This paper presents Modular Transformers: train a set of modularized Transformer layers that each mimic different numbers of original layers, then assemble them at inference to get many compressed models from one training run. The method combines multi-grained module replacing with attention and hidden-state distillation, plus deterministic assembling strategies for either size-first or speed-first goals. On T5-base and T5-large across summarization, question generation, and translation, Modular Transformers matches or improves over prior compression methods (KD, SFT, pseudo-labeling) at common compression points, while enabling flexible compression ratios without retraining.

Problem Statement

Pre-trained seq2seq models are large and costly to store and run. Existing compression methods produce a single compact model per target size, forcing repeated training when resource targets change. The practical problem: enable one compressed artifact (trained once) that can be reconfigured at inference to meet different memory and latency budgets with small performance loss.

Main Contribution

Define modularized layers that each substitute for different numbers of consecutive original layers.

Train these layers with multi-grained module replacing plus attention and hidden-state distillation.

Key Findings

A single Modular Transformers training run supports flexible compression from small to large ratios.

Numbersclaimed flexible compression ratios 1.1×–6× (abstract)

Practical UseTrain modular layers once, then assemble different model sizes at inference to match varying memory/latency needs.

Evidence RefAbstract, §3.2

At a common compression point (6→6, size-first, 1.5/2.0×), Modular Transformers slightly outperforms KD on CNN/DailyMail.

NumbersROUGE-1 41.71 vs KD 41.26 (+0.45)

Practical UseIf you currently use KD to compress T5 to half layers, switching to Modular Transformers can give a small but consistent ROUGE boost without extra per-size training.

Evidence RefTable 1 (T5-base, 6-6, size-first)

Results

MetricValueBaselineDeltaSplit / DatasetEvidenceEvidence Ref
ROUGE-1 (CNN/DailyMail)41.71KD 41.26+0.45T5-base, size-first, 6-6 (1.5/2.0×)Modular Transformers slightly above KD at same compressionTable 1
ROUGE-1 (CNN/DailyMail)41.75KD 41.52+0.23T5-base, speed-first, 12-3 (1.9/1.6×)Modular Transformers outperforms KD when prioritizing speedTable 1

What To Try In 7 Days

Apply modular-layer design to your T5 or similar seq2seq model and train modular layers with teacher frozen.

Use size-first and speed-first assembling rules to produce two candidate deployments and measure latency vs quality.

Compare assembled models to your current distillation pipeline at one or two target sizes to validate gains.

Optimization Features

Model Optimization
multi-grained module replacingmodularized layers that replace multiple original layers
Training Optimization
curriculum replacing (coarse-to-fine)attention and representation distillation during training
Inference Optimization
deterministic assembling strategies (size-first, speed-first)decoder-first, top-down, fine-to-coarse replacement

Reproducibility

Code AvailableNo
Data AvailableYes
Open Source StatusUnknown
LicenseUnknown

Data URLs

CNN/DailyMailXSumSQuADWMT-14 En-De

Risks & Boundaries

Limitations

Evaluations limited to T5-base and T5-large; no results for BART or very large T5 (3B/11B).

Modularity design tested with granularities {2,3,4,6}; very coarse modules (e.g., 12) harmed performance.

When Not To Use

When you need guarantees at a single maximal accuracy point and prefer standard per-size distillation.

If your production stack cannot accommodate a short re-assembly validation step for a new target.

Failure Modes

Large-granularity modules can cause large performance drops if inserted incorrectly.

Wrong assembling order (random) harms quality relative to deterministic assembling.

Core Entities

Models

T5-baseT5-large

Metrics

ROUGEBLEUMETEOR

Datasets

CNN/DailyMailXSumSQuAD (question generation split)WMT-14 En-De