paper-with-me

Papers

Skip a Layer or Loop it? Test-Time Depth Adaptation of Pretrained LLMs

2025-07-10 · Ziyue Li, Yang Li, Tianyi Zhou

Can a pretrained neural network adapt its architecture to different inputs without any finetuning? Do we need all layers for simple tasks, and are they adequate for challenging tasks? We found that the layers of a pretrained large language model (LLM) can be manipulated as separate modules to build a better and even shallower model customized for each test sample. In particular, each layer from the pretrained model can be skipped/pruned or repeated multiple times as recurrent neural networks (RNN), and stacked with others in arbitrary orders, yielding a chain-of-layers (CoLa) per sample. This compositional space greatly expands the scope of existing works on looped/recurrent pretrained modules, layer pruning, or early-exit networks. We develop a Monte Carlo Tree Search (MCTS) protocol to explore and identify the optimal CoLa for each sample from math and commonsense reasoning benchmarks. Compared to a static model of a fixed depth, CoLa allows shortcut paths (fast thinking), recurrence of the same layer(s) (slow thinking), and combining both, offering more flexible, dynamic architectures for different inputs. We conduct an extensive analysis of the MCTS-optimized CoLa, which leads to two key findings: (1) For >75% of samples with correct predictions by the original LLM, we can find shorter CoLa, suggesting a large space for improving inference efficiency; (2) For >60% of samples with originally incorrect predictions, we can identify CoLa achieving correct predictions, suggesting a large space of performance enhancement. Our results highlight the shortcomings of using a fixed architecture of pre-trained LLMs for inference on different samples and pave the way to unlock the generalization power of test-time depth adaptation.

📄 PDF Abstract BibTeX arXiv:2507.07996

Code (0)

등록된 구현이 없습니다.

Tasks

CoLALarge Language ModelMath

Similar Papers 제목 키워드 기반

Skip a Layer or Loop It? Learning Program-of-Layers in LLMs

2026-06-04 · Ziyue Li, Yang Li, Tianyi Zhou arxiv

Large language models (LLMs) perform inference by following a fixed depth and order, non-recurrent execution of all layers. We reveal the wide existence of training-free, flexible, dynamic program-of-layers (PoLar), wher…

Mathematical Reasoning

Adaptive Layer-skipping in Pre-trained LLMs

2025-03-31 · Xuan Luo, Weizhi Wang, Xifeng Yan

Various layer-skipping methods have been proposed to accelerate token generation in large language models (LLMs). However, they have overlooked a fundamental question: How do computational demands vary across the generat…

Text Generation

Adaptive Depth Networks with Skippable Sub-Paths

2023-12-27 · Woochul Kang, Hyungseop Lee

Predictable adaptation of network depths can be an effective way to control inference latency and meet the resource condition of various devices. However, previous adaptive depth networks do not provide general principle…

Rethinking Skip Connections in Encoder-decoder Networks for Monocular Depth Estimation

2022-08-29 · Zhitong Lai, Haichao Sun, Rui Tian, Nannan Ding 외

Skip connections are fundamental units in encoder-decoder networks, which are able to improve the feature propagtion of the neural networks. However, most methods with skip connections just connected features with the sa…

DecoderDepth EstimationMonocular Depth Estimation

Sparse neural networks with skip-connections for identification of aluminum electrolysis cell

2023-01-02 · Erlend Torje Berg Lundby, Haakon Robinsson, Adil Rasheed, Ivar Johan Halvorsen 외

Neural networks are rapidly gaining interest in nonlinear system identification due to the model's ability to capture complex input-output relations directly from data. However, despite the flexibility of the approach, t…