Knowledge-based RPM Solver

Agent's Conceptual Design

In this project, I developed a Knowledge-based AI agent with Python to solve one of the most commonly used visual IQ test -- the Raven's Progressive Matrices (RPM).


On a high level, the agent utilizes a hierarchical production system with logic rules to detect patterns in the given problem images and select the optimal answer from given options. As summarized in the following diagram, there are four major components in the design:

  • Preliminary Processing

  • Special Geometric Relationship Detection and Answer Selection

  • Boolean Operation Relationship Detection and Answer Selection

  • DPR/IPR Relationship Detection and Answer Selection


The AI Agent's Overall Design Logic

Agent's Performance

Successfully solved RPM problems:

Successfully solved RPM problems:

Agent Approach Summary

  • The overall approach of the agent’s design process can be summarized in the following ways. Firstly, conceptually similar to Incremental Concept Learning, the initial agent started with only a couple of pattern checking methods such as equality check and mirroring check. As more and more problems were reviewed and fit to the agent, the agent includes more pattern detection methods (generalization), or refines the heuristics (e.g. threshold parameter tuning) it uses to avoid false positives (specialization).

  • Secondly, the Generate and Test approach was widely used as well. In pattern recognition, different combinations of image pairs were generated, and the agent iterates through them and tests whether any of the pairs shows up a match. Once a particular pattern is identified, the agent generates an expected image, and tests each potential options to see which one has the best match.

  • Then, the process also utilizes the Learning from Mistakes approach. At any step, the agent prints out both the expected and unexpected behaviors (mistakes), upon which case-specific review and checking was done to help isolate the mistakes and identify the causes in the agent’s program.

  • Lastly, functional programming principles were implemented, especially regarding standardizing the calculation of heuristics, detection metrics and scoring mechanisms among potential answers.


Interested to learn more? Feel free to connect me at wenhaowu92@gmail.com!