Skip to main content

Graph Attention Engine (GAE)

Graph Attention Engine is a standalone, NumPy-only scoring engine that implements Cross-Graph Attention for domain-independent decision systems. It is pure Python and requires no database, network access, or event loop. GAE is licensed under Apache 2.0.

Install

Install the published package:

pip install graph-attention-engine

For editable development installs:

pip install -e ".[dev]"

Quick Start

Scaled dot-product attention

import numpy as np
from gae import scaled_dot_product_attention

rng = np.random.default_rng(7)
Q = rng.normal(size=(4, 8))
K = rng.normal(size=(6, 8))
V = rng.normal(size=(6, 16))

out, weights = scaled_dot_product_attention(Q, K, V)

assert out.shape == (4, 16)
assert weights.shape == (4, 6)

Profile scoring

ProfileScorer compares a factor vector with category-specific action centroids. The convenience factory accepts named categories and actions:

import numpy as np
from gae import ProfileScorer, build_profile_scorer

categories = ["routine", "critical"]
actions = ["accept", "review", "escalate"]

# Shape: (2 categories, 3 actions, 4 factors)
mu = np.array(
    [
        [
            [0.2, 0.2, 0.1, 0.2],
            [0.5, 0.4, 0.5, 0.4],
            [0.8, 0.8, 0.9, 0.8],
        ],
        [
            [0.1, 0.2, 0.2, 0.1],
            [0.5, 0.6, 0.5, 0.6],
            [0.9, 0.9, 0.8, 0.9],
        ],
    ],
    dtype=np.float64,
)

centroids = {
    category: {
        action: mu[category_index, action_index].tolist()
        for action_index, action in enumerate(actions)
    }
    for category_index, category in enumerate(categories)
}

scorer: ProfileScorer = build_profile_scorer(
    categories=categories,
    actions=actions,
    centroids=centroids,
    n_factors=4,
)
result = scorer.score(np.array([0.85, 0.90, 0.80, 0.90]), category_index=1)

print(result.action_index)
print(result.confidence)
print(result.probabilities)

The returned ScoringResult contains the recommended action_index, action_name, calibrated confidence, full probabilities, distances, entropy, and confidence gap.

Core API

Core Scoring

API Description
ProfileScorer Scores factor vectors against category and action centroids.
ScoringResult Contains the recommendation, confidence, probabilities, and diagnostics.
KernelType Selects the distance kernel used for scoring.
build_profile_scorer Builds a scorer from named categories, actions, and centroid mappings.

Oracle

API Description
OracleProvider Protocol for producing independent ground-truth outcomes.
GTAlignedOracle Returns outcomes aligned with supplied ground truth.
BernoulliOracle Samples deterministic-seeded Bernoulli outcomes.

Evaluation

API Description
EvaluationScenario Defines one scored evaluation case and expected action.
compute_ece Computes expected calibration error.
run_evaluation Evaluates a scorer across a scenario collection.

Judgment

API Description
compute_judgment Converts a scoring result into an explained judgment.
CONFIDENCE_HIGH Threshold for high-confidence judgments.
CONFIDENCE_MEDIUM Threshold for medium-confidence judgments.

Calibration

API Description
CalibrationProfile Holds scoring and learning calibration parameters.
compute_theta_min Computes the deployment-aware conservation threshold.

Primitives

API Description
scaled_dot_product_attention Computes scaled dot-product attention and its weights.
softmax Computes a numerically stable probability distribution.

Learning

API Description
LearningState Tracks centroids and learning metadata.
WeightUpdate Describes a validated learning update.

Convergence

API Description
get_convergence_metrics Reports centroid movement and convergence diagnostics.

Kernels

API Description
L2Kernel Computes standard squared Euclidean distance.
DiagonalKernel Applies per-factor diagonal weights.
CovarianceEstimator Estimates covariance for adaptive distance calculations.
KernelSelector Recommends a kernel from observed data properties.

Persistence

API Description
save_state Saves learning state to JSON.
load_state Loads learning state from JSON.

The complete public export list is available in gae/__init__.py.

Conservation Law

GAE checks the constraint alpha * q * V >= theta_min, combining category coverage (alpha), observed quality (q), and verified volume (V). Meeting the threshold provides the operational guarantee that evidence is sufficient to maintain accuracy above the configured boundary; use compute_theta_min to derive the deployment-aware threshold.

Testing

pytest tests/ -v

The current suite contains 1,244 passing tests.

Documentation

License

Apache 2.0. See the LICENSE file.

Metadata

Release files for graph-attention-engine 0.7.26

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graph-attention-engine 0.7.26
File Size Uploaded Provenance Actions
graph_attention_engine-0.7.26.tar.gz 245.6 kB With provenance Details for graph_attention_engine-0.7.26.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for graph-attention-engine 0.7.26
File Interpreter ABI Platform Actions
graph_attention_engine-0.7.26-py3-none-any.whl Python 3 none any Details for graph_attention_engine-0.7.26-py3-none-any.whl

Total release size: 377.8 kB

Release files / graph_attention_engine-0.7.26.tar.gz

Download URL graph_attention_engine-0.7.26.tar.gz
Size 245.6 kB
Tags Source
SHA-256 checksum
How to use checksums
18c7f68d511c30a13fc1b7c6e129fd26ffd70a6e2616ff9744b5cb34212b94d9
BLAKE2b-256 checksum
How to use checksums
a2851e25c603483cb69b5614a176e275eac82aa1719d6df43911eaa2dbb4e41f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / graph_attention_engine-0.7.26-py3-none-any.whl

Download URL graph_attention_engine-0.7.26-py3-none-any.whl
Size 132.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60a92da938534e855eb3d93f78e4b658f36dfaf9f019e8a4678e42b1ceff567e
BLAKE2b-256 checksum
How to use checksums
6a7c5d1b4e34273407488720b3537b709b249cb47c856cb90ec8571f7dc0487b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for graph-attention-engine 0.7.26

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for graph_attention_engine-0.7.26.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page