FastCEGS: Example Generalizing Network Configuration Synthesizer via Graph-Informed Large Language Models
FastCEGS is an enhanced version of CEGS, an advanced network configuration synthesis system that leverages Graph Neural Networks (GNNs) and Large Language Models (LLMs) to automate network configuration synthesis. It can understand high-level user intents, identify and generalize from configuration examples, and generate correct, verifiable network configurations for arbitrary topologies.
FastCEGS extends CEGS with a context-aware generalization pipeline:
- Directed Intent Graph (DIG): represents every device with a semantic
Roleand every directed edge with a routingPolicy, preserving asymmetric forwarding context that a node-only graph cannot express. - Builder: constructs DIGs from high-level intents and large target topologies using connected graph partitioning, complete-neighborhood augmentation, and atomic self-consistency.
- Context Mapper: maps policy-consistent contextual correlations between the example DIG and target DIG, providing precise context for configuration generation.
- EGFormer-enhanced Querier: combines sentence-level intent filtering with an edge-gated graph Transformer to recommend examples under the DIG framework.
- EGNN-enhanced Classifier: performs Role-based candidate matching followed by edge-aware neighborhood disambiguation to associate example and target devices.
- The Builder converts the target intent and topology into a Directed Intent Graph.
- The Querier filters examples by normalized intent and ranks their DIGs with EGFormer.
- The Classifier maps target devices to example devices with Role matching and EGNN neighborhood embeddings.
- The Context Mapper establishes policy-aware contextual correlations.
- The Generator generalizes the selected example into target-device configurations.
- Batfish, the Local Attribute Verifier, and the Global Formal Verifier check and iteratively correct the generated configurations.
- Python 3.10-3.12 (Python 3.11 recommended)
- Docker for the Batfish service
- An API key for a configured LLM provider: DeepSeek, OpenAI, or Gemini
- The model assets listed in Model assets
git clone https://github.com/jianmin-Liu/FastCEGS.git
cd FastCEGS
python -m venv .venvActivate the virtual environment on Windows:
.\.venv\Scripts\Activate.ps1Or on Linux/macOS:
source .venv/bin/activateInstall the Python dependencies:
python -m pip install -r requirements.txtStart Batfish:
docker compose up -d batfishFastCEGS loads model assets from paths configured in setting.json:
| Asset | Default path |
|---|---|
| Sentence Transformer | models/sentence-transformers/all-MiniLM-L6-v2 |
| FastText encoder | models/fasttext/fasttext.bin |
| EGFormer checkpoint | models/gate_fastcegs/egformer.pth |
| EGNN checkpoint | models/gate_fastcegs/egnn.pth |
The Sentence Transformer is the Hugging Face model
sentence-transformers/all-MiniLM-L6-v2. Large model files should be distributed
with Git LFS or downloaded during installation instead of being committed as
ordinary Git objects.
Download the Sentence Transformer directly into the configured location:
python -c "from huggingface_hub import snapshot_download; snapshot_download('sentence-transformers/all-MiniLM-L6-v2', local_dir='models/sentence-transformers/all-MiniLM-L6-v2')"Place a compatible 300-dimensional FastText binary at
models/fasttext/fasttext.bin. The supplied EGFormer and EGNN checkpoints are
small enough to be included in the repository.
The supplied EGFormer and EGNN checkpoints are reference models. When applying FastCEGS to a different network domain, users should retrain both models on their own annotated Directed Intent Graph dataset. The training data should include:
- DIGs with an assigned
Rolefor every node andPolicyfor every directed edge; - positive and negative graph pairs for EGFormer example-recommendation training;
- ground-truth mappings between example and target nodes for EGNN training; and
- explicit training, validation, and test splits.
After training, update EGFORMER_MODEL_PATH and EGNN_MODEL_PATH in
setting.json to point to the new checkpoints. The supplied checkpoints can be
used for evaluation and as initialization references, but results in a new domain
should be validated with domain-specific annotations.
Edit the public setting.json file before running FastCEGS. Replace only the API
key corresponding to the selected LLM_PROVIDER; the other providers may retain
their placeholders. The main settings are:
LLM_PROVIDERand the corresponding API key/model fieldsEGFORMER_MODEL_PATH,EGNN_MODEL_PATH, andSENTENCE_TRANSFORMER_MODELEXAMPLE_LIBRARY_PATHandINTENT_TYPES_PATHINPUT_INTENT_FILEandINPUT_TOPOLOGY_FILE- Builder partitioning and atomic self-consistency parameters
- Batfish host and port
- Output directories
The runtime example library is ExampleLibrary.json. Each example contains a
directed_intent_graph with node Roles and directed-edge Policies.
Place the target intents in input/intent.txt and the target topology in
input/topology.json, then run:
python main_syn.pyGenerated device configurations are written to output/configs/. Intermediate
generation and verification artifacts are written to responses/.
builder.py: scalable DIG construction and atomic self-consistencydig.py: DIG normalization, EGFormer, and EGNNquerier.py: intent filtering and DIG-based example recommendationclassifier.py: Role matching and edge-aware device associationcontext_mapper.py: contextual correlation mappinggenerator.py: parallel configuration generationSyntax_verifier.py: Batfish syntax verificationSemantic_verifier.py: local attributes and global routing-policy verificationtraining.py: EGFormer and EGNN training utilities
fastcegs/
├── main_syn.py
├── builder.py
├── dig.py
├── querier.py
├── classifier.py
├── context_mapper.py
├── generator.py
├── Syntax_verifier.py
├── Semantic_verifier.py
├── setting.json
├── ExampleLibrary.json
├── models/
├── prompts/
├── dataset/
├── input/
├── output/
└── requirements.txt
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
If you use FastCEGS in your research, please cite the paper:
@article{liu2026example,
title={Example Generalizing Network Configuration Synthesizer via Graph-Informed Large Language Models},
author={Liu, Jianmin and Chen, Li and Li, Dan and Miao, Yukai and Ma, Liyu},
journal={IEEE Transactions on Networking},
year={2026},
publisher={IEEE}
}For questions or suggestions, please use GitHub Issues.