Abstract
The transition toward Sixth-Generation (6G) networks requires sophisticated full-stack simulation environments to evaluate complex protocols before real-world implementation. However, the industry-standard Network Simulator 3 (ns-3) presents a steep learning curve due to its intricate C++ codebase and specialized modules like 5G-LENA. This paper introduces an experimental framework that integrates a multi-agent Large Language Model (LLM) system with ns-3 to automate the generation, execution, and analysis of network simulations. By employing Retrieval-Augmented Generation (RAG) and iterative feedback loops, the framework reduces the technical barrier for researchers, achieving functional code convergence in an average of 1.8 iterations with a human evaluation score of 7.5/10.
Introduction
As 6G research explores frontiers such as Terahertz (THz) communication, non-terrestrial networks, and AI-driven management, the complexity of network protocols is skyrocketing. While software simulators like ns-3 are indispensable for testing these advancements, they require deep expertise in C++ and a granular understanding of evolving libraries. General-purpose LLMs often struggle with these niche technical domains, frequently producing "hallucinations" or utilizing deprecated APIs. To bridge this gap, we propose a specialized multi-agent system designed to act as an expert "team" for ns-3 simulation management.
The Multi-Agent Framework
The system is built using LangChain and LangGraph, orchestrating four specialized agents that handle distinct phases of the simulation lifecycle:
- Simulation Generation Agent: This agent translates natural language specifications (e.g., "Simulate 100 users on a 28GHz gNB") into precise ns-3 C++ code. It utilizes Chain-of-Thought (CoT) reasoning to plan the script architecture and Retrieval-Augmented Generation (RAG) to access the latest documentation.
- Test Designer Agent: Responsible for static analysis, this agent generates automated test suites to ensure the code adheres to ns-3 standards and accounts for edge cases like high user mobility or signal interference.
- Test Executor Agent: This agent manages the deployment within the ns-3 environment, handling dependencies, executing the simulation, and capturing detailed error logs and performance metrics.
- Result Interpretation Agent: The final agent analyzes simulation outputs (e.g., throughput, latency). If the simulation fails or performance is suboptimal, it provides actionable feedback to the Generation Agent, triggering an iterative refinement process.
Methodology and Knowledge Integration
Rather than relying on static training data, the framework utilizes a dynamic knowledge base. Technical specifications for 5G/6G protocols and ns-3 documentation—specifically the 5G-LENA module—were embedded using OpenAI embeddings and stored in a Pinecone vector database. This RAG-based approach allows the agents to bypass the "knowledge cutoff" of standard LLMs, ensuring they remain current with the latest library updates.
The most critical component of the methodology is the iterative feedback loop. By mimicking the workflow of a human engineer—writing code, observing failures, and debugging based on logs—the system can self-correct syntax errors and API misuses without manual intervention.
Experimental Results
The framework was evaluated using a 5G New Radio (NR) Urban Microcell (UMi) scenario involving 100 User Equipments (UEs) and a gNB operating at 28 GHz. The results demonstrate significant efficiency in automating the simulation pipeline:
- Convergence: The code generation process reached a functional state in an average of 1.8 iterations.
- Reliability: The system maintained a syntax error rate of 17.0%, which is notably low given the complexity of the ns-3 C++ environment.
- Performance: The mean response time for the system was 7.3 seconds, with a Pass@k rate of 0.72.
- Human Evaluation: Qualitative assessments by researchers resulted in a score of 7.5/10, indicating high usability for academic and industrial research.
Discussion and Future Work
While the framework successfully abstracts the complexity of C++ syntax, challenges remain in addressing deep networking logic. LLMs can still struggle with the nuanced physical layer interactions that require expert-level intuition. Furthermore, future iterations will focus on enhancing support for Domain-Specific Languages (DSLs) and implementing continuous learning mechanisms. This would allow the agents to adapt to evolving 3GPP and IEEE standards in real-time, further accelerating the 6G innovation cycle.
Reference: Rezazadeh, F., et al. "Toward Generative 6G Simulation: An Experimental Multi-Agent LLM and ns-3 Integration." arXiv:2503.13402v1, 2025.
Summary updated