In this paper we develop a model of r&d alliance formation. Pairs of firms combine their knowledge in an attempt to innovate. Whether this attempt is successful depends in part on whether the pair has been successful in the past: accumulated experience teaches a pair of firms how to innovate together, but at the same time increases the similarity of their knowledge stocks. A tension exists between the desire for a familiar partner, and desire for a partner with complementary knowledge. How this tension is resolved depends on the nature of the innovation process itself, and the elasticity of substitution of different types of knowledge inputs in knowledge production. From the alliance-innovation process, a variety of networks form. In different parts of the parameter space we observe isolated agents, a dense, connected network, and small worlds.