Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Improvements over CEGS

FastCEGS extends CEGS with a context-aware generalization pipeline:

  • Directed Intent Graph (DIG): represents every device with a semantic Role and every directed edge with a routing Policy, 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.

License: CC BY-NC-SA 4.0 Python Paper

Architecture

  1. The Builder converts the target intent and topology into a Directed Intent Graph.
  2. The Querier filters examples by normalized intent and ranks their DIGs with EGFormer.
  3. The Classifier maps target devices to example devices with Role matching and EGNN neighborhood embeddings.
  4. The Context Mapper establishes policy-aware contextual correlations.
  5. The Generator generalizes the selected example into target-device configurations.
  6. Batfish, the Local Attribute Verifier, and the Global Formal Verifier check and iteratively correct the generated configurations.

Requirements

  • 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

Installation

git clone https://github.com/jianmin-Liu/FastCEGS.git
cd FastCEGS
python -m venv .venv

Activate the virtual environment on Windows:

.\.venv\Scripts\Activate.ps1

Or on Linux/macOS:

source .venv/bin/activate

Install the Python dependencies:

python -m pip install -r requirements.txt

Start Batfish:

docker compose up -d batfish

Model assets

FastCEGS 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.

Retraining EGFormer and EGNN

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 Role for every node and Policy for 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.

Configuration

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_PROVIDER and the corresponding API key/model fields
  • EGFORMER_MODEL_PATH, EGNN_MODEL_PATH, and SENTENCE_TRANSFORMER_MODEL
  • EXAMPLE_LIBRARY_PATH and INTENT_TYPES_PATH
  • INPUT_INTENT_FILE and INPUT_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.

Running FastCEGS

Place the target intents in input/intent.txt and the target topology in input/topology.json, then run:

python main_syn.py

Generated device configurations are written to output/configs/. Intermediate generation and verification artifacts are written to responses/.

Main components

  • builder.py: scalable DIG construction and atomic self-consistency
  • dig.py: DIG normalization, EGFormer, and EGNN
  • querier.py: intent filtering and DIG-based example recommendation
  • classifier.py: Role matching and edge-aware device association
  • context_mapper.py: contextual correlation mapping
  • generator.py: parallel configuration generation
  • Syntax_verifier.py: Batfish syntax verification
  • Semantic_verifier.py: local attributes and global routing-policy verification
  • training.py: EGFormer and EGNN training utilities

Project structure

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

License

This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Citation

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.

About

Example Generalizing Network Configuration Synthesizer via Graph-Informed Large Language Models

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages