The global trend of industrializing agriculture increasingly transforms farms and firms into specialized component suppliers within a multi-stage food processing chain, which creates intraindustry trade between- and within geographical regions. This can be analyzed within the framework of a hypothetical multiregional food-processing firm that benefits from outsourcing of various ‘tasks’ to other sub-contracting regions, in order to utilize lower production cost there. This paper demonstrates how this can be modeled as a multi-output cost minimization problem of the processing firm, and it is argued that with respect to agriculture, the outsourcing opportunities for the firm are determined by economies of diversification. Trade is implicitly reflected as the movement of intermediate factors towards the processing firm, and firm-level specialization of the sub-contractors is an observable outcome. This framework is applied to pig production in 1155 municipalities in southern Germany that can be interpreted as ‘almost firm-level’ data. The estimated multi-output production frontier is decomposed according to a primal measure of diversification economies. Results show that pig farms located closer to slaughterhouses tend to specialize more in one of the tasks ‘piglet production’, ‘rearing’ or ‘fattening’, while farms in regions distant from slaughterhouses tend to insource all of these tasks. Future research may extend the framework towards comparative static analyses of relevant policies.