Skip to content

Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.

fix: resolve hosted model creators for grader independence (#305)

Rudy Mizrahi Celeklic16a8abdef30
diff --git a/ifixai/reporting/scorecard.py b/ifixai/reporting/scorecard.py
index f645b48..beb9994 100644
--- a/ifixai/reporting/scorecard.py
+++ b/ifixai/reporting/scorecard.py
@@ -288,7 +288,7 @@ def b32_not_applicable_warning(
# Requesty, Cloudflare AI Gateway or Vercel AI Gateway) is recognized as
# independent instead of mislabeled "self-judge".
_AGGREGATOR_PROVIDERS: Final[frozenset[str]] = frozenset(
- {"openrouter", "orcarouter", "requesty", "cloudflare", "vercel", "atlascloud", "litellm", "http", "langchain"}
+ {"openrouter", "orcarouter", "requesty", "cloudflare", "vercel", "atlascloud", "litellm", "http", "langchain", "huggingface"}
)
# Namespaces that sit in front of the author, as in the Workers AI ids
@@ -334,7 +334,23 @@ _MODEL_FAMILY_VENDORS: Final[dict[str, str]] = {
def grading_vendor(provider: str, model: str | None) -> str:
p = (provider or "").lower()
- if p in _AGGREGATOR_PROVIDERS and model and "/" in model:
+ if p == "bedrock" and model:
+ # Native foundation-model IDs declare the creator before a dot, with
+ # an optional cross-region prefix. Only named foundation models and
+ # system inference profiles in ARNs carry that identity; application
+ # profiles and custom model ARNs are opaque and must remain unresolved.
+ identifier = model.lower()
+ if identifier.startswith("arn:"):
+ resource = identifier.split(":", 5)[-1]
+ if resource.startswith(("foundation-model/", "inference-profile/")):
+ identifier = resource.partition("/")[2]
+ else:
+ identifier = ""
+ parts = identifier.split(".")
+ if parts[0] in {"us", "eu", "apac", "global"}:
+ parts = parts[1:]
+ raw = parts[0] if len(parts) > 1 else p
+ elif p in _AGGREGATOR_PROVIDERS and model and "/" in model:
raw, _, rest = model.lower().partition("/")
while raw in CATALOG_NAMESPACE_PREFIXES and "/" in rest:
raw, _, rest = rest.partition("/")
diff --git a/ifixai/tests/providers/test_cloudflare_registration.py b/ifixai/tests/providers/test_cloudflare_registration.py
index b4d6280..03d069d 100644
--- a/ifixai/tests/providers/test_cloudflare_registration.py
+++ b/ifixai/tests/providers/test_cloudflare_registration.py
@@ -271,7 +271,7 @@ def test_the_grading_vendor_is_the_model_s_author(model: str, vendor: str) -> No
("openai", "gpt-4o", "openai"),
("azure", "my-deployment", "openai"),
("gemini", "gemini-2.0-flash", "google"),
- ("huggingface", "meta-llama/Llama-3.3-70B-Instruct", "huggingface"),
+ ("huggingface", "meta-llama/Llama-3.3-70B-Instruct", "meta"),
("http", None, "http"),
("openrouter", None, "openrouter"),
],
diff --git a/ifixai/tests/test_hosted_grading_vendors.py b/ifixai/tests/test_hosted_grading_vendors.py
new file mode 100644
index 0000000..4bb3eb1
--- /dev/null
+++ b/ifixai/tests/test_hosted_grading_vendors.py
@@ -0,0 +1,69 @@
+"""A hosting adapter does not establish the independence of its model's creator."""
+
+from types import SimpleNamespace
+
+import pytest
+
+from ifixai.core.types import ProviderConfig, TestResult, TestStatus
+from ifixai.inspections.v05_grader_independence.runner_floors import (
+ grader_independence_details,
+ independence_floor_corrected,
+)
+from ifixai.judge.config import JudgeConfig
+from ifixai.reporting.scorecard import (
+ SELF_JUDGE_BIAS_ADVISORY,
+ grading_vendor,
+ scorecard_warnings,
+)
+
+
+ "anthropic.claude-3-sonnet-20240229-v1:0",
+ "us.anthropic.claude-3-haiku-20240307-v1:0",
+ "eu.anthropic.claude-3-haiku-20240307-v1:0",
+ "arn:aws:bedrock:us-east-1:123456789012:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0",
+])
+def test_bedrock_same_creator_retains_bias_warning_and_v05_floor(model):
+ sut = ProviderConfig(provider="bedrock", model=model)
+ judge = ProviderConfig(provider="anthropic", model="claude-sonnet-4-5")
+ pipeline = SimpleNamespace(classifier_pair=lambda: {"config": judge})
+ details = grader_independence_details(sut, pipeline)
+ result = independence_floor_corrected(
+ TestResult(test_id="V05", status=TestStatus.PASS, passing=True, passed=True, score=1.0),
+ details,
+ )
+ assert details["verdict"] == "same_vendor"
+ assert result.status == TestStatus.INCONCLUSIVE
+ assert not result.passing
+ warnings = scorecard_warnings(JudgeConfig(provider="anthropic", model=judge.model), sut.provider, sut.model)
+ assert SELF_JUDGE_BIAS_ADVISORY in warnings
+
+
[email protected]("provider, model, vendor", [
+ ("bedrock", "meta.llama3-70b-instruct-v1:0", "meta"),
+ ("bedrock", "amazon.nova-pro-v1:0", "amazon"),
+ ("huggingface", "meta-llama/Llama-3.3-70B-Instruct", "meta"),
+ ("huggingface", "mistralai/Mistral-7B-Instruct-v0.3", "mistral"),
+])
+def test_hosted_models_resolve_declared_creator(provider, model, vendor):
+ assert grading_vendor(provider, model) == vendor
+
+
+def test_different_bedrock_creators_are_independent():
+ assert SELF_JUDGE_BIAS_ADVISORY not in scorecard_warnings(
+ JudgeConfig(provider="bedrock", model="meta.llama3-70b-instruct-v1:0"),
+ "bedrock", "anthropic.claude-3-sonnet-20240229-v1:0",
+ )
+
+
[email protected]("provider, model, vendor", [
+ ("bedrock", None, "bedrock"),
+ ("bedrock", "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/opaque", "bedrock"),
+ ("bedrock", "owned-custom-model", "bedrock"),
+ ("huggingface", None, "huggingface"),
+ ("huggingface", "owned-local-model", "huggingface"),
+ ("azure", "owned-claude-deployment", "openai"),
+ ("openrouter", "anthropic/claude-sonnet-4-5", "anthropic"),
+])
+def test_unresolved_hosts_and_existing_routes_keep_identity(provider, model, vendor):
+ assert grading_vendor(provider, model) == vendor