  Large Language Models (LLMs) have shown remarkable performance in various
basic natural language tasks. For completing the complex task, we still need a
plan for the task to guide LLMs to generate the specific solutions step by
step. LLMs can directly generate task plans, but these plans may still contain
factual errors or are incomplete. A high-quality task plan contains correct
step-by-step solutions for solving all situations and behavioral instructions
for avoiding mistakes. To obtain it, we propose the Learning to Plan method,
which involves two phases: (1) In the first learning task plan phase, it
iteratively updates the task plan with new step-by-step solutions and
behavioral instructions, which are obtained by prompting LLMs to derive from
training error feedback. (2) In the subsequent test phase, the LLM uses the
learned task plan to guide the inference of LLM on the test set. We demonstrate
the effectiveness of our method on the five different reasoning type tasks (8
datasets). Further, our analysis experiment shows that the task plan learned by
one LLM can directly guide another LLM to improve its performance, which
reveals a new transfer learning paradigm. We release the code at
\url{https://github.com/Eureka6174/LearnNLPlan}
