arXiv:2610.02288cs.AROct 2026

Manuscript Offprint

arXiv:2610.02288

AdaptViT: Runtime-Adaptive Vision Transformer Deployment on Custom RISC-V

Vishnu PS, Ajay Kumar M, Yike Li, Robert Bogdan Staszewski, Deepu John

Vishnu PS, Ajay Kumar M, Yike Li, Robert Bogdan Staszewski, Deepu John University College Dublin, Ireland

Abstract—Deploying Vision Transformers (ViTs) on low-power edge devices is challenging due to high computational demands. Conventional pruning frameworks require a separate compiled binary for each sparsity level, increasing storage overhead and limiting runtime adaptability. This paper presents an end-to-end deployment pipeline that transforms pretrained ViTs into a single runtime-configurable binary, enabling dynamic compute-budget switching on embedded CPUs. This is achieved by restructuring generated C kernels with modified loop bounds and binary-mask control logic, allowing execution to switch across discrete sparsity levels via compact external configuration files. Compared to multi-binary deployment, the proposed runtime-adaptive approach reduces on-device storage by up to 4.86×, requiring only 163 MB for ViT-Base instead of nearly 800 MB. To maximize pruning efficiency, we introduce a hardware-aligned block pruning strategy for Multi-Layer Perceptron (MLP) layers. In addition, a custom ISA extension is proposed to exploit input-reuse patterns in linear projection kernels. On a Synopsys TRV32P3FX RISC-V processor, the full system achieves up to 2.8× speedup at 65% MLP and 50% attention-head pruning for ViT-Base. The ISA extension alone provides a 1.56× speedup and 33% lower inference energy, with a 24.7% area overhead in a TSMC 28 nm implementation.

Index Terms—ViT, Runtime pruning, Elastic inference, RISC-V, ASIC.

I. INTRODUCTION

Deploying deep learning models on edge devices requires high computational efficiency without significant loss in accuracy [1]. However, embedded processors are constrained by limited memory and compute resources. Vision Transformers (ViTs) achieve strong performance but incur high computational and memory costs due to Multi-Head Self-Attention (MHSA) and large Feed-Forward Networks (FFNs), limiting their suitability for embedded deployment [2]–[4]. Model pruning is therefore widely used to reduce complexity by trading accuracy for efficiency. However, edge environments are dynamic, with changing constraints due to battery levels, workload changes, or user demands. This motivates the need for multiple operating points with runtime adaptability and minimal overhead. A straightforward solution of storing and switching between multiple pruned binaries is impractical on microcontrollers due to high flash usage and the need to reload models when switching configurations.

Existing approaches can be broadly categorized into dynamic and static methods. Dynamic methods adapt computation at runtime. For instance, token pruning in ViTs [5], [6] removes uninformative tokens per input to reduce attention cost, but introduces irregular execution and memory access patterns that are difficult to optimize on embedded hardware. Static structured pruning methods, such as LPViT [7], apply hardware-aware block pruning to improve efficiency but result in fixed sparsity configurations, limiting runtime switching across operating points. Parikh et al. [8] combine weight pruning with input-adaptive token pruning on FPGA accelerators; however, the weight pruning stage requires retraining and yields a fixed sparsity structure, so each operating point still requires a separately trained model. Once-for-All [9] enables multi-width inference within a single network, but relies on specialized training from scratch and cannot directly leverage pretrained models. SnapViT [10] enables multi-level post-training pruning of pretrained ViTs using importance and correlation scores, generating multiple sparsity configurations without retraining. However, evaluation is limited to Python simulation and does not address embedded deployment, where compiler toolchains generate static C execution paths that make runtime-adaptive pruning difficult to realize efficiently. To address this gap, we propose an end-to-end deployment pipeline that enables runtime-adaptive ViT inference on RISC-V processors starting from pretrained models. Our main contributions are:

• Hardware-aware structured static pruning for ViTs: We extend the SnapViT pruning framework [10] with block-structured MLP pruning, replacing neuron-level pruning to improve hardware efficiency.

• Runtime-configurable inference pipeline: We propose an end-to-end framework that enables runtime-adaptive inference of pretrained ViT on RISC-V processors from a single compiled binary, with minimal overhead.

• ISA-level acceleration: We introduce a custom MAC2 instruction to RISC-V ISA to further accelerate ViT inference.