It is not known when Li Kuangwei was born, but it is known that his family was from Lulong Circuit's capital Fanyang. The first historical reference to him was in 886, when his father, the military governor (Jiedushi) Li Quanzhong, who had seized control of Lulong in 885 after overthrowing the prior military governor Li Keju, died, and Li Kuangwei thereafter claimed the title of acting military governor. At some point, the imperial government confirmed him as full military governor.
It was said that Li Kuangwei was ambitious, and, because the Tang state was in disarray at the time, he strengthened his army with the intent of eventually trying to occupy more territory.
In 890, another major warlord, Li Keyong the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi), attacked Helian Duo the defender of Yun Prefecture (雲州, in modern Datong, Shanxi), capturing its eastern part. Helian sought aid from Li Kuangwei, and Li Kuangwei took 30,000 men to aid him. After Li Keyong's officer An Jinjun (安金俊) died in battle and another officer, Shen Xin (申信), surrendered to Helian, Li Keyong was forced to withdraw.
As a result of Li Keyong's attack on Helian, Helian and Li Kuangwei submitted petitions to Emperor Xizong's brother and successor Emperor Zhaozong, asking the emperor to declare a general campaign against Li Keyong. They were concurred in by Li Keyong's rival Zhu Quanzhong the military governor of Xuanwu Circuit (宣武, headquartered in modern Kaifeng, Henan), as well as the chancellors Zhang Jun and Kong Wei. Emperor Zhaozong thus declared a general campaign against Li Keyong, with Zhang in command. As part of the operations against Li Keyong, Li Kuangwei and Helian were to attack Li Keyong from the north. They had initial successes, as Li Kuangwei captured Wei Prefecture, and Helian, along with Tufan and Xiajiasi tribesmen, attacked Zhelu Base (遮虜軍, in modern Xinzhou, Shanxi), killing its defender Liu Huzi (劉胡子). However, Li Keyong then sent a major force under his adoptive sons Li Cunxin and Li Siyuan, and they defeated Li Kuangwei and Helian, capturing Li Kuangwei's son Li Renzong (李仁宗) and Helian's son-in-law, forcing them to withdraw. Zhang's main operations against Li Keyong subsequently collapsed under pressure from Li Keyong. Faced with defeat, Emperor Zhaozong was forced to restore all of Li Keyong's titles.
In fall 891, Li Keyong attacked Wang Rong the military governor of Chengde Circuit and had initial successes. When Li Kuangwei led an army to aid Wang, Li Keyong, after pillaging Chengde territory, withdrew. In spring 892, Li Kuangwei and Wang jointly attacked the Hedong-held town of Yaoshan (堯山, in modern Xingtai, Hebei), but were defeated by Li Keyong's officer Li Sixun (李嗣勳) and thereafter withdrew. Thereafter, Li Keyong and his ally Wang Chucun the military governor of Yiwu Circuit (義武, headquartered in modern Baoding, Hebei); they withdrew after Li Kuangwei attacked Yun and Dai (代州, in modern Xinzhou, Shanxi) Prefectures (which had fallen to Hedong control by that point, forcing Helian to flee to Lulong). Late in 892, Li Kuangwei and Helian launched another attack on Yun, hoping to recapture it for Helian, but Li Keyong defeated them and forced them to withdraw.
In 893, Li Keyong attacked Wang Rong again, and Wang could not repel his attack despite aid from Li Cunxiao, formerly an adoptive son of Li Keyong's who had turned against Li Keyong. Li Kuangwei launched his army to aid Wang, and after he defeated Li Keyong, Li Keyong withdrew. Because of this, Wang awarded Li Keyong's army with a large amount of money and silk.
However, right as he launched his army, Li Kuangwei had sown the seeds of his defeat. His family members had held a feast to send him off, and at the feast, Li Kuangwei, who was drunk, raped the beautiful wife of his younger brother Li Kuangchou. Thereafter, while Li Kuangwei was on the way back to Lulong after aiding Wang, Li Kuangchou took over the Lulong headquarters and claimed the title of acting military governor, and subsequently issued orders to the Lulong soldiers to return to Lulong. The Lulong soldiers largely followed that order and deserted Li Kuangwei, who was left at Chengde's Shen Prefecture (深州, in modern Hengshui, Hebei) with a small number of his close followers. Unsure what he should do next, he sent his assistant Li Baozhen (李抱真) to the imperial capital Chang'an, requesting that he be allowed to report to the imperial capital. However, thereafter, as Wang was grateful to Li Kuangwei for his aid and sorry that Li Kuangwei had lost his own circuit, welcomed Li Kuangwei to Chengde's capital Zhen Prefecture (鎮州). He built a mansion for Li Kuangwei and honored Li Kuangwei like a father.
Once Li Kuangwei settled in at Zhen, he assisted Wang in building the defenses of Zhen Prefecture and training Chengde soldiers. However, as Wang was young (19) at the time, and Li Kuangwei himself liked the customs of the people of Zhen, he plotted with Li Baozhen (who had returned from Chang'an by that point) to seize control of the circuit. Later in 893, on the anniversary of the death of one of Li Kuangwei's parents, when Wang was at Li Kuangwei's mansion to pay his respects, Li Kuangwei had his own soldiers try to seize Wang. Wang, reacting quickly, stated that he was willing to turn the control of the circuit to him but that they should formally do so at the circuit headquarters. Li Kuangwei agreed, and they rode horses together toward headquarters, escorted by Li Kuangwei's soldiers. On the way there, one of the Chengde soldiers, Mo Junhe (墨君和), hidden in a corner, seized Wang and took him out of Li Kuangwei's corps of soldiers. The remaining Chengde troops, once they saw that Wang was out of danger, attacked Li Kuangwei and his troops, slaughtering them and allowing Wang to retain Chengde.