RuleForge: Inferring and Instantiating Latent Visual Rules as Executable Programs
Organizations: Institute of Artificial Intelligence and Brain Sciences, University of Macau Macau, China · Faculty of Information Science and Computing, University of Macau Macau, China · Hefei University of Technology Hefei, China
Abstract
Visual rule reasoning asks whether multimodal models can recover an abstract concept from a few examples. Existing studies either infer rules from visual examples but evaluate only classification or verbalization, or supervise executable generation with rules provided as input. Consequently, the relationship between visual rule understanding and reliable rule instantiation remains insufficiently explored. We present Bongard-Forge100k, a controlled benchmark, together with RuleForge, a backbone-agnostic framework that jointly learns visual rule understanding and rule-conditioned executable generation. The benchmark contains 108,797 problems: 86,000 for training, 19,297 for testing familiar rules, and 3,500 for testing held-out rule compositions. The framework progresses through rule-understanding training, joint understanding and scene-program supervision, and refinement via execution-grounded reinforcement learning with Understanding Replay. Executing generated programs under multiple random seeds provides verifiable feedback on executability, rule satisfaction, diversity, and robustness. With UniLIP as the primary backbone, RuleForge improves multiple-choice accuracy over the base model by 20.93 percentage points on familiar rules and 28.42 percentage points on held-out rule compositions, while increasing scene-level rule satisfaction on familiar rules from 2.91% to 70.99%. Additional experiments on InternVL3.5, Qwen3-VL, and Show-o2 demonstrate the effectiveness of the proposed training data and framework across diverse multimodal architectures.
Figures & tables
| Benchmark | Understanding task | Executable generation | Visual domain | # Problems | Concept inventory |
|---|---|---|---|---|---|
| Original Bongard Problems ( Bongard, 1970 ) | Verbal rule induction | No | Diagrams | 100 | Problem-specific visual concepts |
| Bongard-LOGO ( Nie et al., 2020 ) | Binary classification | No | Drawings | 12,000 | 627 shape categories; 25 abstract attributes |
| Bongard-HOI ( Jiang et al., 2022 ) | Binary classification | No | HOI images | 242 HOI concepts | |
| Bongard-OpenWorld ( Wu et al., 2024 ) | Binary classification | No | Web images | 1,010 | 1,010 free-form concepts |
| Bongard-Forge100k | Multiple-choice rule recognition; free-form rule explanation | Yes (scene programs) | Rendered scenes | 108,797 | 62 registered base rules; 24 held-out compositions |
| Model | Stage | Familiar Rules | Held-Out Rule Compositions | ||||
|---|---|---|---|---|---|---|---|
| MCQ | Exp. | Joint | MCQ | Exp. | Joint | ||
| Commercial zero-shot references | |||||||
| Gemini-2.5 Flash-Lite ( Google, 2025 ) | – | 30.95 | 10.37 | 3.61 | 37.63 | 0.74 | 0.23 |
| GPT-6-Sol | – | 68.81 | 21.32 | 16.18 | 84.09 | 5.31 | 4.63 |
| Backbones trained with RuleForge | |||||||
| InternVL3.5-2B ( Wang et al., 2025a ) | Base | 33.31 | 3.81 | 1.61 | 35.00 | 0.97 | 0.76 |
| Model | Stage | Familiar Rules | Held-Out Rule Compositions | ||
|---|---|---|---|---|---|
| Exec. | RuleSat | Exec. | RuleSat | ||
| API-documented commercial zero-shot references | |||||
| Gemini-2.5 Flash-Lite ( Google, 2025 ) | – | 45.47 | 30.37 | 33.33 | 20.76 |
| GPT-6-Sol | – | 94.71 | 85.41 | 91.67 | 83.40 |
| Backbones trained with RuleForge | |||||
| Qwen3-VL-4B-Instruct ( Bai et al., 2025 ) | Base | 4.04 | 2.69 | 0.00 | 0.00 |
| Familiar | Held-Out | ||||
|---|---|---|---|---|---|
| Stage | Source | Exec. | RuleSat | Exec. | RuleSat |
| II | Ref. | 77.50 | 71.98 | 62.40 | 43.65 |
| III | Ref. | 88.70 | 79.37 | 79.20 | 50.09 |
| II | Pred. | 59.20 | 34.43 | 25.60 | 12.96 |
| III | Pred. | 69.50 | 38.69 | 42.60 | 21.20 |
| (a) Stage II task mixture | ||||
|---|---|---|---|---|
| Metric | U-only | G-only | ||
| Familiar MCQ | 70.80 | 61.50 | 72.90 | 84.95 |
| Held-out MCQ | 60.77 | 49.74 | 59.73 | 66.60 |
| Familiar Exp. | 24.80 | 5.40 | 25.90 | 25.80 |
| Held-out Exp. | 8.22 | 0.10 | 17.07 | 16.83 |
| Familiar RuleSat | 2.91 | 68.76 | 61.89 | 60.42 |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Stage | Initialization and trainable components | Training budget | Learning rate | Batching | Sampling configuration |
|---|---|---|---|---|---|
| I | Base model; LM LoRA and multimodal projector | 2 epochs; 6,500 updates | LoRA; projector | Logical batch 8; accumulation 6; effective batch 48 | MCQ/Exp./Verify/Fact |
| II | Stage I checkpoint; LM LoRA only | 1 epoch; 7,313 updates | Understanding and program batches 8; accumulation 4 | Understanding:Program | |
| III | Stage II checkpoint; LM LoRA only | 1,000 policy updates | Six candidates per group; replay batch 8 | Three shared execution seeds; understanding replay at every update |
| Familiar | Held-Out | |||||
|---|---|---|---|---|---|---|
| Configuration | MCQ | Exp. | Joint | MCQ | Exp. | Joint |
| Full III | 85.01 | 24.63 | 21.75 | 66.00 | 16.46 | 7.00 |
| III w/o Replay | 84.91 | 25.30 | 22.35 | 67.29 | 13.09 | 5.60 |
Visual Reasoning
Visual reasoning studies how AI systems interpret and combine visual evidence to solve spatial, relational, compositional, and physical problems.
See all 165 papers