We study optimal licensing contracts in a differentiated Bertrand duopoly, and show that per-unit contracts are preferred to ad valorem contracts by the patentee, while welfare is higher under the ad valorem contract. The difference between Cournot and Bertrand case is explained in terms of quantity effect and profits effect.