Humans depend on social relationships for survival and wellbeing throughout life. Yet, individuals differ markedly in their ability to form and maintain healthy social relationships. Here we use a simple mathematical model to formalize the contention that a person’s attachment style is determined by what they learn from relationships early in life. For the sake of argument, we therefore discount individual differences in the innate personality or attachment style of a child, assuming instead that all children are simply born with an equivalent, generic, hardwired desire and instinct for social proximity, and a capacity to learn. In line with the evidence, this innate endowment incorporates both simple bonding instincts and a capacity for cognitively sophisticated beliefs and generalizations. Under this assumption, we then explore how distinct attachment styles might emerge through interaction with the child’s early caregivers. Our central question is, how an apparently adaptive capacity to learn can yield enduring maladaptive attachment styles that generalize to new relationships. We believe extensions of our model will ultimately help clarify the complex interacting mechanisms – both acquired and innate – that underpin individual differences in attachment styles. While our model is relatively abstract, we also attempt some connection to known biological mechanisms of attachment.