LLM 4 D ist R econfig: A Fine-tuned Large Language Model for Power Distribution Network Reconfiguration (2025)

Abstract: Power distribution networks are evolving due to the integration of distributed energy resources (DERs) and increased customer participation. To maintain optimal operation, minimize losses, and meet varying load demands, frequent network reconfiguration is necessary. Traditionally, the reconfiguration task relies on optimization software and expert operators, but as systems grow more complex, faster and more adaptive solutions are required without expert intervention. Data-driven reconfiguration is gaining traction for its accuracy, speed, and robustness against incomplete network data. Large language models (LLMs), with their ability to capture complex patterns, offer a promising approach for efficient and responsive network reconfiguration in evolving complex power networks.In this work, we introduce LLM4DistReconfig, a deep learning-based approach utilizing a fine-tuned LLM to solve the distribution network reconfiguration problem. By carefully crafting prompts and designing a custom loss function, we train the LLM with inputs representing network parameters such as buses, available lines, open lines, node voltages, and system loss. The model then predicts optimal reconfigurations by outputting updated network configurations that minimize system loss while meeting operational constraints. Our approach significantly reduces inference time compared to classical algorithms, allowing for near real-time optimal reconfiguration after training. Experimental results show that our method generates optimal configurations minimizing system loss for five individual and a combined test dataset. It also produces minimal invalid edges, no cycles, or subgraphs across all datasets, fulfilling domain-specific needs. Additionally, the generated responses contain less than 5% improper outputs on seen networks and satisfactory results on unseen networks, demonstrating its effectiveness and reliability for the reconfiguration task.

## introduction power distribution network reconfiguration is crucial for maintaining operational efficiency, reliability, and adaptability in modern power networks. the integration of distributed energy resources (ders), such as renewable energy sources like solar and wind, introduces variability and uncertainty, necessitating sophisticated control strategies to balance loads, minimize power losses, and maintain voltage stability @xcite . effective network reconfiguration enhances the network's ability to accommodate these renewable sources, optimize energy flow, and ensure resilience against disturbances, supporting the transition toward a more sustainable and flexible power infrastructure. traditional optimization methods for network reconfiguration, while effective, often suffer from computational complexity and scalability issues, especially as power networks grow in size and complexity @xcite . large language models (llms) have emerged as a promising alternative, capable of learning complex patterns and dependencies within large datasets. by leveraging their ability to handle diverse inputs and generate structured outputs, llms can provide rapid, data-driven solutions for network reconfiguration, reducing the need for iterative computations typical of conventional approaches. llms, such as gpt @xcite and @xcite , have revolutionized natural language processing and have shown remarkable success in tasks involving understanding, generation, and reasoning over textual data. their applications have extended beyond text-related tasks to complex decision-making domains, leveraging their capacity to process vast amounts of data and generate coherent, context-aware predictions @xcite . in power systems, the potential of llms is explored in predictive maintenance, optimal power-flow, and decision-making processes that involve large-scale, multi-objective considerations @xcite . however, applying llms to the power distribution network reconfiguration task presents unique challenges. the critical nature of this task means that errors can lead to system instability or inefficiencies. it involves multiple sub-tasks, such as assessing system voltages, managing losses, and adhering to physical laws, all of which require precise decision-making @xcite . fine-tuning llms specifically for reconfiguration tasks is essential to ensure that the models can effectively handle these complexities and contribute meaningful solutions. existing literature on network reconfiguration has focused on various optimization techniques. early work by @xcite introduced a heuristic search method for loss minimization, formulating the problem as finding a minimal-loss spanning tree. @xcite proposed a simplified branch exchange method to reduce losses in distribution feeders. heuristic methods were further advanced by @xcite , who developed algorithms capable of handling larger and more complex systems. evolutionary approaches, such as genetic algorithms applied by @xcite , have also been explored for load balancing and multi-objective optimization. recent studies have begun integrating machine learning techniques with optimization algorithms @xcite . for instance, @xcite presented a deep reinforcement learning framework for multi-objective network reconfiguration under varying network conditions. despite these advancements, the application of llms to reconfiguration task remains unexplored. ## conclusion and discussion in this paper, we introduced llm4distreconfig, an innovative fine-tuned large language model designed to address the power distribution network reconfiguration problem. our evaluations show that the fine-tuned model not only performs well on the networks it was trained on but also generalizes effectively to unseen datasets, including networks significantly larger than those used during training. the model's predicted system losses and node voltages showed almost zero deviation in node voltage predictions, showcasing its practical applicability. additionally, we observed that increasing the number of training epochs positively impacts the reduction of suboptimal configuration and improper responses, reinforcing the importance of extended training in improving model performance. in comparison, baseline models such as llama-2, falcon, and mistral were unable to generate valid outputs for most test samples. this stark contrast underscores the effectiveness of our fine-tuning approach and custom loss functions for domain-specific tasks like power distribution network reconfiguration. these findings show the vast potential of llms in revolutionizing the power systems field by providing interactive, intelligent tools for solving complex optimization problems, as discussed in a.3. in future work, we aim to extensively improve the model output parser to identify all possible patterns through more efficient pattern search algorithms, enhancing the model's ability to interpret and generate a wider variety of valid configurations. incorporating better embedding techniques and employing instruction masking during training may capture more nuanced relationships in the data, further improving performance. exploring better hyperparameters, such as the size of lora adapters could also yield performance gains. a critical next step is the inclusion of unbalanced network models in the dataset. although this will require extensive optimization due to increased complexity and size, it will significantly broaden the model's applicability to real-world scenarios. we demonstrate that fine-tuned llms like llm4distreconfig have great potential in solving complex optimization problems in power systems. by effectively learning from and generalizing to diverse network configurations, the model serves as a valuable tool for power system engineers.