Wang, seeing the weaknesses developing for Li's forces, decided to launch his own attack on Li. He gathered the most elite of his own troops and started to march against Li. Pei opined that Li should try to contain Wang's advances and then send part of the army to attack Luoyang while Wang was away. Li himself opined that he should refuse to engage Wang to let Wang's food supplies run out. However, his generals Chen Zhilüe (), Fan Wenchao (), and Shan Xiongxin all advocated a head-on engagement against Wang, and Li accepted their suggestion. In the subsequent Battle of Yanshi, Wang sent his flanks to hide, and when Li engaged him, the flank forces attacked as well, leading to a general rout of Li's forces. Wang captured Yanshi (), where most of Li's officials kept their families, and the family members subsequently sent messages to those officials urging them to surrender. Li tried to withdraw to Luokou, but by the time he got there, Wang had caught up with him, and Bing surrendered Luokou to Wang; Shan surrendered as well. Li himself fled east to Hulao.