CAP
Context-aware prompting of LLMs for detecting network device misconfigurations
![]()
Overview
CAP (Context-Aware Prompting) is a framework that enables a large language model (LLM) to reason about network configurations like a human expert. Rather than reading a configuration linearly, CAP identifies the configuration segments that are relevant to the line under review and lets the model request the specific context it needs before making a decision. CAP appeared at ACM SIGMETRICS 2026; an earlier version of this work was circulated as CAIP (Context-Aware Iterative Prompting).
The Problem
Traditional tools for verifying network configurations have two main limitations:
- Manual Effort or Limited Semantics: Model checkers require significant manual effort to specify formal models, while consistency checkers need little manual effort but lack semantic reasoning about intent and complex interactions
- Hard-to-Interpret Output: Both provide limited, often hard-to-interpret explanations to support diagnosis
LLMs are a promising alternative, but simple approaches fall short on large, interconnected configuration files:
- Full-file prompting risks context overload and degraded reasoning
- Partition-based prompting breaks critical dependencies between configuration segments
What CAP Does
CAP reframes configuration analysis as context acquisition, using two integrated components:
- Context Mining: Parses each device’s configuration into a tree and, for any statement under review, extracts three types of context: neighboring configurations (statements that share the same parent), similar configurations (the same parameter elsewhere in the same functional block), and referenced configurations (definitions of identifiers named in the statement, within a device or across devices)
- Guided Interactive Prompting: Conducts a two-turn structured dialogue for each configuration line. The LLM first sees only the statement under review and a menu of available context categories, and responds with the categories it needs and why. CAP then supplies exactly the requested context, and the LLM issues a verdict: whether a misconfiguration exists, which parameter is affected, and a natural-language explanation
Key Features
- On-Demand Context: Provides the context needed for deep reasoning while avoiding overload
- Dependency-Aware: Captures both local interactions and long-range, cross-device dependencies
- Interpretable: Each verdict includes a human-readable explanation, and the model’s context requests provide an audit trail of its reasoning
- Model-Agnostic: Evaluated with five LLM backends
Use Cases
- Network configuration validation
- Configuration change review
- Network security auditing
- Network troubleshooting and debugging
Results
CAP was evaluated on configurations from three networks (Internet2 and two campus networks):
- Known misconfigurations: Detected all 6 known VLAN-assignment misconfigurations in a campus network across all five LLM backends
- Previously unknown issues: Uncovered 19 previously unknown issues in one campus network, all confirmed by network operators
- Baselines: Outperforms existing LLM-based baselines and achieves performance comparable to state-of-the-art non-LLM tools
- Limitations: Missing-line errors are the hardest class to detect, and on a second campus network all 21 flagged configurations were validated as intentional
Resources
Citation
@inproceedings{jiang2026cap,
title={CAP: Detecting Network Device Misconfigurations with Context-Aware Prompting of LLMs},
author={Jiang, Chase and Gember-Jacobson, Aaron and Feamster, Nick},
booktitle={ACM International Conference on Measurement and Modeling of Computer Systems (SIGMETRICS)},
year={2026},
doi={10.1145/3801489.3806917}
}