A3S Docs
A3S Sentry

SAE And Evaluation

Sparse-autoencoder activation judgment, explainability payloads, tests, soak coverage, and accuracy corpus results.

SAE And Evaluation

Sentry has two security signals:

  • Observer-event tiers judge what the agent did.
  • The SAE tier judges model-output activations emitted by A3S Power.

The second path is useful when harmful intent is hidden in output text. The tier scores sparse model features rather than relying on surface strings.

SAE Signal Path

A3S Power model runtime -> LlmActivations event -> Sentry SaeJudge -> Decision.explain

A3S Power taps a residual stream inside the model runtime, encodes it with a Sparse Autoencoder, and emits sparse (feature_id, activation) pairs. Sentry does not need the prompt or completion text for this tier.

SaeJudge loads a feature dictionary:

{
  "8801": {
    "concept": "exploit-code-synthesis",
    "category": "cyber_offense",
    "weight": 0.9,
    "severity": "high"
  }
}

The dictionary maps feature IDs to named safety concepts, calibrated weights, categories, and optional severities. Features absent from the dictionary contribute nothing.

Scoring

For each activation, Sentry multiplies activation by the feature weight and clamps the contribution. Category scores are accumulated and capped at 1.0. The final harmful score is the worst category, so one severe category is not diluted by benign features elsewhere.

Default thresholds:

ThresholdVerdict
Harmful score below 0.30allow
Harmful score at or above 0.30escalate
Harmful score at or above 0.60block

SDK ACL can override thresholds with:

sae {
  dict        = "features.json"
  escalate_at = 0.3
  block_at    = 0.6
}

Explainability Payload

SAE decisions carry Decision.explain with:

FieldMeaning
harmfulWorst category score.
safety1.0 - harmful.
per_categoryCategory-level scores.
driversRanked feature drivers with concept, category, source, activation, and contribution.
channelactivation.

The result is auditable because the score is linear in named features rather than a second black-box classifier.

Enforcement Boundary

Model-output text has no natural kernel deny target. SAE can block or escalate the output risk, but a kernel action normally rides a related ToolExec, Egress, or other Observer action event.

The current tier depends on a labeled feature dictionary. Training, probing, labeling, and causal validation of the dictionary remain model-specific work.

Test Coverage

The Sentry repository includes:

LayerCoverage
Unit testsRules, escalation, enforcement, parsing, speculative execution, hot reload, metrics endpoint, SAE scoring, and SDK config wiring.
Integration testsReal binary end-to-end behavior, block to deny-file, dry-run, fail-open and fail-closed, malformed input, live hot reload, version output, mock L2 round trip, mock L3 block path, overload degradation, and metrics endpoint.
SDK testsPython and TypeScript bindings judge real Observer-shaped events through the embedded Rust engine.
Soak scriptsSustained mixed load, policy rewrite under load, slow L2 worker-pool behavior, flat memory, clean overload degradation, and clean exit.
Evaluation harnessexamples/eval.rs runs the labeled NDJSON corpus in eval/corpus.ndjson through the pipeline.

Accuracy Corpus

The repository README reports the following measured results on the checked-in 69-event labeled corpus:

ModeRecallPrecisionFalse-positive rate
L1 rules only47.8%100%0%
L1 plus live OpenAI-compatible L295.7%100%0%

These numbers should be treated as corpus results, not universal guarantees. They are still useful because the harness and corpus live in the repository, and earlier evaluation found concrete rule gaps that were fixed.

Running Evaluation Locally

From crates/sentry, the corpus runner can be used in rules-only mode or with an external L2 endpoint:

cargo run --example eval -- eval/corpus.ndjson

A3S_SENTRY_LLM_URL="${PROVIDER_BASE_URL}" \
A3S_SENTRY_LLM_MODEL="provider/model-id" \
A3S_SENTRY_LLM_KEY="${PROVIDER_API_KEY}" \
cargo run --example eval -- eval/corpus.ndjson

Use placeholders in committed docs and inject real credentials only through the local shell or deployment secret manager.

On this page