ShadowPEFT brings detachable shadow models to Hugging Face's PEFT library
The Hong Kong research team put its stateful adapter into PEFT's main branch, trading LoRA-style merging for a parallel network.
By RuntimeWire Staff · Published
Primary source: Hugging Face Newsroom
Why it matters
Native support in PEFT puts ShadowPEFT in developers' existing fine-tuning workflow, giving a research team distribution while exposing the method to broader testing.

Researchers Xianming Li, Zongxi Li and Tsz-fung Andrew Lee have brought ShadowPEFT into the main branch of Hugging Face's PEFT library, giving developers a new way to fine-tune a large model through a smaller trainable model that can later run on its own.
The six-person research group also includes Jing Li, Haoran Xie and Qing Li. Jing Li founded the PolyU Embodied Artificial Intelligence Lab after working as a senior researcher at Tencent AI Lab. Zongxi Li is an assistant professor of artificial intelligence at Lingnan University, where Xie is a professor and associate dean of the School of Data Science. Qing Li heads Hong Kong Polytechnic University's Department of Computing.
Their September 15th announcement turns a research project into a supported method inside one of the standard open-source toolkits for adapting language and diffusion models. Lee submitted the integration pull request, which added support for incremental generation and Hugging Face's existing adapter interfaces.
ShadowPEFT is available from PEFT's development branch and is slated for the library's next release. Developers using the regular package must install PEFT from source to test it. The official ShadowPEFT documentation describes the current API and installation path.
An adapter with memory
LoRA represents an adaptation through low-rank changes attached to selected model weights. Those changes affect the model as data moves through its layers, though the adapter itself does not carry a single task-specific state from one layer to the next.
ShadowPEFT gives that job to a compact shadow network. It creates a hidden state, injects information from that state into each frozen Transformer block, and updates the shadow state using the block's output. The base model and shadow network consequently exchange information throughout the forward pass.
The researchers framed the design in their ShadowPEFT paper, first submitted on April 21st and revised on September 11th. Their central bet is that task adaptation benefits from a coherent model with its own state, rather than a collection of independent weight updates.
That architecture produces an unusual second output. The shadow network receives task supervision and can be extracted with unload_shadow() as a smaller predictor that runs without the large base model. A developer could train against a large backbone, keep the full pair for demanding requests, and use the detached shadow for cheaper local inference.
The group also allows developers to initialize the shadow from a smaller pretrained model. Hugging Face's example pairs a Qwen3-8B base with a Qwen3-0.6B shadow model, using a learned projection when their hidden dimensions differ. This makes the adapter closer to a reusable small model than a patch tied permanently to one set of backbone weights.
Familiar API, different operating costs
The integration matters because the team preserved the workflow developers already use for LoRA. ShadowPEFT works through get_peft_model, while checkpoints use PEFT's standard save_pretrained and from_pretrained paths. That lowers the adoption cost for a method whose internal architecture differs substantially from conventional adapters.
The operational profile changes with it. ShadowPEFT runs a parallel network and wraps whole decoder blocks, adding computation and memory. It cannot be merged into the base weights because its state changes with each input. PEFT's documentation raises an explicit error for merge, merge_adapter and merge_and_unload calls.
Hugging Face's implementation supports incremental decoding through two KV caches, one for the frozen base and one for the shadow backbone. That addresses an earlier limitation in the standalone ShadowPEFT repository, whose documentation still describes generation with caching disabled. The main-branch integration is therefore the more relevant implementation for developers evaluating serving behavior.
The detached model path works for Transformers language models, while Diffusers models cannot currently be reconstructed as standalone denoisers through unload_shadow().
The benchmarks favor ShadowPEFT, with a memory bill
The team's benchmarks are encouraging and remain author-reported. On a MetaMathQA-to-GSM8K experiment using Llama 3.2 3B, ShadowPEFT reached 48.1% exact-match accuracy with 8.66 million trainable parameters. LoRA reached 46.9% with 9.18 million, while DoRA reached 46.2% with 9.29 million.
ShadowPEFT used 28.2 GB of peak memory in that test, compared with 22.3 GB for LoRA and 24.5 GB for DoRA. Training took 17 minutes, between LoRA's 15 minutes and DoRA's 19 minutes. Its 26 MB checkpoint was smaller than LoRA's 36.7 MB checkpoint.
A DreamBooth test on FLUX.2-klein-base-4B also favored ShadowPEFT across the team's selected measurements. It reported a DINO similarity score of 0.717, compared with 0.671 for LoRA and 0.682 for DoRA, while using fewer trainable parameters and producing the smallest checkpoint. Those experiments ran on the same Nvidia A100 80 GB machine with the configurations published by the researchers.
The comparisons show that the shadow design can earn back some of its added complexity through accuracy and checkpoint size. They do not establish a general advantage across architectures, tasks or production serving conditions. Independent replication, broader task coverage and full latency measurements will determine whether the approach travels beyond the team's test cases.
The standalone repository had 37 GitHub stars when checked, underscoring how early the project remains. Inclusion in PEFT changes its distribution prospects. Developers can now evaluate ShadowPEFT without adopting a separate training framework, while the researchers gain a path from an April paper to the interface already used for mainstream adapter work.
For Jing Li's lab and its Lingnan collaborators, the release is a concrete argument that efficient fine-tuning can support a second model rather than a thinner set of weight deltas. ShadowPEFT now has the integration needed to test that argument outside the lab. Its memory use and inability to merge will decide where that extra modeling capacity is worth paying for.