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.
How It Works
Section titled “How It Works”1. A Generation Fails
Section titled “1. A Generation Fails”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.”
2. The Plugin Learns
Section titled “2. The Plugin Learns”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.
3. The Constraint Is Saved
Section titled “3. The Constraint Is Saved”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
4. Future Attempts Are Blocked
Section titled “4. Future Attempts Are Blocked”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.
Six Constraint Types
Section titled “Six Constraint Types”| Constraint | What It Catches | Example Message |
|---|---|---|
| Image too small | Width or height below minimum | ”Image too small (640x480, min 1024x768)“ |
| Image too large | Width or height above maximum | ”Image too large (6000x4000, max 2048x2048)“ |
| File too large | File size exceeds limit | ”File too large (15 MB, max 10 MB)“ |
| Invalid aspect ratio | Ratio outside allowed range | ”Aspect ratio 4:1 not supported (range: 1:2 to 2:1)“ |
| Video too long | Duration exceeds maximum | ”Video too long (30s, max 10s)“ |
| Video too short | Duration 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.
The Acknowledgment
Section titled “The Acknowledgment”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.
Constraint Priority
Section titled “Constraint Priority”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.
Staleness
Section titled “Staleness”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.
Persistence Through Updates
Section titled “Persistence Through Updates”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.