I don't know exactly how it actually is determined, but I feel like unpledged electors should become much less likely in situations where they have a chance of actually affecting the results. There's only been one time in the history of the country that faithless electors have had any chance of shifting the results (for VP in 1832); the vast majority of the time, it's just a protest. Even in extremely close elections like 1876 and 2000, there were no serious attempts to influence the results that way. It seems to me that unless the candidate is extremely unpopular or controversial, costing your party the presidency in that way would probably end the elector's political career.