TL;DR
This paper introduces an AI-agent framework that dynamically generates custom user-plane packet processing code for 6G networks directly from human-readable text descriptions. Rather than relying on superficial code-similarity metrics, the authors evaluate the LLM-generated code by executing it in a real network environment with actual data packets, revealing how prompt design, baseline templates, and model capacity impact functional correctness.
What Problem Does This Paper Address?
Next-generation mobile networks (6G) aim to be highly autonomous and tailored to vertical applications like extended reality (XR) and advanced media services. These applications often require highly specific protocol handling and user-plane traffic processing. Traditionally, network functions are static or pre-configured, making on-demand customization difficult.
While Large Language Models (LLMs) excel at code generation, standard evaluation methods rely on semantic similarity metrics (like BLEU or CodeBLEU) against a ground-truth reference. In networking, a single misplaced byte or out-of-order serialization step can completely break a protocol, even if the code looks 99% similar to the reference. This paper addresses the challenge of deploying and functionally validating LLM-generated code for on-demand network packet processing.
Methods
The authors propose an AI-agent-enabled framework consisting of three main components:
- Code Generation Agent (CGA): Receives a human-readable service request and generates executable Python code.
- Code Repository (CR): A centralized knowledge base storing common network code snippets and skeletons.
- Target User Plane (UP) Node: The location where the generated Customized Processing Block (CPB) is deployed to handle traffic.
Instead of checking text similarity, the authors evaluate the system by deploying the generated code onto a physical host, driving real TCP traffic through it, and analyzing the system logs. They test the functional correctness across four distinct scenarios to isolate the impact of the LLM version (Gemini-2.5-flash vs. Gemini-2.0-flash), the presence of a baseline code skeleton, and the inclusion of in-context examples in the prompt.
Datasets
The study does not use standard open-source code datasets. Instead, the authors designed three custom protocol descriptions of increasing complexity to benchmark the system:
- Simple Transmission Protocol (STP): Requires basic first-come, first-served (FCFS) queue management and packet filtering based on a fixed priority threshold.
- Congestion-Control Protocol (CC): Introduces a stateful element where the agent must parse network control packets and only enforce priority thresholds if the network is flagged as congested.
- Publish-Subscribe Protocol (Pub-Sub): A complex message broker protocol requiring the tracking of subscription states and handling three distinct packet types (SUBSCRIBE, UNSUBSCRIBE, PUBLISH) along with acknowledgments (ACKs).
Key Insights and Ideas
- Functional validation is mandatory for networking: Code that looks structurally correct can fail catastrophically due to subtle logic errors. For instance, serializing packet fields in the wrong order (e.g., putting payload length before the topic string) constitutes a fatal protocol error despite high text similarity to a correct script.
- The "Two Pillars" of Prompting:
- Baseline code provides structural support, keeping the LLM from generating incomplete implementations or "garbage" boilerplate code.
- In-context examples provide procedural support, guiding the model through complex state transitions and call sequences.
- Task complexity scales with model capacity: Simpler protocols (like STP) are robust and can be solved even when prompt support is stripped away. However, complex protocols (like Pub-Sub) exhibit a sharp performance drop if either the baseline code or examples are missing, or if a slightly older model generation is used.
Key Results
Each scenario was tested 20 times per protocol. A run was only marked as a PASS if it successfully executed, bound to the correct TCP endpoints, matched specified packet formats, and perfectly satisfied the protocol logic.
- Scenario 1 (Gemini-2.5-flash + Baseline + Examples): Achieved a perfect 100% success rate (20/20 passes) across all three protocols.
- Impact of removing Baseline Code (Scenario 2): Performance dropped as complexity rose, introducing missing statements and incorrect method calls.
- Impact of removing Examples (Scenario 3): Caused logic errors, such as missing conditional checks in the Congestion-Control protocol.
- Impact of a weaker model (Scenario 4 - Gemini-2.0-flash): Resulted in widespread failures for complex tasks, dropping to a staggering 1/20 pass rate for the Pub-Sub protocol due to incomplete code blocks and missing statements.
Limitations and Future Work
The current study is limited to a closed-source model family (Gemini) and evaluates only three custom protocols.
To build on these findings, the authors plan to expand their evaluation to open-source models explicitly fine-tuned for code generation, such as Code Llama and Qwen3-Coder. Furthermore, they intend to create a dedicated, telecom-specific training dataset to explore how fine-tuning can improve LLM reliability for complex, multi-step network automation tasks.
Summary updated