I haven't been able to find any definitive research/answers, but, based on the usage of their mimicry (camouflage and sexual), and some of its features (alteration of the surface texture of their skin, electric camouflage, development+change through lifetime), I'd hypothesise that it's most likely a mixture of the two. They likely have a large innate capacity to use the form of mimicry young cephalopods do, which is further developed socially/as a learned behaviour, which subsequently causes the change in the nature of their mimicry.
Cuttlefish texture change (Primary research article)
Transient sexual mimicry (Summary article (Nature))
Research has shown that cuttlefish mimicry develops and changes as they grow; it has also been shown to differ based on the location of the creature. There is also evidence of cephalopods learning socially, so it does indicate that their behaviour is at least partially learned. (Source + additional references- reed.edu ->Visual Mimicry in Cephalopods -> Ontogeny)