Abstract. This paper addresses an important weakness of the macroeconomic learning literature by allowing agents to test the specification of their models. In contrast to existing macroeconomic learning models, we assume agents are aware of potential model misspecification, and try to detect it, in real-time, using an econometric specification test. If a model fails the test, a new model is formulated. If a model passes the test, it is used to implement a policy based on the provisional assumption that the current model is correctly specified, and will not change in the future. At the same time, policy decisions feedback to influence the model that agents are trying to learn about.Although this testing and model validation process is an accurate description of most macroeconomic policy problems, the dynamics produced by this process are not well understood. We make progress on this problem by exploiting results from the large deviations literature. Our analysis can be interpreted as providing a selection criterion for self-confirming equilibria, based on their 'robustness'. Robust self-confirming equilibria survive repeated specification tests, and are characterized by their large deviation rate functions.