tasks in the MiniWoB++ benchmark [23], and improves the zero-shot performance on several math
and commonsense reasoning benchmarks. Finally, DERA [36] simulates a dialogue between two
agents to improve the model’s predictions in the clinical domain, with one agent providing feedback
about important elements of the problem, and the other using the feedback to produce a ﬁnal output.
In this work, we focus on code generation applications, and SELF-DEBUGGING demonstrates the
effectiveness of both self-generated feedback and unit test feedback acquired by code execution. In
particular, SELF-DEBUGGING teaches the large language model to notice prediction errors via code
explanation in the style of rubber duck debugging, which does not require the feedback message to
explicitly explain the implementation errors and how to ﬁx them.
Teaching Large Language Models to Self-Debug