Skip to content
AI.info

Research

HydraLLM: Adaptive Width Slicing for Elastic Text and Vision-Language Models

Overview Research area: Natural Language Processing / efficient transformer architectures, with an extension to vision-language models (elastic and nested model inference). Technical level: Intermedia

HydraLLM: Adaptive Width Slicing for Elastic Text and Vision-Language Models
arXiv
2610.23455
Published
2026-10-16
Authors
Oscar Kemme, Janek Haberer, Ali Hojjat, Olaf Landsiedel

AI summary

Overview

Research area: Natural Language Processing / efficient transformer architectures, with an extension to vision-language models (elastic and nested model inference).

Technical level: Intermediate. The paper assumes familiarity with transformer internals (multi-query attention, feed-forward blocks, embedding and output-head dimensions), knowledge distillation, and standard LLM benchmarks; the writing itself is clear about the pipeline stages.

Scope: The paper converts a pre-trained Gemma 3 270M checkpoint into a single elastic model whose active width is set at runtime by the number of active query heads, and extends the same width axis to a multimodal model built with Gemma 3 4B vision components.

What This Paper Is About

Transformer-based language and vision-language models have fixed architectures after training, so deploying one model across hardware with different compute, latency and model-size budgets usually means training or extracting separate models. The authors ask whether a single checkpoint can be sliced at inference time into a nested family of smaller subnetworks — spanning embeddings, attention projections, feed-forward layers and the output head — while remaining accurate. They also ask whether the same control knob can shrink a multimodal model end to end, including the projection that maps visual features into text embedding space.

Key Contributions

  1. End-to-end slicing for decoder-only LLMs. A single runtime control, the number of active query heads k, selects consistent prefixes of the embedding channels, attention projections, FFN neurons and output head, producing nested decoder subnetworks from one parameter set (built on the HydraViT head-stacking principle and targeting multi-query attention, where all query heads share one key-value head).
  2. A unified static-to-elastic conversion pipeline. A single training recipe converts a static pre-trained LLM into an adaptively sliceable one, combining importance-driven weight reordering with stochastic subnetwork training, a z-loss term and logit-based knowledge distillation from a frozen teacher.
  3. An elastic multimodal projection for LVLMs. The projection output width is forced to equal the active text embedding width, so the same k controls both the text decoder and the vision-to-text interface.
  4. An empirical comparison against FFN-only elasticity. The authors reimplement a MatFormer-style FFN-slicing baseline on the same Gemma 3 270M checkpoint and compare accuracy, parameter coverage and throughput.

Main Findings

  • Reordering metric choice matters. Magnitude importance for embeddings combined with CETT for heads and FFN gave the strongest subnetwork perplexities on Shakespeare plays; VxC consistently hurt. Before training, this recipe reduced H1 perplexity from 168.6M (no reordering) to 37.2k, a factor of roughly 4,500.
  • The reordering advantage shrinks after training. After 20,000 steps (~1B tokens), the gap narrowed: H1 perplexity was 106.6 with mag-cett-cett versus 123.9 with no reordering, and the paper reports the post-training effect as at most 14%.
  • Knowledge distillation is critical. The authors report that KD improves TriviaQA exact-match accuracy at 75% of active heads by 97.3%.
  • Wider parameter coverage than MatFormer at competitive accuracy. HydraLLM submodels start at 49.34M parameters versus 215.01M for the MatFormer configurations. On ARC-Easy raw accuracy, MatFormer W0.25 was slightly higher than H3 but the difference was not statistically significant, and answer-length-normalized accuracies were virtually the same.
  • TriviaQA separates the methods. H3 achieved 2.21 percentage points (×2.51) higher exact-match accuracy than the similarly sized MatFormer W0.25, which has 17.25% more parameters. MatFormer W0.5 and W0.75 interpolated smoothly between HydraLLM H4 and H3, and MatFormer W1.0 beat H4 by 0.68 percentage points. H1 and H2 reached close to 0% accuracy on this benchmark.
  • Prompt processing improves only modestly. Going from H4 to H1 improved prefill throughput by 9.78% to 11.61%; MatFormer improved by 1.03% to 3.1%. Decode throughput for HydraLLM ranged from 1,057.0 tokens/s (H1) to 603.0 (H4), with H3 at 594.2 — slightly below H4, which the authors attribute to kernel-shape optimizations in llama.cpp.
  • Token generation scales much more for HydraLLM. From the largest to the smallest configuration, decode speed improved 75.29% for HydraLLM versus 11.17% for MatFormer. The authors note that MQA prevents key-value cache savings from width reduction, so the gains come mostly from smaller embeddings and query, output and FFN projections.
  • Multimodal CLIPScore reaches the 7× larger baseline. With scaled training (16,000 steps, from a text fine-tune plus pre-aligned projection), the all-parameters run scored 62.6 / 66.9 / 68.6 / 69.6 at H1–H4, versus 65.3 for Gemma 3 4B. The conclusion states this exceeds the 65.3 baseline by 2.5%, 5.1% and 6.6% at two, three and four active heads respectively.
  • Projection-only training plateaus quickly. Training the projection alone gave only modest gains over the untrained projection (which already scored 32.4 / 31.5 / 32.0 / 32.7 across heads), with the loss plateauing after 300 to 350 steps. The authors attribute this to limited projection capacity — the projection has 25% of the parameters of the Gemma 3 4B model.
  • MMMU remains weak. HydraLLM models stayed at roughly 25% (random) accuracy, while Gemma 3 4B reached about 39%. Qualitative captioning showed hallucinations and weak object grounding at every head configuration.

Methodology in Plain English

The authors start from an already-trained small model (Gemma 3 270M) rather than training from scratch. Because prefix slicing keeps only the first units of each dimension, they first rearrange the model's weights so that the most important units sit at the front: they score units using activation statistics gathered on a calibration text corpus, then permute the embedding channels, query heads and FFN neurons consistently across all connected tensors, which leaves the full model's function unchanged.

They then train the rearranged model as an elastic one. At each step they sample one head count k, build only the corresponding subnetwork, and update only those weights. Earlier units are active for more sampled values of k, so they naturally receive more gradient updates. The training loss combines next-token cross-entropy, a z-loss term and logit-based knowledge distillation from a frozen full-width teacher (Gemma 3 270M for text).

For the multimodal model, the authors pair the elastic text decoder with a static SigLIP-based vision encoder and projection taken from Gemma 3 4B, and force the projection's output width to follow the active text width. Training proceeds in stages — projection alignment on captioning data, then joint projection-plus-text training, then optionally all parameters — with Gemma 3 4B as the frozen teacher. Evaluation uses ARC-Easy, TriviaQA (five-shot exact match), HellaSwag (reported in the appendix), Shakespeare perplexity, CLIPScore on the full COCO validation set with clip-vit-large-patch14, MMMU, and throughput measured with llama-bench on an NVIDIA RTX PRO 4000 with 2048-token prompts and 512 generated tokens.

Why This Matters

Impact on research. The work shows that HydraViT-style head-stacking transfers from vision transformers to decoder-only LLMs, and that elasticity can be extended beyond the text backbone to a multimodal interface. It also provides a direct, controlled comparison against FFN-only elasticity on the same checkpoint, which clarifies where the extra parameter range helps (TriviaQA, small-model regimes) and where it does not (ARC-Easy, prompt processing). The negative results — near-random MMMU accuracy and persistent hallucination — are reported explicitly.

Real-world applications:

  • Deploying one shipped checkpoint across a fleet of devices with different memory and latency budgets, rather than maintaining separate models per tier.
  • Edge and on-device assistants where embedding and projection sizes dominate memory and faster token generation is the main user-visible latency.
  • Vision-language captioning or document understanding on resource-constrained hardware, where a smaller active width can be selected dynamically.
  • Serving systems that adjust model width per request or under changing load, using a single set of weights.

Industry relevance. The throughput measurements use llama.cpp with quantized-style CPU/GPU inference tooling, and the pipeline starts from an off-the-shelf Gemma checkpoint, which makes the approach directly applicable to practical deployment stacks. The reported gains are asymmetric — large for token generation (75.3%) but modest for prompt processing (9.78% to 11.61%) — which matters for how practitioners allocate compute.

Future Directions

  • Replacing the constrained small single-layer projector with a larger or multi-layer FFN projection, which the authors expect would better align visual features with the elastic text backbone.
  • Longer and more diverse multimodal training schedules to improve grounding beyond captioning tasks.
  • Combining HydraLLM's end-to-end slicing with MatFormer-style per-layer granularity for finer accuracy-compute control.
  • Closing the gap at the narrowest configurations: H1 and H2 sit near 0% TriviaQA accuracy and roughly random MMMU accuracy, so whether the smallest subnetworks can be made genuinely useful remains open.

Target Audience

Researchers and engineers working on efficient inference, model compression, nested/elastic architectures, or on-device and edge deployment of LLMs and vision-language models. It is also useful for practitioners choosing between end-to-end width slicing and FFN-only elasticity, and for readers interested in a candid account of where an elastic multimodal projection still fails.

Authors’ abstract

LLMs and LVLMs are increasingly deployed across heterogeneous hardware, ranging from data-center GPUs to resource-constrained edge devices. Their fixed-size architectures limit the ability to reuse a single model across deployment settings with different compute, latency, and model-size targets. We introduce HydraLLM, an elastic MQA-based architecture. Its number of active attention heads determines the effective widths of the embeddings, attention projections, feed-forward layers, and the output head, forming a nested family of subnetworks within a single parameter set. We introduce a static-to-elastic conversion pipeline that, starting from a pre-trained model checkpoint, includes importance-driven weight reordering and stochastic subnetwork training with knowledge distillation. We extend this principle to multimodal inference through an elastic projection module whose output width follows the active text width. HydraLLM covers a wider range of active parameter configurations than FFN-only elastic architectures. With 75% of heads active, HydraLLM achieves 2.2 percentage points higher TriviaQA accuracy than a state-of-the-art nested baseline configuration which has 17.25% more parameters. With 50% of heads active, our multimodal model achieves a CLIPScore comparable to that of the 7$\times$ larger Gemma 3 4B model. With only 25% of heads active, HydraLLM increases token-generation throughput by 75.3% over the full-width configuration.

Read the original paper