  Training on synthetic data can be beneficial for label or data-scarce
scenarios. However, synthetically trained models often suffer from poor
generalization in real domains due to domain gaps. In this work, we make a key
observation that the diversity of the learned feature embeddings plays an
important role in the generalization performance. To this end, we propose
contrastive synthetic-to-real generalization (CSG), a novel framework that
leverages the pre-trained ImageNet knowledge to prevent overfitting to the
synthetic domain, while promoting the diversity of feature embeddings as an
inductive bias to improve generalization. In addition, we enhance the proposed
CSG framework with attentional pooling (A-pool) to let the model focus on
semantically important regions and further improve its generalization. We
demonstrate the effectiveness of CSG on various synthetic training tasks,
exhibiting state-of-the-art performance on zero-shot domain generalization.
