Get very friendly with the civ in question. like +12-15 then wait until one of you has the requisite techs (mil tradition for a defensive pact, communism/facism for a permanent alliance)
I dont think the AI will ever offer a permanent alliance (but will accept if you offer and they like you enough) but they certainly will offer a dp if they like you enough. Suprisingly the relative power of your civs doesnt play much if any role in their decision, just how much they like you
Note that you need to enable permanent alliance in the options at the start of the game, as when signed it gives you a lot of control over that AI which could be considered game breaking, or at least a substanital deviation from normal rules