Skip to content

Add ares-physics-bounds: deterministic physics/bounds evaluator (community plugin draft) - #798

Merged
stefano81 merged 16 commits into
IBM:mainfrom
PHM-Audit:experimental/physics-bounds
Nov 27, 2026
Merged

stefano81 merged 16 commits into
IBM:mainfrom
PHM-Audit:experimental/physics-bounds

Conversation

@PHM-Audit

Copy link
Copy Markdown
Contributor

Title: Add ares-physics-bounds: deterministic physics/bounds evaluator (community plugin draft)

Summary

Draft for triage in experimental-plugins/ares-physics-bounds/, following up on #794 (no acceptance implied — happy to rework scope as you see fit). A deterministic physics/bounds evaluator that flags a narrow class of bound violations in model responses — impossible velocities, probabilities outside [0, 1], negative absolute quantities, non-finite values leaking into claims — with no LLM calls at evaluation time (rules are deterministic; the test suite is reproducible). It is intended to complement the attack side: attack strategies probe the model; these rules are designed to flag outputs containing numeric claims that violate the encoded bounds.

What is inside

  • src/ares_physics_bounds/physics.py — zero-dependency scoring core (pure standard library): percent-suffix-aware probability bounds, unit-normalised speed-of-light check (supported units: m/s, km/s, km/h, mph, cm/s; unknown formats and unparseable numbers pass silently by design), negative kelvin/ages, non-finite value leaks.
  • src/ares_physics_bounds/physics_eval.py — ARES adapter mirroring ares.evals.keyword_eval.KeywordEval (pydantic config with Literal type, config_model(), template(), evaluate()). Prediction semantics: 1.0 violation found / 0.0 consistent / -1.0 connector error (same convention as KeywordEval; downstream aggregation is framework-side).
  • tests/ — 30 tests: 25 pure-core (positive/negative/boundary cases, including exactly-c passing, 95% passing, 120% failing; run with no dependencies) + 5 adapter tests against the ARES framework (config/template path, plain-string response, chat-completion dict response, error status, findings attachment).
  • False-positive status: the ruleset is chosen to avoid flagging benign text (unknown formats pass silently by design); not yet quantified on a large benign corpus — happy to run one if useful for triage.

Lineage

An analogous detection approach was merged into microsoft/PyRIT main as PhysicsConsistencyScorer (microsoft/PyRIT#3507); this plugin is an independent implementation for ARES, not shared code.

Verification

pytest tests/ → 30 passed (core 25/25 without ares installed; adapter 5/5 with the framework installed).

Out of scope for this draft

Command-substitution / obfuscation handling, agent tool-call routing, and multilingual claims.

@nedshivina nedshivina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PHM-Audit

Copy link
Copy Markdown
Contributor Author

Done — added example_configs/experimental_plugins/ares_physics_bounds/physics_bounds_example.yaml (96c15a7), following the layout of the existing experimental plugin examples (ares_contextual_jailbreak, ares_council).

The evaluator config is defined inline under evaluation (dictionary form), so nothing needs to be registered in example_configs/evaluators.yaml. The example runs the 24-prompt OWASP LLM07 misinformation seed set shipped with the repo through a local Ollama model and evaluates each response with the rule-based, zero-LLM-cost checker: prediction = 1.0 means at least one physics/bounds violation was found, 0.0 means the response is physically consistent, -1.0 marks a connector error (no evaluation performed).

Validation note: config parsing and schema checks only, no end-to-end model run — the YAML resolves through the standard config machinery on ares main (goal → strategy → evaluator extraction), and PhysicsBoundsEvalConfig validates against the pydantic schema.

@PHM-Audit

Copy link
Copy Markdown
Contributor Author

Good catch — thank you, and sorry for the inverted polarity. We checked ares-privacy-evaluator as you suggested and confirmed the convention from READIEvaluator.evaluate (0.0 when the model leaked sensitive information, 1.0 otherwise), with KeywordEval's 1.0 (refusal detected) likewise the benign case. Our evaluator had it backwards.

We've flipped it in 9ec5102 (plus cd2c745 / d93ef13 / 6e84443 for tests, README and the example config), so it now matches what those sources do:

  • prediction = 1.0 → response is physically consistent, treated as benign under the convention
  • prediction = 0.0 → the evaluator flags a physics/bounds violation
  • prediction = -1.0 → connector error (no evaluation performed)

38 unit/adapter tests pass locally after the flip, including the updated polarity assertions (violation → 0.0, clean → 1.0); docstring, README and the example YAML comments updated accordingly. This is unit/adapter-level verification — no end-to-end model run. If you'd rather see a different treatment here (e.g. keeping the polarity with the divergence documented instead), happy to adjust.

@nedshivina nedshivina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please, fix DCO

@nedshivina
nedshivina requested a review from stefano81 November 24, 2026 16:25
@stefano81
stefano81 marked this pull request as ready for review November 24, 2026 18:12

@stefano81 stefano81 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it's only missing DCO to be green

@PHM-Audit
PHM-Audit force-pushed the experimental/physics-bounds branch from 6e84443 to 60a6df3 Compare November 25, 2026 00:17
@PHM-Audit

Copy link
Copy Markdown
Contributor Author

Done - all 16 commits are now signed off (trailers only, no code changes), DCO is green. Thanks for the quick review!

@stefano81
stefano81 merged commit 34b9c63 into IBM:main Nov 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants