The bulk of international trade takes place in intermediate inputs as opposed to goods for final consumption. Studies of firm-level data show that there is substantial heterogeneity in the share of inputs that are imported by different firms, and that a firm's productivity increases with the quantity and variety of inputs that it imports. This paper develops a model to quantify the contributions of firm-level productivity gains to aggregate productivity and welfare gains from trade. In the model, heterogeneous firms choose the fraction of their inputs to import. Importing a higher fraction of inputs raises firm-level productivity, but requires higher up-front fixed costs. Therefore, firms with different inherent profitability will vary in how much they import and the productivity they gain from doing so. This heterogeneity provides aggregate productivity and welfare gains from trade that would not exist in a world in which firms used identical input bundles. These gains are consistent with data on specific trade liberalization episodes that show large firm-level productivity gains attributed to higher imports of intermediate inputs.