Initial whetstone_RSA architecture and C++ scaffold

This commit is contained in:
Bill Holcombe
2026-03-31 22:50:40 -06:00
commit 372126cac9
81 changed files with 11972 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "whetstone-rsa/gate-definition-v0",
"title": "GateDefinition",
"type": "object",
"additionalProperties": false,
"required": [
"gate_id",
"task_family",
"labels",
"slots",
"constraints",
"quality_target",
"escalation_policy"
],
"properties": {
"gate_id": {
"type": "string",
"minLength": 1
},
"task_family": {
"type": "string",
"minLength": 1
},
"description": {
"type": "string"
},
"labels": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"minLength": 1
}
},
"slots": {
"type": "array",
"items": {
"$ref": "#/$defs/slot"
}
},
"constraints": {
"type": "array",
"items": {
"$ref": "#/$defs/constraint"
}
},
"quality_target": {
"$ref": "#/$defs/qualityTarget"
},
"escalation_policy": {
"$ref": "#/$defs/escalationPolicy"
},
"metadata": {
"$ref": "#/$defs/metadata"
}
},
"$defs": {
"slot": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"type",
"required"
],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"type": {
"type": "string",
"enum": [
"enum",
"string",
"integer",
"boolean"
]
},
"required": {
"type": "boolean"
},
"labels": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
}
},
"constraint": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"description"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"required_slot",
"label_slot_compatibility",
"custom"
]
},
"description": {
"type": "string",
"minLength": 1
}
}
},
"qualityTarget": {
"type": "object",
"additionalProperties": false,
"required": [
"min_accuracy",
"max_latency_ms"
],
"properties": {
"min_accuracy": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"max_latency_ms": {
"type": "number",
"minimum": 0
},
"max_ece": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
},
"escalationPolicy": {
"type": "object",
"additionalProperties": false,
"required": [
"allow_abstain",
"targets"
],
"properties": {
"allow_abstain": {
"type": "boolean"
},
"targets": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"enum": [
"retry_with_context",
"larger_specialist",
"slm",
"llm",
"human"
]
}
}
}
},
"metadata": {
"type": "object",
"additionalProperties": false,
"properties": {
"output_cardinality": {
"type": "integer",
"minimum": 1
},
"requires_world_knowledge": {
"type": "boolean"
},
"requires_stateful_context": {
"type": "boolean"
},
"deterministic_fallback_available": {
"type": "boolean"
}
}
}
}
}

View File

@@ -0,0 +1,119 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "whetstone-rsa/gate-diagnosis-v0",
"title": "GateDiagnosis",
"type": "object",
"additionalProperties": false,
"required": [
"gate_id",
"primary_failure_class",
"recommended_interventions",
"confidence"
],
"properties": {
"gate_id": {
"type": "string",
"minLength": 1
},
"primary_failure_class": {
"$ref": "#/$defs/failureClass"
},
"secondary_failure_classes": {
"type": "array",
"items": {
"$ref": "#/$defs/failureClass"
}
},
"supporting_signals": {
"type": "array",
"items": {
"type": "string"
}
},
"recommended_probes": {
"type": "array",
"items": {
"type": "string"
}
},
"recommended_interventions": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/intervention"
}
},
"recommended_policy": {
"$ref": "#/$defs/policyRecommendation"
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"$defs": {
"failureClass": {
"type": "string",
"enum": [
"unknown",
"capacity_limited_gate",
"factorizable_gate",
"non_stationary_gate",
"missing_context_gate",
"deterministic_disguised_as_ml_gate",
"label_space_mismatch",
"guardrail_limited_gate"
]
},
"intervention": {
"type": "string",
"enum": [
"collect_more_evidence",
"keep_current_gate",
"deploy_with_guardrails",
"raise_confidence_threshold",
"add_retry_with_context",
"add_deterministic_prepass",
"replace_with_deterministic_logic",
"factor_into_subgates",
"switch_to_hierarchical_gate",
"revise_label_schema",
"enrich_input_context",
"evaluate_larger_model_tier"
]
},
"policyRecommendation": {
"type": "object",
"additionalProperties": false,
"properties": {
"deploy_mode": {
"type": "string",
"enum": [
"auto_accept",
"guarded_accept",
"abstain_first",
"research_only"
]
},
"threshold_hint": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"abstain_required": {
"type": "boolean"
},
"retry_strategy": {
"type": "string"
},
"escalation_targets": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}

View File

@@ -0,0 +1,112 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "whetstone-rsa/gate-evidence-v0",
"title": "GateEvidence",
"type": "object",
"additionalProperties": false,
"required": [
"gate_id",
"model_tier"
],
"properties": {
"gate_id": {
"type": "string",
"minLength": 1
},
"model_tier": {
"type": "string",
"minLength": 1
},
"raw_accuracy": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"accept_rate": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"accuracy_on_accepted": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"abstain_rate": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"retry_recovery_rate": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"escalation_rate": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"silent_error_rate": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"calibration": {
"type": "object",
"additionalProperties": false,
"properties": {
"ece": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
},
"confusion_summary": {
"type": "array",
"items": {
"$ref": "#/$defs/confusionItem"
}
},
"latency_ms": {
"type": "number",
"minimum": 0
},
"compute_cost": {
"type": "number",
"minimum": 0
},
"notes": {
"type": "array",
"items": {
"type": "string"
}
}
},
"$defs": {
"confusionItem": {
"type": "object",
"additionalProperties": false,
"required": [
"actual",
"predicted",
"count"
],
"properties": {
"actual": {
"type": "string",
"minLength": 1
},
"predicted": {
"type": "string",
"minLength": 1
},
"count": {
"type": "integer",
"minimum": 0
}
}
}
}
}