Learn Relifold
← Relifold documentation

Relifold 101: Hard gates and semantic judgment

Build an interpretable hybrid task from exact operations, hard pair gates, and semantic judgment.

Relifold is most useful when deterministic logic settles what it can and a semantic operator decides the genuinely ambiguous remainder. More unresolved relationships cost more; on relational tasks they can also expose more relationships to graph realization and error propagation. A smaller semantic hand is useful only when deterministic exclusions preserve enough of the relationships that matter.

Four different decisions

  1. Normalize exactly. A normal Transform may standardize spelling, units, dates, or identifiers without semantic judgment.
  2. Pre-merge only what is known equal. A normal Cluster may contract exact duplicates before a semantic grouping task.
  3. Exclude impossible relationships. A semantic operator's *_only_if predicate defines which relationships may reach semantic judgment.
  4. Judge the rest semantically. The model sees only eligible uncertainty and applies the task prompt.
A hard gate is an invariant. For SemCluster.merge_only_if(left, right), false means Relifold will never merge that pair. It does not mean the pair merely starts as independent, and true does not mean it must merge.

Start with structural invariants

Use a hard gate when the data itself makes a positive relationship impossible. In a product taxonomy, an authoritative product-count field may prove that a smaller category cannot be an ancestor of a larger one. In matching, incompatible legal regions or unavailable inventory can be exact exclusions. In event deduplication, an authoritative non-overlapping time constraint may be exact when the task definition requires temporal overlap.

Similarity scores, token overlap, embeddings, and regex heuristics are usually approximations, not structural invariants. They can still be excellent cost and quality controls, but their candidate recall must be measured. Treating a convenient threshold as perfect recall silently converts every missed true relationship into an unrecoverable false negative.

Review exclusions and admissions

Review what the gate excludes and what it admits. When recall matters, prefer admitting an uncertain pair over excluding it without evidence. But do not assume that admitting every pair is always higher quality: a much larger semantic relationship graph can amplify wrong judgments and increase repair difficulty. The useful operating point is empirical and topology-aware, with the budget as a cap rather than the quality objective.

The Planner is a beta starting point

The Planner can propose deterministic rules and explain their expected purpose, hand size, and cost. A generated regex, token rule, or threshold is a research direction until representative evidence supports it. Keep the DAG when it is helpful; use the Task Workbench to replace or tune a preliminary gate before declaration.

Next: Relifold 102 shows how to compare lossy rules, external block maps, and their marginal relationship sets.