Home/AI Orchestration · Model Risk/Part II

Series 2 · Episode 05 · SOLUTION · Optimization · L05

KKT as the proposal audit

An agent's proposed weights are a claim of optimality, and stationarity plus complementary slackness turn that claim into something a machine can certify, refuse, or call degenerate

KKT audit against the loss-card hash before any spend.

flowchart LR
  subgraph PROP["Agent proposes x"]
    X["Weights / lease"]:::input
  end
  subgraph AUDIT["Layer-1"]
    KKT["KKT / slackness witness"]:::process
    CARD["Loss card hash"]:::artifact
  end
  subgraph V["Verdict"]
    OK["Certified"]:::gate
    NO["LOSS_CARD_MISMATCH"]:::risk
  end
  X --> KKT --> CARD
  CARD --> OK
  KKT -->|program swap| NO

  classDef input fill:#CCFBF1,stroke:#0F766E,color:#134E4A,stroke-width:2px
  classDef decision fill:#FEF3C7,stroke:#B45309,color:#78350F,stroke-width:2px
  classDef risk fill:#FEE2E2,stroke:#B91C1C,color:#7F1D1D,stroke-width:2px
  classDef gate fill:#DCFCE7,stroke:#15803D,color:#14532D,stroke-width:2px
  classDef process fill:#E0E7FF,stroke:#4338CA,color:#312E81,stroke-width:2px
  classDef artifact fill:#F5F5F4,stroke:#57534E,color:#1C1917,stroke-width:2px

The problem we left open

Last post the job got a type: objective, constraint cards, declared domain, declared structure. That closed the class of failures where a solver answers a question nobody asked, and it exposed the uncomfortable fact that "make the two CEH-001 frames agree" is a sentence whose literal optimum is the forbidden 1.80.

But a typed job still leaves the last hop unguarded. Something proposes an x. In this stack that something is increasingly a Layer 2 agent with tool access, a covariance estimate of its own, and a paragraph of justification. The proposal arrives as a vector of weights and a sentence claiming it is optimal for the declared job. The sentence is not evidence. And re-solving the whole problem inside the harness to compare answers is both expensive and beside the point, because the harness would then be trusting its own solver rather than checking the claim.

What I want is a certificate: a cheap, local, arithmetic test that a proposal either passes or fails, independent of who produced it or how.

The solution, as one stack

Constrained optimality has exactly such a test, and it has had one since 1951. The Karush-Kuhn-Tucker conditions are usually taught as a way to find optima. In an orchestration stack their more valuable use is to audit them. Five moves.

### 1. Feasibility before optimality, always

Cheapest check, run it first. Does the proposal satisfy the equality rows and the inequality rows on the card?

Concretely, in the three-asset world I will use throughout, expected returns of 6, 10 and 14 percent, volatilities of 12, 18 and 26 percent, pairwise correlation 0.30, target return 10 percent, weights summing to one, an agent proposes 55, 10 and 35 percent. Sum is one, so the budget row passes. Expected return is 9.20 percent. The target was 10. The proposal misses a declared equality by eighty basis points, and no discussion of optimality is warranted or needed. Refuse, with the violated row named.

This sounds too obvious to state as a move. It is the single most common thing skipped, because proposals arrive with prose attached and prose is persuasive in a way that a constraint residual is not.

### 2. Verify the constraint qualification before you trust any multiplier

Multipliers are only meaningful when the geometry at the proposed point is well behaved, concretely, when the gradients of the active constraints are linearly independent. That is not a formality. If the return row and the budget row become parallel, which happens when the expected returns you handed the solver are effectively identical across assets, the active constraint gradients collapse and the multipliers stop carrying information. The Fritz John conditions still yield multipliers in that case, but with the possibility that the objective's own multiplier is zero, which is the mathematics telling you that at this point the objective is irrelevant and the constraints alone determine everything.

That distinction maps onto verdicts cleanly. A failed constraint qualification is not a refuse; nothing has been violated. It is an inconclusive with a specific diagnosis: degenerate geometry, so the certificate cannot be issued and a human has to look at why the inputs collapsed.

### 3. Check stationarity against the card's numbers, with a declared tolerance

This is the core of the audit. At an optimum, the objective gradient must be a linear combination of the active constraint gradients, for a minimum-variance job under a budget and a return target, twice the covariance times the weights must equal the budget multiplier times the ones vector plus the return multiplier times the expected-return vector.

Solving that system on the card's inputs gives the certified point: weights of 29.87, 40.26 and 29.87 percent, volatility 13.85 percent, with a return multiplier of 0.473 and a budget multiplier of minus 0.009 under that sign convention. At those numbers the stationarity residual is zero to machine precision. The multipliers are worth reading, not just checking, the return multiplier is the shadow price of the target, telling the desk what a hundred basis points of extra required return costs in variance.

The tolerance is a card field, not a taste. The natural scale of the gradient terms here is about 0.05, so a residual of a few times ten to the minus four is one percent of scale, not machine noise, and not acceptable.

### 4. Check complementary slackness sign by sign

For every inequality: either the constraint is tight and its multiplier may be positive, or the constraint is slack and its multiplier must be zero. You cannot have both a positive multiplier and strict slack.

This is where the interesting failures live once feasibility passes. An agent proposing 45, 60 and minus 5 percent under a shorts-forbidden card fails feasibility outright. Subtler: a proposal that reports a positive multiplier on a nonnegativity row for an asset it holds at 15 percent. Nothing is infeasible; the certificate is simply incoherent, and an incoherent certificate usually means the proposal was assembled from a different problem than the one on the card.

### 5. Only then may the word "optimal" appear : and only agents propose

For a convex objective over affine equalities and convex inequalities, a feasible KKT point is a global optimum. That is the theorem the whole audit rests on, and it is why the structure field from the last post matters: on a declared convex job, passing the audit licenses the word "optimal" as a claim. On a non-convex job the same passing certificate licenses only "stationary and feasible," which is a much smaller thing and should be reported as such.

The division of labour that follows is the constitution of this series. Agents propose x, and may propose their multipliers too, a helpful hint that costs the harness nothing to verify. The harness certifies, and spends only on a certified optimum or a certified infeasibility. There is no verdict called "the reasoning looked sound."

The example: CEH-001 through the KKT audit

The typed job is the hedge-and-allocation problem around the structured book, with CEH-001's two card-consistent marks near 1.50 and 2.10 feeding the risk inputs.

The agent returns weights of 30.31, 39.37 and 30.31 percent, with a tidy write-up and a reported portfolio volatility of 12.60 percent. Feasibility passes: the weights sum to one and hit the 10 percent target exactly. Constraint qualification holds. So far this looks like a promotion.

Stationarity is where it dies. Against the card's covariance and the card's multipliers the residual comes back at roughly four times ten to the minus four, about one percent of gradient scale, far outside tolerance. Re-scoring the same weights under the card's covariance gives a volatility of 13.85 percent, not 12.60.

Read that gap carefully, because it is the reason this audit earns its keep. The weights are nearly right. The risk claim is wrong by 125 basis points, and the reason is that the agent solved the problem with pairwise correlation 0.15 instead of the card's 0.30, a stale covariance recipe from a research notebook. A reviewer eyeballing the weights against the certified optimum would have waved this through, because the weights differ in the third decimal. The stationarity residual is what notices, because it tests the proposal against the card's geometry rather than against a reviewer's intuition. That failure is LOSS_CARD_MISMATCH: right shape, wrong world, understated risk.

And the midpoint stays impossible. There is no covariance recipe, no multiplier pair and no active-set story under which a mark of 1.80 emerges as a stationary point of any card on file. Under the old regime 1.80 was a compromise. Under the audit it is a proposal that cannot produce a certificate, and the verdict is refuse with a named reason rather than a disagreement about judgement.

The flow in one breath

Problem: agents propose weights with confident prose, and re-solving the problem to check them is expensive and circular. Solution: audit the proposal instead, feasibility first, constraint qualification before any multiplier is trusted, stationarity residual against the card's own inputs within a declared tolerance, complementary slackness sign by sign, and convexity as the only licence for the word optimal. Example: CEH-001's near-perfect weights fail on a 125-basis-point risk misstatement traced to a stale correlation, and 1.80 remains a point no certificate can cover.

Curious how others set stationarity tolerances that catch stale covariance without tripping on solver noise, and whether anyone treats a failed constraint qualification as inconclusive rather than quietly shipping the multipliers anyway.

Next. Open S2-06: Diversification that never hits zero. Previous: S2-04 (Typed jobs before spend). Part II index.