LatentSkill: From In-Context Textual Skills to In-Weight Latent Skills for LLM Agents
LatentSkill is a framework that converts textual skills into plug-and-play LoRA adapters via a pretrained hypernetwork, enabling LLM agents to store reusable task procedures in weight space rather than context space, which significantly reduces token overhead while improving performance and enabling modular skill composition.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Large language models have become remarkably capable at reasoning through complex problems, often acting as digital agents that can plan, search, and interact with software to complete tasks. To handle specialized jobs, these agents frequently rely on "skills"—essentially written instructions or procedures that tell the model how to solve a specific type of problem, such as organizing a virtual room or answering a multi-step question. Traditionally, these skills are fed directly into the model's input every time it needs to use them, much like reading a manual page by page before taking an action. While this works, it creates a significant bottleneck: the more complex the task and the larger the library of skills, the more text the model must process, which slows it down and consumes vast amounts of computing power. Furthermore, keeping these instructions as plain text in the input leaves them exposed and vulnerable to being misread or hijacked by other parts of the system.
Researchers at Shanghai Jiao Tong University and OPPO Research Institute have proposed a different approach called LatentSkill, which moves these instructions out of the text input and into the model's internal memory structure. Instead of reading a skill description every time, the system uses a specialized generator to convert the text of a skill into a compact set of internal adjustments, known as adapters, that are permanently attached to the model's brain. This allows the agent to "know" the skill without having to read the instructions again. The team found that this method not only speeds up the process and reduces the amount of data the model needs to handle, but also creates a hidden, organized space where different skills can be mixed and matched with mathematical precision.
The core idea behind this work is to treat a skill not as a document to be read, but as a set of weights to be loaded. In their framework, a "skill compiler" takes a written description of a task and instantly generates a unique set of internal modifications for the language model. These modifications are small, efficient, and modular, meaning they can be attached or detached from the main model without retraining the entire system. Once a skill is converted into this internal format, the original text is discarded from the input stream. The model then operates using these hidden adjustments, which guide its behavior just as effectively as the text would have, but without the heavy cost of processing thousands of extra words for every single step of a task.
To test this, the researchers applied their system to two distinct challenges: a text-based simulation of a robot navigating a house to complete chores, and a series of complex question-answering tasks that require searching through multiple sources of information. In the house navigation task, the system had to figure out how to pick up objects, clean them, and place them in specific locations. In the question-answering task, it had to find answers that required connecting several pieces of information. When compared to the standard method of pasting skill instructions into the prompt, the new approach proved significantly more efficient. On the house navigation tasks, the system improved its success rate by over twenty percentage points on familiar tasks and by more than thirteen points on new, unseen tasks, all while using nearly two-thirds fewer input tokens. On the question-answering benchmarks, it achieved a higher accuracy rate while reducing the number of tokens processed per step by more than seventy percent.
Beyond just saving time and resources, the researchers discovered that these internal skill adjustments possess a surprising amount of structure. When they mapped out the mathematical space where these skills live, they found that skills belonging to the same category, such as cleaning tasks or search tasks, naturally grouped together, forming distinct clusters. This suggests that the system is not just memorizing text, but is learning the underlying logic of the procedures. This structure allows for a high degree of control; the researchers found that they could adjust the strength of a skill simply by turning a dial, represented by a scaling number. If the number was too low, the skill had no effect; if it was too high, the model became confused. However, at the right setting, the model performed optimally, and this sweet spot remained consistent across different types of tasks.
Perhaps the most intriguing finding was that these internal skills could be combined. Just as one might mix ingredients to create a new dish, the researchers showed that they could take the internal adjustments for two different skills and add them together to create a new, composite skill. However, this only worked reliably when the skills were broken down into their smallest, most aligned components before being mixed. If they simply added the whole skill blocks together, the result was often less effective. By carefully aligning the parts, they were able to create a skill that performed a complex sequence of actions without losing the ability to perform the individual steps. This suggests that the system can build complex behaviors by assembling modular pieces of knowledge in a way that is both flexible and precise.
The study also highlighted a significant security advantage. Because the skills are stored as internal adjustments rather than visible text, they are much harder to tamper with. When the researchers tested the system against attempts to hijack the instructions or extract the hidden knowledge, the new method held up remarkably well. While the traditional text-based approach often collapsed or revealed its secrets when attacked, the internal skill version maintained its performance and kept its instructions hidden. This indicates that moving skills from the visible prompt into the model's internal weights offers a more robust and secure way to equip artificial agents with specialized knowledge.
The researchers conclude that this approach offers a practical path forward for building more capable and efficient AI agents. By shifting the storage of procedural knowledge from the input stream to the model's internal parameters, they have demonstrated a way to make agents faster, more secure, and better at combining different abilities. The results suggest that the future of AI agents may not lie in feeding them more text, but in teaching them to carry their skills internally, ready to be deployed with a simple, invisible switch.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.