We study the joint determination of wages, effort, and training in "apprenticeships" where novices must work in order to learn. We introduce the idea of learning-by-doing as an inequality constraint, which allows masters to strategically slow training down. Every Pareto-efficient contract has an initial phase where the novice learns as fast as technologically feasible, followed by a phase where their master constrains how fast they learn. This latter phase mitigates the novice's commitment problem, and thus lets the novice consume more than they produce early on in the relationship. Our model also has novel implications for optimal regulation.