glrmask.auto

Adaptive O1/O2/O3 constraint selection.

AutoConstraint selects one of GLRMask's existing exact implementations; it does not introduce a separate masking algorithm. The initial JSON-Schema policy is intentionally small and inspectable and targets a bounded worst-TBM tail while avoiding O3's compile cost on schemas that do not need it.

AUTO_POLICY_NAME = 'tail200-v1'
class AutoConstraint:

A JSON-Schema constraint compiled through the adaptive O1/O2/O3 policy.

AutoConstraint(inner: Any, selected_tier: str)
selected_tier
policy
@classmethod
def from_json_schema( cls, schema: str | dict[str, typing.Any], vocab: Any) -> AutoConstraint:
@classmethod
def load(cls, data: bytes, vocab: Any) -> AutoConstraint:
def save(self) -> bytes:
def start(self) -> Any:
def mask_len(self) -> int:
@dataclass(frozen=True)
class AutoSchemaShape:
AutoSchemaShape( nodes: int = 0, dicts: int = 0, lists: int = 0, leaves: int = 0, properties: int = 0, property_name_chars: int = 0, string_types: int = 0, number_types: int = 0, array_types: int = 0, pattern_chars: int = 0, max_length: int = 0, json_bytes: int = 0)
nodes: int = 0
dicts: int = 0
lists: int = 0
leaves: int = 0
properties: int = 0
property_name_chars: int = 0
string_types: int = 0
number_types: int = 0
array_types: int = 0
pattern_chars: int = 0
max_length: int = 0
json_bytes: int = 0
def json_schema_auto_shape(schema: Any) -> AutoSchemaShape:

Return the cheap source-shape features used by the v1 auto policy.

def select_json_schema_auto_tier(schema: Any) -> str:

Return "o1", "o2" or "o3" for one JSON Schema.

The thresholds were fitted on chunks 1-3 of the surviving 2026-09-11 seed-7 full-corpus CFA run, with chunk 4 held out. The target was the cheapest tier whose observed per-problem maximum TBM was <= ~200 us, with false-safe predictions penalized 64x so rare tail failures dominate the policy rather than average throughput.