0x0LearnReferenceLibraries0x0.jmp0x1b.com

ML-Guided Heuristics

ML-guided heuristics are an optional optimizer advisor lane. They are disabled by default and cannot change source semantics. Default compilation uses

deterministic hand-written heuristics.

Run the bounded evidence gate with:


make ml-heuristics-research-check

This gate validates source-owned metadata, model identity, fallback behavior,

compile-cost budgets, decision logs, release reports, diagnostics, and negative

fixtures. It does not train models, run broad benchmarks, self-host the

compiler, deploy, or publish remote artifacts.

Enablement

The only accepted opt-in flag is:


--enable-ml-heuristics

Without that explicit flag, the advisor returns the deterministic fallback for

the decision family.

Pilot Decisions

The first supported advisor decisions are:

Each pilot decision has a fallback heuristic in

ml-heuristics/advisor-policy.tsv.

Feature Schemas

Feature schemas live in ml-heuristics/feature-schemas.tsv. Across the

supported schemas, the evidence includes:

The advisor rejects inputs that do not satisfy the schema for the selected

decision.

Model Artifacts

Model artifacts live outside the compiler binary under

ml-heuristics/models/. The registry records:

The compiler binary must not embed these model artifacts. A missing,

incompatible, or hash-mismatched model falls back to the deterministic

heuristic.

Advisor Command

The source-owned advisor command is:


python3 tools/ml_heuristics_advisor.py --input ml-heuristics/fixtures/valid-advisor-input.json

By default this returns a fallback decision. Explicit ML evaluation requires:


python3 tools/ml_heuristics_advisor.py \
  --input ml-heuristics/fixtures/valid-advisor-input.json \
  --enable-ml yes \
  --model-id inline-size-speed-v1

The output includes decision id, source, model id, action, fallback reason,

confidence, compile cost, and semantic effect.

Release Evidence

Release evidence lives in:

Diagnostics

The gate reports stable diagnostics:

Negative fixtures under ml-heuristics/fixtures/ prove the gate fails closed

for unsafe defaults, incomplete schemas, bad model identity, missing fallback,

and excessive compile cost.