Cai Yan was the daughter of Cai Yong, a famous Eastern Han dynasty scholar from Yu County (), (), which is around present-day Qi County, Kaifeng, Henan. She was married to Wei Zhongdao () in 192 but her husband died shortly after their marriage and they did not have any children. Between 194 and 195, when China entered a period of chaos, the Xiongnu nomads intruded into Han territory, captured Cai, and took her back as a prisoner to the northern lands. During her captivity, she married the Xiongnu chieftain (the "Wise Prince of the Left") and bore him two sons. 12 years later, the Han Chancellor, Cao Cao, paid a heavy ransom in the name of Cai's father for her release. After Cai was freed, she returned to her homeland but left her children behind in Xiongnu territory. The reason Cao Cao wanted her back was that she was the sole surviving member of her clan and he needed her to placate the spirits of her ancestors.