Kui Prefecture (Kuizhou) was an area typical of many in the southern part of the Tang Empire which experienced an increase in population and development as a result of the disasters beginning with and following the An Lushan Rebellion (also known as the Anshi disturbances).
The Tang forces led by Li Jing were unsuccessful in their attempted invasion, being both beset by "bandits" and being turned back at the heavily defended border of the neighboring empire.
And in spring 620, Ran Zhaoze (冉肇則) the leader of the Kaishan Tribe (開山蠻), rebelled against Tang rule and attacked Kui Prefecture.
Di Renjie was one of the officials from parts of China which were not the traditional areas for recruitment of top leadership positions which Wu Zetian promoted, during her interregnum.
In the late 9th and early 10th centuries, Meng Zhixiang and Wang Jian were involved in operations which were in part centered in Kuizhou, which became the capital of Ningjiang Circuit (寧江).
In 904, the warlord Zhao Kuangning sent an armed group up the Yangtze River to attack Kui Prefecture, still, held by Wang Jian under the title of Military Governor of Xichuan Circuit (西川, headquartered in modern Chengdu, Sichuan).
Wang's general Zhang Wu (張武) subsequently built a large iron chain across the Yangtze, in order to be able to restrict travel.
In 914, Gao Jixing launched a fleet and headed west up the Yangtze, attempting to capture four prefectures which had become Former Shu territory — Kuizhou, Wanzhou (萬州), Zhongzhou (忠州), and Fu zhou(涪州), all in modern Chongqing).
His son Meng Renyi would be created Prince of Kui, in 950, shortly before the establishment of the Song dynasty in 960, which would eventually result in the reunification of China as one state.
The Song dynasty (960 to 1279) retained Kui as a distinct political entity, and available quantitative and other data serve to illustrate the changes in population of Kuizhou and its relative status in terms of education and recruitment of officials into the national government, at several points of time during this period: data include census figures for population, records from the imperial civil service examinations, and other writings.
A major function of the Song educational system and its accompanying formal award of graduate degrees to successful candidates was to recruit personnel to fill important and powerful governmental positions in the imperial bureaucracy.
During the Tang and Song dynasties, the Xiaoxiang was associated with a long poetic tradition, going back to Qu Yuan's Li Sao, and subsequent development through the Han dynasty into the Chuci anthology: by the time of Tang and Sung, the connotations of this Xiaoxiang (or sao) style verse included the implications of exile from court, displacement into the wilderness, and the disappointment of talented and loyal officials who were condemned to exile by the slander of inferiors.
After being pardoned and recalled from exile for his role in the Anshi affair, in 756, returning down the Yangzi River, Li stopped at Baidicheng, in Kuizhou, which was the occasion of his writing his famous poem "Departing from Baidi in the Morning".