  Many complex tasks can be decomposed into simpler, independent parts.
Discovering such underlying compositional structure has the potential to enable
compositional generalization. Despite progress, our most powerful systems
struggle to compose flexibly. It therefore seems natural to make models more
modular to help capture the compositional nature of many tasks. However, it is
unclear under which circumstances modular systems can discover hidden
compositional structure. To shed light on this question, we study a
teacher-student setting with a modular teacher where we have full control over
the composition of ground truth modules. This allows us to relate the problem
of compositional generalization to that of identification of the underlying
modules. In particular we study modularity in hypernetworks representing a
general class of multiplicative interactions. We show theoretically that
identification up to linear transformation purely from demonstrations is
possible without having to learn an exponential number of module combinations.
We further demonstrate empirically that under the theoretically identified
conditions, meta-learning from finite data can discover modular policies that
generalize compositionally in a number of complex environments.
