From what I see the AI needs to be hostile to its overlord and have bigger armies than its overlord before it ever declares wars. Finding people to support its independence is also important. In the Iberian wedding, I got aragon under me as Castile but it got Austria's support and tried to break free when I got low manpower after a war with morocco. Racked up huge debts but managed to hold them back. Playing the latest beta though so your mileage may vary.