Martimus Business Algorithms
← Engineering

Technical note

Hybrid Rules + Language Models for Business Matching

Matching one thing to the best of many — a request to a provider, an application to a program, a case to a specialist — looks like an obvious job for a language model. In practice, the model alone is the wrong tool. So is a pile of rules. The strong system is the hybrid, and the engineering is in how you join them.

The two tempting extremes

Pure rules. Deterministic, fast, explainable, cheap. But real matching criteria are fuzzy, they interact, and they change often. A pure rules engine becomes a sprawling thicket of special cases that no one wants to touch, and it still cannot read a paragraph of context and weigh it.

Pure model. Hand the whole problem to a language model and ask it to pick the best match. It reads nuance well — and it also invents options that do not exist, ignores hard constraints when they are inconvenient, cannot cite why it chose, and costs a token bill on every candidate. We measured this directly: a mid-sized model asked to do the entire job produced fluent, confident, and frequently wrong answers.

The hybrid: let each side do what it is good at

The reliable pattern separates the problem into three stages:

  1. Deterministic gate. Hard constraints — the non-negotiables — are applied in code, first. Anything that cannot possibly qualify is removed before a model ever sees it. This is cheap, exact, and eliminates whole categories of hallucinated matches.
  2. Model ranking with reasons. The surviving candidates — now a short list, not the whole universe — go to the model, which ranks them and, critically, explains each ranking in language a human can check.
  3. Human-governed escalation. Low-confidence or high-stakes cases route to a person rather than being silently auto-decided. The system proposes; a human disposes.

Why this wins

  • Correctness. The gate makes impossible matches impossible. The model never gets the chance to suggest something disqualified.
  • Cost. The model reasons over a short list, not the entire dataset — often an order-of-magnitude fewer tokens per decision.
  • Explainability. Every result carries a reason, so a human can audit it and a business can defend it.
  • Stability. When criteria change, most changes are rule changes — edits in code with tests — not prompt roulette.

The engineering that makes it real

The idea is simple; the discipline is not. It takes a clean separation between the deterministic and the probabilistic, an evaluation harness so you can prove a change helped, confidence thresholds tuned to the real cost of a wrong answer, and honest logging of what the model saw and said. This is exactly the AI engineering we hold every intelligent system to. See our AI engineering principles.

Generalized deliberately. The specific criteria, data, and matching logic of any Martimus or client system are not disclosed here.

Discuss a Project Intelligence capability