Test‑time scaling can improve large language models by allocating extra computation, yet adapting the internal computation topology to each input remains underexplored. Existing works usually fix recurrent or parallel architectures during training, or reconfigure frozen models along a single structural axis. SelfMorph makes the computational shape an input‑dependent inference‑time decision. It unifies three primitive morphologies in a single parameter space: the original forward path (BASE), serial reuse of a layer span (REPEAT), and local branching plus merging of perturbed hidden states (BRANCH), each described by type, location and intensity. Because these morphologies provide complementary benefits, we employ a lightweight selector that reads the backbone’s depth‑wise hidden‑state trajectory on the prompt to pick a morphology before generating a response. The selector is trained by distilling a utility‑based distribution from offline morphing, jointly considering task performance and computational cost. Evaluations on three LLMs ranging from 4B to 27B parameters show that SelfMorph achieves an 8.06% mean relative gain on five in‑distribution benchmarks and 4.45% on four unseen benchmarks, attaining the strongest result in 24 of 27 settings. These findings identify input‑adaptive computational topology as a complementary axis of test‑time scaling beyond generating more tokens. The code is released at https://github.com/creator-xi/SelfMorph
Review