Uppsats

Automating Data Plane Configuration : Leveraging LLMs for P4 Code Generation

Master-uppsats

KTH/Skolan för elektroteknik och datavetenskap (EECS)

Publicerad: 2025

Språk: Engelska

Sammanfattning

The increasing complexity of network infrastructures, driven by Software Defined Networking (SDN), has made data plane programming with languages like P4 a challenging and error-prone task. This thesis investigates the potential of Large Language Models (LLMs) to automate and assist in P4 code generation. Using an experimental methodology, this study evaluates the performance of both openweight (Phi-4, M-32B) and closed-weight (o4-mini) LLMs on a benchmark of P4 programming exercises. The thesis compares multiple approaches, including various prompt engineering strategies and Parameter-Efficient Fine-Tuning (PEFT) on a custom P4 dataset. The results demonstrate that off-the-shelf open-weight models fail to generate any compilable P4 code, highlighting the need for specialization. Fine-tuning proved highly effective, with the fine-tuned M-32B model achieving a 64.3% compilation success rate. The smaller fine-tuned Phi-4 model showed higher relative functional correctness, which suggests a trade-off between model size and understanding of syntax and semantics. For the state-of-the-art model, o4-mini, an iterative feedback strategy that mimics a human developer’s workflow was the most successful prompting technique, increasing compilation success to 57.1%. This study concludes that while LLMs show significant promise as a tool for P4 development, fine-tuning is important for handling niche Domain-Specific Language (DSL). The findings indicate that both specialized models and advanced prompting techniques can significantly enhance developer productivity. However, human oversight remains essential for ensuring code correctness and security.

Information

Författare
Halme, Erik
Lärosäte / institution
KTH/Skolan för elektroteknik och datavetenskap (EECS)
Publiceringsdatum
2025
Uppsatstyp
Master-uppsats
Språk
Engelska

Utforska vidare

Liknande uppsatser

Uppsatser med liknande ämnen och nyckelord.