Skip to content

Self-Learning Validation

Self-learning validation is one of five intelligence layers that make modelBridge an adaptive, self-maintaining system. While the dynamic UI renders itself from schemas and cost estimates update in real time, the validation system takes it a step further — it learns from failures and improves over time.

modelBridge learns from generation failures. When a model rejects your media — wrong dimensions, file too large, unsupported aspect ratio, video too long or too short — the plugin extracts the exact constraint values from the error, saves them permanently, and enforces them automatically on all future attempts with that model.

The first error on an undeclared constraint is unavoidable. Every subsequent attempt on the same model catches it instantly — before any API call, before any charge.

You generate with a model that has undeclared requirements. fal.ai returns an error — for example, “Image dimensions are too small. Minimum dimensions are 300x300 pixels.”

The error is parsed using a two-step strategy:

  • Structured data first — fal.ai validation errors often include machine-readable constraint values (e.g., min_width: 300, min_height: 300). When present, these are read directly.
  • Message parsing fallback — when structured data is absent, regex patterns extract values from the error message text.

Extracted constraints are saved permanently per model with dual persistence:

  • localStorage — fast reads during real-time validation polling
  • Disk file — survives CEP cache clears, Premiere Pro updates, and plugin reinstalls

On every subsequent attempt, the learned constraint is checked during preflight validation (every 500ms while media is selected). If your media does not meet the requirement, you see:

  • Red border on the media card
  • Specific error message: “Image too small (128x128, min 300x300)”
  • Generate button disabled

No API call. No charge. No waiting.

ConstraintWhat It CatchesExample Message
Image too smallWidth or height below minimum”Image too small (640x480, min 1024x768)“
Image too largeWidth or height above maximum”Image too large (6000x4000, max 2048x2048)“
File too largeFile size exceeds limit”File too large (15 MB, max 10 MB)“
Invalid aspect ratioRatio outside allowed range”Aspect ratio 4:1 not supported (range: 1:2 to 2:1)“
Video too longDuration exceeds maximum”Video too long (30s, max 10s)“
Video too shortDuration below minimum”Video too short (1s, min 3s)”

For unknown future constraint types, a generic fallback parser extracts numeric min/max values from any error message and caches them per model.

When a constraint is learned for the first time, the error banner shows:

“Requirement saved — this will be caught before generation next time.”

This only appears once per model per constraint type. If the same error fires again, the acknowledgment is suppressed — the preflight system should have caught it.

Learned constraints never override schema-declared values. The merge strategy is “fill gaps only” — if the model’s schema already declares a maximum width, a learned constraint will not overwrite it. Schema is the source of truth. Learned constraints cover what the schema did not declare.

Each constraint is timestamped when learned. Constraints older than 30 days are still used but may not reflect recent model changes. Re-learning (hitting the same error again) refreshes the timestamp.

Learned constraints survive:

  • Plugin updates (data stored outside the extension folder)
  • Premiere Pro updates
  • CEP cache clears (disk fallback restores localStorage automatically)

You do not lose learned data when updating modelBridge.