Cai Yan was from the Chenliu prefecture. She was the daughter of the Han minister Cai Yong and wife of Wei Zhongdao and later, Dong Si.
After her first marriage, Wei Zhongdao passed away and around the end of 194 AD, Cai Yan was abducted by the Xiongnu tribesmen. She was made a concubine to an important tribesman, Liu Bao, bore him two children, and lived with the Xiongnu for twelve years.
In the time when Dong Zhuo took control of the emperor, Cai Yong was promoted favorably, and so when Dong Zhuo was assassinated by the plan of Wang Yun, Cai Yong, who was with Wang Yun, heard the news and gasped in fright. Wang Yun had him arrested and eventually died in prison.
Cao Cao was a friend of Cai Yong and was sad that they would have no heir, so he had gold delivered to the Xiongnu in exchange for Cai Yan. She was returned and was remarried to Dong Si.
Cai Yan was said to be intelligent and possessed musical talent. One night she heard her father play an instrument, and a string broke. Cai Yan correctly stated it to be the second string, and Cai Yong broke another, this time, on purpose. Once again she was able to name the string.