An anchor is a decision rule that defines a region in the feature space where the model's prediction is fixed with a user-specified, high-probability guarantee called precision. Unlike methods that assign importance weights to features, an anchor states that if a specific set of conditions holds true, the prediction is virtually invariant to any changes in the remaining features. This provides a clear, logical justification for a single prediction.
Glossary
Anchors

What is Anchors?
Anchors is a model-agnostic explanation method that produces high-precision, human-understandable IF-THEN rules, called anchors, which sufficiently 'anchor' a prediction locally, ensuring that changes to other feature values do not alter the model's decision.
The algorithm uses a multi-armed bandit formulation to efficiently search for the rule with the highest estimated precision and coverage. It iteratively constructs candidate rules by adding feature predicates, evaluating them through perturbation-based sampling. The resulting explanation is a self-contained, sufficient condition, making it particularly valuable for high-stakes decisions where understanding the exact boundary of a prediction's stability is critical for regulatory compliance.
Key Features of Anchors
Anchors provide model-agnostic, rule-based explanations that guarantee a prediction remains unchanged regardless of other feature values, offering a rigorous alternative to LIME for high-stakes audit scenarios.
High-Precision Rule Extraction
Anchors generate if-then rules that achieve a user-specified precision threshold, typically 95% or higher. Unlike LIME's linear approximations, an anchor rule states that if specific conditions hold, the model's prediction is guaranteed to remain stable with high probability. This makes anchors ideal for regulatory compliance where explanations must be deterministic and verifiable.
- Precision guarantee: Configurable threshold ensures rule reliability
- Rule format: Human-readable conditions like 'If age > 30 AND income < $50k THEN predict default'
- Coverage metric: Measures how broadly the rule applies across instances
Model-Agnostic Architecture
Anchors operate as a black-box explanation method, requiring only the model's prediction function and no access to internal weights or gradients. This makes it applicable to any classifier, including tree ensembles, deep neural networks, and proprietary APIs. The method perturbs the input instance by sampling from a perturbation distribution and queries the model to identify feature conditions that consistently anchor the prediction.
- Zero internal access: Works with any model exposing a predict function
- Framework-agnostic: Compatible with scikit-learn, TensorFlow, PyTorch, and cloud APIs
- Multi-class support: Explains predictions across all output classes
Bottom-Up Construction Algorithm
Anchors are built using a KL-LUCB bandit algorithm that efficiently searches for the shortest rule with sufficient precision. Starting from an empty rule, the algorithm iteratively adds candidate feature predicates, evaluating each using multi-armed bandit techniques to minimize model queries. This bottom-up approach ensures the final anchor is minimal in length while maintaining the precision guarantee.
- Bandit optimization: KL-LUCB algorithm minimizes computational cost
- Beam search candidate generation: Explores rule space efficiently
- Statistical stopping criteria: Terminates when precision bound is satisfied
Perturbation-Based Sampling
The method generates synthetic neighborhood samples by perturbing the original instance according to a user-defined perturbation distribution. For tabular data, this may involve sampling from a multivariate Gaussian or using training data marginal distributions. For text, it replaces words with random alternatives or UNK tokens. The perturbation strategy directly impacts anchor quality and must reflect realistic data variations.
- Custom perturbation spaces: Define domain-appropriate sampling strategies
- Discrete and continuous support: Handles mixed feature types natively
- Instance-specific neighborhoods: Perturbations centered on the explained instance
Coverage and Precision Trade-off
Anchors explicitly balance precision (the fraction of perturbed instances satisfying the rule that share the prediction) against coverage (the fraction of all instances in the neighborhood that satisfy the rule). A high-precision anchor with low coverage explains only a narrow slice of instances, while broader coverage may sacrifice precision. This trade-off is user-configurable, allowing auditors to prioritize either strictness or generality.
- Precision: Proportion of correct predictions under the anchor rule
- Coverage: Proportion of the perturbation space covered by the anchor
- Configurable threshold: Set minimum acceptable precision before deployment
Comparison to LIME and SHAP
While LIME provides local linear approximations that may be unfaithful to the underlying model, anchors offer formal precision guarantees that LIME cannot. Unlike SHAP, which assigns continuous importance scores to all features, anchors produce discrete, actionable rules that are easier for non-technical stakeholders to interpret. Anchors complement these methods by providing a different explanatory lens focused on sufficiency conditions rather than feature attribution.
- vs LIME: Anchors provide verifiable guarantees; LIME provides weighted approximations
- vs SHAP: Anchors output rules; SHAP outputs feature importance scores
- Complementary use: Deploy anchors alongside attribution methods for comprehensive explanations
Frequently Asked Questions
Clear, technical answers to the most common questions about Anchors, the high-precision, model-agnostic explanation method for local predictions.
Anchors are a model-agnostic explanation method that produces high-precision, human-interpretable rules, called anchors, which sufficiently 'anchor' a prediction locally. An anchor rule defines a set of feature conditions such that, if these conditions are met, the model's prediction remains essentially unchanged regardless of the values of other features. This provides a sufficient condition for a specific prediction, offering a clear, if-then style explanation. Unlike methods that assign continuous importance scores, Anchors generate discrete, logical rules that are easy for non-technical stakeholders to understand and audit.
Anchors vs. LIME vs. SHAP
A technical comparison of three prominent model-agnostic local explanation techniques, evaluating their underlying mechanisms, output fidelity, and operational trade-offs.
| Feature | Anchors | LIME | SHAP |
|---|---|---|---|
Core Mechanism | High-precision IF-THEN rules via multi-armed bandit exploration | Local surrogate model (sparse linear) via perturbation sampling | Game-theoretic Shapley values via conditional expectation |
Output Type | Decision rules (sufficient conditions) | Feature weight vector | Feature Shapley values (additive) |
Theoretical Guarantee | High-probability precision bound | Efficiency, symmetry, linearity, dummy axioms | |
Global Interpretability | Via mean absolute Shapley values | ||
Handles Feature Interactions | Implicitly via rule conditions | ||
Coverage Metric | |||
Computational Cost | Moderate to High | Low to Moderate | High to Very High |
Model Agnosticism |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Anchors are a high-precision local explanation method. The following concepts form the broader interpretability toolkit, contrasting with or complementing the anchor approach.
LIME (Local Interpretable Model-agnostic Explanations)
The direct predecessor to Anchors. LIME generates explanations by perturbing the input and fitting a sparse linear model to the local decision boundary. While LIME provides a measure of feature importance, it does not guarantee the coverage or precision of its explanations. Anchors improve upon LIME by providing if-then rules with formal precision guarantees, ensuring the explanation holds for a defined neighborhood.
SHAP (SHapley Additive exPlanations)
A game-theoretic approach that assigns each feature an importance value (Shapley value) for a specific prediction. Unlike Anchors, which produces logical rules, SHAP outputs a vector of additive feature contributions. SHAP values satisfy consistency and accuracy axioms but do not explicitly define a decision boundary region where the prediction is invariant.
Counterfactual Explanations
Explanations that identify the minimal change to an input required to flip a model's prediction (e.g., 'If your income were $5k higher, the loan would be approved'). Anchors provide sufficient conditions for a prediction to remain unchanged, while counterfactuals provide the necessary change to alter it. They are complementary: anchors define stability, counterfactuals define recourse.
Partial Dependence Plot (PDP)
A global explanation method that visualizes the marginal effect of a feature on the predicted outcome, averaged over all instances. This contrasts sharply with Anchors, which are strictly local and instance-specific. PDPs reveal overall trends but can obscure heterogeneous effects that anchor rules would capture for individual predictions.
Integrated Gradients
An axiomatic attribution method for deep networks that satisfies sensitivity and implementation invariance. It computes feature importance by accumulating gradients along a path from a baseline to the input. Unlike Anchors, which works on any model by probing the input space, Integrated Gradients requires access to model internals (gradients) and provides a continuous attribution map rather than discrete decision rules.
Explainable Boosting Machine (EBM)
A glass-box model that is inherently interpretable, learning a set of shape functions for each feature that can be visualized directly. Anchors is a post-hoc explanation method applied to black-box models. EBM eliminates the need for post-hoc explanation by design, but Anchors remains essential when the underlying model (e.g., a deep neural network) cannot be replaced with an interpretable alternative.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us