From Heuristics to Formal Modeling: Applying POMDP-Based Agent Skills to Local Small Language Models

    This article examines how the Agent Skills framework, originally designed for large closed-source LLMs, can be formally re-engineered for local small language models (SLMs) using a Partially Observable Markov Decision Process (POMDP) abstraction. It details the mathematical modeling of skills as state-observation-action spaces, introduces the internal structure of a skill through descriptor, policy, and reference mechanism, and discusses practical selection and routing strategies for models ranging from 270M to 80B parameters under constrained hardware and strict data compliance requirements.

    The Industrial Challenge and Why Local Agents Matter

    The Agent Skills framework has become a well-established pattern in the industry. When paired with mainstream intelligent coding tools and large closed-source language model APIs, it demonstrates excellent task decomposition and execution performance. However, for real industrial deployments, this approach faces significant friction—it has largely become a toy reserved for massive proprietary APIs.

    In scenarios such as financial risk control, defense-grade data isolation, or medical privacy protection, continuously calling public APIs is often rejected under the dual pressures of compliance review and tight budgets. When data cannot leave the enterprise and costs must remain predictable, the core challenge is to adapt the Agent Skills framework, originally built for giant models, to run on open-source small language models (SLMs) deployed locally. The goal is to achieve comparable performance improvements within limited computational resources.

    To transform the “intuition” of large black-box models into quantifiable engineering metrics, researchers have not only redefined Agent Skills using rigorous mathematical models but also tested them across a full spectrum of open-source models—from 270M to 80B parameters—on realistic industrial datasets. This article provides a practical analysis of that formalization process, exploring how to select appropriate model sizes and routing strategies to assemble a truly effective local agent system under limited hardware budgets.

    Formalizing Agent Skills as a POMDP

    To precisely evaluate and optimize system behavior, the researchers abstracted the Agent Skill system as a restricted controller that performs information seeking in a partially observable world. In real-world environments, the true state of the agent is never fully known. At each decision step, the agent must balance current task progress against limited attention and context resources, making three core decisions:

    1. Commit to and execute a specific skill: directly invoke a loaded skill’s logic.
    2. Reveal more information about the skill or its references: obtain a better context observation by paying an extra cost (e.g., fetching additional paid context).
    3. Take a direct action in the environment: call an environment or tool function.

    Because the underlying system follows Markov dynamics and the agent cannot directly observe the true “agent–task” state, the system is naturally modeled as a Partially Observable Markov Decision Process (POMDP). An explicit information-acquiring action (for example, paid context fetch) is introduced to trade additional computational cost for higher-quality decision observations.

    State Space and Action Definitions in POMDP

    In this framework, the core components are formalized mathematically:

    • State Space (S): represents possibly hidden task contexts, including the user’s true intent, the current task phase and progress, and environment facts that have not yet been retrieved.
    • Observation Space (O): all content accessible to the agent at time step t, such as the current user message, available interaction history, and any revealed or loaded resources and skills.
    • Action Space (A): includes skill selection, paid context fetching, skill execution, environment/tool calls, and internal planning and reasoning actions.
    • Belief State (bt): the agent’s probability distribution over the true state S, given the observation history and past actions.

    A simplified pseudocode definition of the core POMDP elements is shown below:

    1. class AgentSkillPOMDP:
    2. def __init__(self):
    3. # State space: hidden task contexts
    4. self.S = ["intent_unknown", "phase_initial", "phase_executing", "facts_unretrieved"]
    5. # Observation space: currently visible information
    6. self.O = ["user_message", "history_log", "loaded_skills", "retrieved_context"]
    7. # Action space: operations the agent can perform
    8. self.A = ["select_skill", "fetch_paid_context", "execute_skill", "call_tool", "plan_and_reason"]
    9. def update_belief_state(self, observation, past_actions):
    10. """
    11. Update belief state based on new observations and past actions.
    12. """
    13. # Perform implicit posterior probability computation
    14. pass

    Mathematical Representation and Internal Mechanics of Agent Skills

    Under the POMDP guidance, each specific skill is defined as an abstract triple: Skill = {D, P, R}. This provides clear execution boundaries for local small models.

    1. Textual Descriptor (D): Contains the skill’s name and textual description. This is the key for a small model to understand the skill’s purpose. In local deployment, because small models have limited comprehension capability, the descriptor must be highly structured and unambiguous to minimize selection errors.
    2. Internal Policy (P): The temporally extended policy within a skill—an option-like procedure or workflow that triggers a series of actions. This part is usually implemented by combining deterministic code logic with model reasoning to compensate for SLMs’ limited long-chain reasoning.
    3. Reference Mechanism (R): It can reveal additional skill-related context, tools, or pointers to other skills. This is formalized as a Markov kernel, meaning that skill switching and invocation follow the Markov property: the current skill’s invocation depends only on the state and output of the previous skill.

    Full-Spectrum Model Testing and Engineering Selection for Local Deployment

    Theoretical rigor must be validated on industrial-grade data. The researchers applied this POMDP framework to open-source SLMs ranging from 270M to 80B parameters. Test results show that with careful POMDP modeling and skill routing, mid-size and even small models can approach the performance of much larger models on specific industrial tasks.

    For practical local deployment, enterprises can adopt the following selection and routing strategies:

    • Layered Model Routing: Not every decision requires a large-parameter model. For simple intent recognition and skill selection, a smaller model (e.g., 1B–3B parameters) can be used with textual descriptors for fast matching. For task stages requiring deeper reasoning, the internal policy passes the context to a slightly larger model (e.g., 14B–30B). In practice, this multi-model collaborative routing can be implemented with containerized deployment and an API gateway—for example, on Baidu AI Cloud’s large-model platform—to optimize local compute efficiency.
    • Dynamic Belief State Update: In small-model architectures, the context window is limited, so belief state updates must be strictly managed. Through the POMDP observation mechanism, only historical information strongly correlated with the current state is retained, preventing small models from “losing focus” due to overly long contexts.
    • Engineering the Reference Mechanism: Use open-source vector databases or local retrieval-augmented generation (RAG) to implement the skill reference mechanism. When skill A needs context from skill B during execution, the Markov kernel computes the transition probability and dynamically loads the relevant tool descriptions.

    Conclusion and Outlook

    Adapting the Agent Skills framework to local small language models is not a simple parameter reduction; it represents a paradigm shift from intuition-based design to rigorous mathematical modeling. The POMDP formalization clearly defines the agent’s state, observation, and action spaces, enabling SLMs to perform efficient decision-making and information seeking with limited computational resources.

    For enterprises facing strict data compliance requirements, this approach offers a viable path forward. In future deployments, combining container platforms, local storage, and model hosting services—such as those provided by Baidu AI Cloud—can help technical teams build high-performance, compliant, industrial-grade local agent systems on very modest hardware budgets, truly unlocking the engineering value of small language models in vertical domains.