Manuscript Offprint

arXiv:2610.23455

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

Oscar Kemme, Janek Haberer, Ali Hojjat, Olaf Landsiedel

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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 1^{1}, 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× larger Gemma 3 4B model. With only 25% of heads active, HydraLLM increases token-generation throughput by 75.3% over the full-width configuration.

1 Introduction

Large Language Models (LLMs) and Large Vision-Language Models (LVLMs) underpin applications such as document understanding (Deitke et al.,

Figure

Figure 1: HydraLLM width slicing. The number of active heads determines the embedding dimension, the attention projection, and the feed-forward network width, producing nested subnetworks from a single parameter set.

2024), conversational assistants (OpenAI, 2024), and agent systems (Google, 2024). Transformer-based architectures (Vaswani et al., 2017) exhibit robust scaling, driving the creation of larger foundation models. At the same time, their deployment spans heterogeneous hardware from data-center GPUs to resource-constrained edge devices with different latency, compute, and model-size requirements. Training separate models for each configuration is computationally prohibitive, as each variant must be trained independently from scratch. Additionally, conventional transformer-based models are inherently static at inference time, which means their parameters are fixed after training, limiting their ability to target heterogeneous systems. Recent elastic and nested methods address this by training multiple models as one, but most focus on a single component such as the feed-forward network (FFN) for size reduction or require a

1^{1}The source code is available at https://github.com/tuhh-ncps/hydrallm.

Figure

Figure 2: Pipeline overview. Starting from a static text checkpoint, such as Gemma 3 270M, the sliced axes can first be reordered to improve prefix quality. The resulting checkpoint is then trained as an elastic text model whose runtime width is controlled by the active number of query heads k. Finally, we combine the elastic text decoder with, for example, Gemma 3 4B vision components to form a multimodal model whose projection output follows the same active width.

multi-step extraction process of fixed model checkpoints (Haberer et al., 2024; Devvrit et al., 2024; Vaswani et al., 2017; Cai et al., 2020). In this paper, we introduce HydraLLM 1^{1}, a unified approach to adaptive slicing in LLMs and LVLMs by merging elastic architectural principles with efficient compression techniques while leveraging an already pre-trained static LLM.

We show that HydraViT-style (Haberer et al., 2024) end-to-end adaptive slicing transfers successfully to decoder-only LLMs, producing a single checkpoint that remains effective across several runtime width budgets. With 75% of heads active, HydraLLM improves Trivia-QA (Joshi et al., 2017) accuracy by 2.2 percentage points over a baseline configuration that has 17.25% more parameters. With 50% of heads active, the multimodal model reaches a CLIPScore of 66.9, surpassing the 65.3 score of the 7× larger Gemma 3 4B (Gemma Team et al., 2025) model. With only 25% of heads active, importance-based reordering improves post-training perplexity by 16.2%. This 25% configuration increases token-generation throughput by 75.29% compared to the full model. In summary, we contribute:

• End-to-end slicing for decoder-only LLMs. HydraLLM exposes a single head-count control that selects consistent prefixes of the embedding, attention, FFN, and output dimensions, producing nested decoder subnetworks from one checkpoint.

• Unified training pipeline for elastic sub-networks. We introduce a single training recipe to convert a static pre-trained LLM to an adaptively sliceable LLM while remaining competitive on text-only benchmarks.

• Elastic multimodal projection for LVLMs. We extend adaptive slicing to LVLMs by employing an elastic projection module that maps visual features into text embedding spaces of varying dimensionality.

References (42)