{"id":218570,"date":"2026-10-27T06:48:10","date_gmt":"2026-10-27T06:48:10","guid":{"rendered":"https:\/\/www.europesays.com\/ai\/218570\/"},"modified":"2026-10-27T06:48:10","modified_gmt":"2026-10-27T06:48:10","slug":"towards-artificial-general-intelligence-via-a-multimodal-foundation-model","status":"publish","type":"post","link":"https:\/\/www.europesays.com\/ai\/218570\/","title":{"rendered":"Towards artificial general intelligence via a multimodal foundation model"},"content":{"rendered":"<p>Architecture overview<\/p>\n<p>The notion of pre-training a large-scale machine learning model and then using it for downstream tasks first appeared in natural language processing (NLP). As shown in Supplementary Note Fig. S<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>c, large-scale NLP models like GPT<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 50\" title=\"Radford, A., Narasimhan, K., Salimans, T. &amp; Sutskever, I. Improving language understanding by generative pre-training. OpenAI Blog (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR50\" id=\"ref-link-section-d79362424e1194\" rel=\"nofollow noopener\" target=\"_blank\">50<\/a>, BERT<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 51\" title=\"Devlin, J., Chang, M.-W., Lee, K. &amp; Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language understanding. In Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 4171&#x2013;4186 (2019).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR51\" id=\"ref-link-section-d79362424e1198\" rel=\"nofollow noopener\" target=\"_blank\">51<\/a>, and their variants, take Transformers<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 52\" title=\"Vaswani, A. et al. Attention is all you need. In Advances in Neural Information Processing Systems, 5998&#x2013;6008 (2017).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR52\" id=\"ref-link-section-d79362424e1202\" rel=\"nofollow noopener\" target=\"_blank\">52<\/a> as text encoders to encode input texts into text embeddings, and then design pre-training objectives on top of these embeddings (e.g., generative loss and masked language modeling loss). In computer vision (CV), large-scale pre-training also becomes popular. Models like BiT<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 53\" title=\"Kolesnikov, A. et al. Big Transfer (BiT): General visual representation learning. In European Conference on Computer Vision, 491&#x2013;507 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR53\" id=\"ref-link-section-d79362424e1206\" rel=\"nofollow noopener\" target=\"_blank\">53<\/a> and ViT<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 54\" title=\"Dosovitskiy, A. et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR54\" id=\"ref-link-section-d79362424e1211\" rel=\"nofollow noopener\" target=\"_blank\">54<\/a> use convolutional neural networks (CNNs) or Transformers as image encoders to obtain embeddings of input images. Similarly, pre-training losses are computed using the image embeddings (e.g., image classification loss and masked image patch prediction loss). However, these models are single-modal and thus only benefit downstream tasks in one modality. For multimodal (e.g., image, text, and audio) pre-training<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Li, X. et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In European Conference on Computer Vision, 121&#x2013;137 (2020).\" href=\"#ref-CR12\" id=\"ref-link-section-d79362424e1215\">12<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Radford, A. et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, 8748&#x2013;8763 (2021).\" href=\"#ref-CR13\" id=\"ref-link-section-d79362424e1215_1\">13<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Li, L. H., Yatskar, M., Yin, D., Hsieh, C. &amp; Chang, K. VisualBERT: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557 (2019).\" href=\"#ref-CR14\" id=\"ref-link-section-d79362424e1215_2\">14<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Li, G., Duan, N., Fang, Y., Gong, M. &amp; Jiang, D. Unicoder-VL: A universal encoder for vision and language by cross-modal pre-training. In AAAI Conference on Artificial Intelligence, 11336&#x2013;11344 (2020).\" href=\"#ref-CR15\" id=\"ref-link-section-d79362424e1215_3\">15<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Su, W. et al. VL-BERT: Pre-training of generic visual-linguistic representations. In International Conference on Learning Representations (2020).\" href=\"#ref-CR16\" id=\"ref-link-section-d79362424e1215_4\">16<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Chen, Y.-C. et al. UNITER: Universal image-text representation learning. In European Conference on Computer Vision, 104&#x2013;120 (2020).\" href=\"#ref-CR17\" id=\"ref-link-section-d79362424e1215_5\">17<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 18\" title=\"Lin, J. et al. M6: A chinese multimodal pretrainer. arXiv preprint arXiv:2103.00823 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR18\" id=\"ref-link-section-d79362424e1218\" rel=\"nofollow noopener\" target=\"_blank\">18<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 32\" title=\"Jia, C. et al. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, 4904&#x2013;4916 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR32\" id=\"ref-link-section-d79362424e1221\" rel=\"nofollow noopener\" target=\"_blank\">32<\/a>, existing works can be divided into two groups according to their network architectures: single-tower models (e.g., UNITER<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 17\" title=\"Chen, Y.-C. et al. UNITER: Universal image-text representation learning. In European Conference on Computer Vision, 104&#x2013;120 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR17\" id=\"ref-link-section-d79362424e1225\" rel=\"nofollow noopener\" target=\"_blank\">17<\/a>, OSCAR<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 12\" title=\"Li, X. et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In European Conference on Computer Vision, 121&#x2013;137 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR12\" id=\"ref-link-section-d79362424e1229\" rel=\"nofollow noopener\" target=\"_blank\">12<\/a>, and M6<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 18\" title=\"Lin, J. et al. M6: A chinese multimodal pretrainer. arXiv preprint arXiv:2103.00823 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR18\" id=\"ref-link-section-d79362424e1233\" rel=\"nofollow noopener\" target=\"_blank\">18<\/a>) and two-tower ones (e.g., CLIP<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 13\" title=\"Radford, A. et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, 8748&#x2013;8763 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR13\" id=\"ref-link-section-d79362424e1237\" rel=\"nofollow noopener\" target=\"_blank\">13<\/a> and ALIGN<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 32\" title=\"Jia, C. et al. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, 4904&#x2013;4916 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR32\" id=\"ref-link-section-d79362424e1242\" rel=\"nofollow noopener\" target=\"_blank\">32<\/a>). Our BriVL can also be categorized into the two-tower models since we use separate image and text encoders. But note that we actually adopt two additional momentum encoders to help with the pre-training process (i.e., to dynamically maintain negative sample queues across training batches), resulting in a four-tower pre-training architecture.<\/p>\n<p>The pre-training goal of our BriVL is to learn two encoders that can embed image and text inputs into the same semantic space for effective image-text retrieval. To enforce the image and text encoders to learn better representations in the same embedding space, we introduce cross-modal contrastive learning with the InfoNCE loss<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 23\" title=\"Oord, A. v. d., Li, Y. &amp; Vinyals, O. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748 (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR23\" id=\"ref-link-section-d79362424e1249\" rel=\"nofollow noopener\" target=\"_blank\">23<\/a> into our BriVL. Specifically, our learning objective is to find the corresponding image embedding from a batch of them for a given text embedding and vice versa. By maximizing the cosine similarity of the image and text embeddings for each ground-truth pair while minimizing the cosine similarities of the embeddings from negative pairs, we jointly train the image and text encoders to learn an aligned cross-modal embedding space.<\/p>\n<p>Formally, for the image-text retrieval task, we denote the training set as \\({{{{{{{\\mathcal{D}}}}}}}}=\\{({x}_{i}^{(i)},{x}_{i}^{(t)})| i=1,\\cdots \\,,N\\}\\), where \\(({x}_{i}^{(i)},{x}_{i}^{(t)})\\) is a matched image-text pair, and N is the size of \\({{{{{{{\\mathcal{D}}}}}}}}\\). Our BriVL leverages contrastive learning by applying MoCo<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 29\" title=\"He, K., Fan, H., Wu, Y., Xie, S. &amp; Girshick, R. Momentum contrast for unsupervised visual representation learning. In IEEE Conference on Computer Vision and Pattern Recognition, 9729&#x2013;9738 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR29\" id=\"ref-link-section-d79362424e1478\" rel=\"nofollow noopener\" target=\"_blank\">29<\/a> into the cross-modal scenario, as illustrated in Supplementary Note Fig. S<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>a. Each image \\({x}_{i}^{(i)}\\) (or each text \\({x}_{i}^{(t)}\\)) is encoded by the image encoder f(i) (or the text encoder f(t)) to obtain its d-dimensional embedding \\({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(i)}\\) (or \\({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(t)}\\)). The image encoder (see Supplementary Note Fig. S<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>b) contains a CNN backbone, a successive self-attention (SA) block, and a multi-layer perceptron (MLP). A sequence of patch embeddings are first obtained by applying multi-scale patch pooling (MSPP) to the feature map from CNN. They are then fused\/encoded by the SA block. The text encoder, on the other hand, is stacked by several SA blocks such as BERT<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 51\" title=\"Devlin, J., Chang, M.-W., Lee, K. &amp; Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language understanding. In Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 4171&#x2013;4186 (2019).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR51\" id=\"ref-link-section-d79362424e1683\" rel=\"nofollow noopener\" target=\"_blank\">51<\/a> and RoBERTa<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 4\" title=\"Liu, Y. et al. RoBERTa: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692 (2019).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR4\" id=\"ref-link-section-d79362424e1687\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>. A two-layer MLP block with a ReLU<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 55\" title=\"Nair, V. &amp; Hinton, G. E. Rectified linear units improve restricted boltzmann machines. In International Conference on Machine Learning, 807&#x2013;814 (2010).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR55\" id=\"ref-link-section-d79362424e1692\" rel=\"nofollow noopener\" target=\"_blank\">55<\/a> activation layer is used for mapping each encoder\u2019s representation into the joint cross-modal embedding space. The parameters of f(i) and f(t) are denoted as \u03b8(i) and \u03b8(t), respectively.<\/p>\n<p>Image encoder<\/p>\n<p>To obtain better performance in the image-text retrieval task, most previous methods<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Wu, Y., Wang, S., Song, G. &amp; Huang, Q. Learning fragment self-attention embeddings for image-text matching. In ACM International Conference on Multimedia, 2088&#x2013;2096 (2019).\" href=\"#ref-CR19\" id=\"ref-link-section-d79362424e1737\">19<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Chen, H. et al. Imram: Iterative matching with recurrent attention memory for cross-modal image-text retrieval. In IEEE Conference on Computer Vision and Pattern Recognition, 12655&#x2013;12663 (2020).\" href=\"#ref-CR20\" id=\"ref-link-section-d79362424e1737_1\">20<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 21\" title=\"Diao, H., Zhang, Y., Ma, L. &amp; Lu, H. Similarity reasoning and filtration for image-text matching. In AAAI Conference on Artificial Intelligence, 1218&#x2013;1226 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR21\" id=\"ref-link-section-d79362424e1740\" rel=\"nofollow noopener\" target=\"_blank\">21<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 56\" title=\"Wei, X., Zhang, T., Li, Y., Zhang, Y. &amp; Wu, F. Multi-modality cross attention network for image and sentence matching. In IEEE Conference on Computer Vision and Pattern Recognition, 10941&#x2013;10950 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR56\" id=\"ref-link-section-d79362424e1743\" rel=\"nofollow noopener\" target=\"_blank\">56<\/a> utilize a bottom-up attention mechanism<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 57\" title=\"Anderson, P. et al. Bottom-up and top-down attention for image captioning and visual question answering. In IEEE Conference on Computer Vision and Pattern Recognition, 6077&#x2013;6086 (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR57\" id=\"ref-link-section-d79362424e1747\" rel=\"nofollow noopener\" target=\"_blank\">57<\/a> with object features extracted by the Faster R-CNN detector<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 58\" title=\"Ren, S., He, K., Girshick, R. B. &amp; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems, 91&#x2013;99 (2015).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR58\" id=\"ref-link-section-d79362424e1751\" rel=\"nofollow noopener\" target=\"_blank\">58<\/a>. However, extracting region\/object features with a heavy detector is computationally expensive, e.g., a Faster R-CNN detector typically costs 0.064s (15.6 fps) to extract fine-grained region information from an image of moderate size. Meanwhile, the image-text retrieval would be inevitably limited by the detector\u2019s performance, which is not adaptable to real-world applications. In this paper, we thus introduce a simple yet effective module named Multi-Scale Patch Pooling (MSPP) to address this problem.<\/p>\n<p>For each input image x(i), we first split it into multiple patches at different scales and record the patch coordinates. In all experiments, we take two scales as 1\u2009\u00d7\u20091 and 6\u2009\u00d7\u20096, resulting in a total of 37 patches. Next, we project each set of patch coordinates onto the feature map that is obtained by the CNN backbone (e.g., EfficientNet<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 43\" title=\"Tan, M. &amp; Le, Q. EfficientNet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, 6105&#x2013;6114 (2019).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR43\" id=\"ref-link-section-d79362424e1766\" rel=\"nofollow noopener\" target=\"_blank\">43<\/a>) and generate a sequence of 37 region feature maps. Finally, we apply average pooling to each region feature map and obtain a sequence of patch features \\({{{{{{{\\bf{S}}}}}}}}\\in {{\\mathbb{R}}}^{c\\times {N}_{p}}\\), where each column corresponds to a patch, Np is the number of patches (i.e., Np\u2009=\u200937 in this paper), and c is the number of channels in the feature map.<\/p>\n<p>To better capture the relationship of image patch features, we deploy a self-attention (SA) block containing multiple Transformer<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 52\" title=\"Vaswani, A. et al. Attention is all you need. In Advances in Neural Information Processing Systems, 5998&#x2013;6008 (2017).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR52\" id=\"ref-link-section-d79362424e1839\" rel=\"nofollow noopener\" target=\"_blank\">52<\/a> encoder layers. Each Transformer encoder layer consists of a multi-head attention (MultiHeadAttn) layer and a feed forward network (FFN) layer:<\/p>\n<p>$${{{{{{{\\bf{S}}}}}}}}^{\\prime} ={{{{{{{\\rm{LayerNorm}}}}}}}}({{{{{{{\\bf{S}}}}}}}}+{{{{{{{\\rm{MultiHeadAttn}}}}}}}}({{{{{{{\\bf{S}}}}}}}}))$$<\/p>\n<p>\n                    (1)\n                <\/p>\n<p>$${{{{{{{\\bf{S}}}}}}}}={{{{{{{\\rm{LayerNorm}}}}}}}}({{{{{{{\\bf{S}}}}}}}}^{\\prime} +{{{{{{{\\rm{FFN}}}}}}}}({{{{{{{\\bf{S}}}}}}}}^{\\prime} )).$$<\/p>\n<p>\n                    (2)\n                <\/p>\n<p>We then fuse the extracted patch features by applying an average pooling layer:<\/p>\n<p>$${{{{{{{{\\bf{r}}}}}}}}}^{(i)}=\\frac{1}{{N}_{p}}\\mathop{\\sum }\\limits_{j=1}^{{N}_{p}}{{{{{{{{\\bf{S}}}}}}}}}_{j}\\in {{\\mathbb{R}}}^{c},$$<\/p>\n<p>\n                    (3)\n                <\/p>\n<p>where Sj is the j-th column of S. A two-layer MLP block with a ReLU activation layer is adopted to project r(i) to the joint cross-modal embedding space, resulting in the final d-dimensional image embedding \\({{{{{{{{\\bf{z}}}}}}}}}^{(i)}\\in {{\\mathbb{R}}}^{d}\\).<\/p>\n<p>Text encoder<\/p>\n<p>Given a sentence x(t), we first tokenize it to obtain a sequence of tokens \\({{{{{{{\\mathcal{T}}}}}}}}=\\{{{{{{{{{\\bf{t}}}}}}}}}_{j}| j=1,&#8230;,l\\}\\), where l denotes the length of the sentence (e.g., the number of words) and tj denotes the j-th token of \\({{{{{{{\\mathcal{T}}}}}}}}\\). A pre-trained Transformer encoder (e.g., RoBERTa<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 42\" title=\"Cui, Y. et al. Revisiting pre-trained models for chinese natural language processing. In Conference on Empirical Methods in Natural Language Processing: Findings, 657&#x2013;668 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR42\" id=\"ref-link-section-d79362424e2323\" rel=\"nofollow noopener\" target=\"_blank\">42<\/a>) is then used to map text tokens to a sequence of feature vectors (each feature vector corresponds to a word). Similarly, to better capture the relationship between words, we use the same self-attention mechanism as in the image encoder to extract the text representation r(t). A two-layer MLP block with a ReLU activation layer is also used for mapping the text representation r(t) to the joint cross-modal embedding space, resulting in the final d-dimensional text embedding \\({{{{{{{{\\bf{z}}}}}}}}}^{(t)}\\in {{\\mathbb{R}}}^{d}\\).<\/p>\n<p>Contrastive loss<\/p>\n<p>The cross-modal contrastive loss in our BriVL is defined based on MoCo<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 29\" title=\"He, K., Fan, H., Wu, Y., Xie, S. &amp; Girshick, R. Momentum contrast for unsupervised visual representation learning. In IEEE Conference on Computer Vision and Pattern Recognition, 9729&#x2013;9738 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR29\" id=\"ref-link-section-d79362424e2411\" rel=\"nofollow noopener\" target=\"_blank\">29<\/a>, which provides a mechanism of building dynamic sample queues for contrastive learning. Since the two negative queues used in our BriVL decouple the queue size from the mini-batch size, we can have a much larger negative sample size than the mini-batch size (thus GPU-resource-saving).<\/p>\n<p>To maintain large queues of samples coming from different mini-batches and address the problem that sample features are extracted by encoders with very different parameters, we need two more smoothly updated encoders, that is, momentum encoders. The parameters \\({\\theta }_{m}^{(i)}\\) (or \\({\\theta }_{m}^{(t)}\\)) of the momentum image encoder \\({f}_{m}^{(i)}\\) (or the momentum text encoder \\({f}_{m}^{(t)}\\)) are updated in each training iteration with a momentum hyper-parameter m:<\/p>\n<p>$${\\theta }_{m}^{(i)}=m\\cdot {\\theta }_{m}^{(i)}+(1-m)\\cdot {\\theta }^{(i)},$$<\/p>\n<p>\n                    (4)\n                <\/p>\n<p>$${\\theta }_{m}^{(t)}=m\\cdot {\\theta }_{m}^{(t)}+(1-m)\\cdot {\\theta }^{(t)}.$$<\/p>\n<p>\n                    (5)\n                <\/p>\n<p>Further, we maintain two negative sample queues \\({{{{{{{{\\mathcal{Q}}}}}}}}}^{(i)}\\) and \\({{{{{{{{\\mathcal{Q}}}}}}}}}^{(t)}\\), which contain Nq image negatives and Nq text negatives for contrastive learning, respectively. In each pre-training iteration with the batch size Nb, all Nb image negatives and Nb text negatives are separately pushed into these two queues. Meanwhile, there are Nb earliest samples being popped out of each queue. Concretely, at iteration t, the image and text negatives from the current data batch \\(({{{{{{{{\\mathcal{B}}}}}}}}}_{t}^{(i)},{{{{{{{{\\mathcal{B}}}}}}}}}_{t}^{(t)})\\) are computed by respectively forwarding the momentum encoders \\({f}_{m}^{(i)}\\) and \\({f}_{m}^{(t)}\\):<\/p>\n<p>$${{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(i)}=\\left\\{{f}_{m}^{(i)}({x}_{i}^{(i)})| {x}_{i}^{(i)}\\in {{{{{{{{\\mathcal{B}}}}}}}}}_{t}^{(i)}\\right\\},$$<\/p>\n<p>\n                    (6)\n                <\/p>\n<p>$${{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(t)}=\\left\\{{f}_{m}^{(t)}({x}_{i}^{(t)})| {x}_{i}^{(t)}\\in {{{{{{{{\\mathcal{B}}}}}}}}}_{t}^{(t)}\\right\\},$$<\/p>\n<p>\n                    (7)\n                <\/p>\n<p>where \\(| {{{{{{{{\\mathcal{B}}}}}}}}}_{t}^{(i)}| =| {{{{{{{{\\mathcal{B}}}}}}}}}_{t}^{(t)}| ={N}_{b}\\). The obtained \\({{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(i)}\\) and \\({{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(t)}\\) are then pushed into \\({{{{{{{{\\mathcal{Q}}}}}}}}}^{(i)}\\) and \\({{{{{{{{\\mathcal{Q}}}}}}}}}^{(t)}\\), respectively. Note that although we generally call \\({{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(i)}\\) (or \\({{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(t)}\\)) image negatives (or text negatives), there is still one sample being positive to each text (or image). Here, we denote the positive image sample (or text sample) for the j-th input text \\({x}_{j}^{(t)}\\) (or the j-th input image \\({x}_{j}^{(i)}\\)) of the current mini-batch as:<\/p>\n<p>$${{{{{{{{\\bf{p}}}}}}}}}_{j}^{(i)}={f}_{m}^{(i)}({x}_{j}^{(i)})\\in {{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(i)},$$<\/p>\n<p>\n                    (8)\n                <\/p>\n<p>$${{{{{{{{\\bf{p}}}}}}}}}_{j}^{(t)}={f}_{m}^{(t)}({x}_{j}^{(t)})\\in {{{{{{{{\\mathcal{N}}}}}}}}}_{t}^{(t)}.$$<\/p>\n<p>\n                    (9)\n                <\/p>\n<p>With the two negative queues, the loss function in each training iteration is thus computed as follows. For each input image \\({x}_{i}^{(i)}\\), we define the contrastive loss between its image embedding \\({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(i)}\\) and all positive\/negative texts in the queue \\({{{{{{{{\\mathcal{Q}}}}}}}}}^{(t)}\\) as an InfoNCE loss<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 23\" title=\"Oord, A. v. d., Li, Y. &amp; Vinyals, O. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748 (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR23\" id=\"ref-link-section-d79362424e4399\" rel=\"nofollow noopener\" target=\"_blank\">23<\/a>:<\/p>\n<p>$${{{{{{{{\\mathcal{L}}}}}}}}}_{i2t}=-\\frac{1}{{N}_{b}}\\mathop{\\sum }\\limits_{i}^{{N}_{b}}\\log \\frac{\\exp \\left({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(i)}\\cdot {{{{{{{{\\bf{p}}}}}}}}}_{i}^{(t)}\/\\tau \\right)}{\\exp \\left({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(i)}\\cdot {{{{{{{{\\bf{p}}}}}}}}}_{i}^{(t)}\/\\tau \\right)+\\mathop{\\sum}\\limits_{{{{{{{{{\\bf{n}}}}}}}}}^{(t)}}\\exp \\left({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(i)}\\cdot {{{{{{{{\\bf{n}}}}}}}}}^{(t)}\/\\tau \\right)},$$<\/p>\n<p>\n                    (10)\n                <\/p>\n<p>where \\({{{{{{{{\\bf{n}}}}}}}}}^{(t)}\\in {{{{{{{{\\mathcal{Q}}}}}}}}}^{(t)}\\setminus \\{{{{{{{{{\\bf{p}}}}}}}}}_{i}^{(t)}\\}\\) denotes a text negative for each image, \u03c4 is the temperature hyper-parameter, and the vector similarity is measured by dot product (\u22c5). Similarly, for each input text \\({x}_{i}^{(t)}\\), the InfoNCE loss is given by:<\/p>\n<p>$${{{{{{{{\\mathcal{L}}}}}}}}}_{t2i}=-\\frac{1}{{N}_{b}}\\mathop{\\sum }\\limits_{i}^{{N}_{b}}\\log \\frac{\\exp \\left({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(t)}\\cdot {{{{{{{{\\bf{p}}}}}}}}}_{i}^{(i)}\/\\tau \\right)}{\\exp \\left({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(t)}\\cdot {{{{{{{{\\bf{p}}}}}}}}}_{i}^{(i)}\/\\tau \\right)+\\mathop{\\sum}\\limits_{{{{{{{{{\\bf{n}}}}}}}}}^{(i)}}\\exp \\left({{{{{{{{\\bf{z}}}}}}}}}_{i}^{(t)}\\cdot {{{{{{{{\\bf{n}}}}}}}}}^{(i)}\/\\tau \\right)},$$<\/p>\n<p>\n                    (11)\n                <\/p>\n<p>where \\({{{{{{{{\\bf{n}}}}}}}}}^{(i)}\\in {{{{{{{{\\mathcal{Q}}}}}}}}}^{(i)}\\setminus \\{{{{{{{{{\\bf{p}}}}}}}}}_{i}^{(i)}\\}\\) denotes an image negative for each text.<\/p>\n<p>The total loss function for pre-training our BriVL is then defined as:<\/p>\n<p>$${{{{{{{{\\mathcal{L}}}}}}}}}_{total}={{{{{{{{\\mathcal{L}}}}}}}}}_{i2t}+{{{{{{{{\\mathcal{L}}}}}}}}}_{t2i}.$$<\/p>\n<p>\n                    (12)\n                <\/p>\n<p>In the test\/evaluation stage, given each query image (or text), the cross-modal retrieval results are obtained simply by the dot product defined over the outputs of the text (or image) encoder.<\/p>\n<p>Implementation details<\/p>\n<p>Over the input images, we adopt random graying and random color jittering for data augmentation. All images are resized to 600\u2009\u00d7\u2009600 pixels. We adopt EfficientNet-B7<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 43\" title=\"Tan, M. &amp; Le, Q. EfficientNet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, 6105&#x2013;6114 (2019).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR43\" id=\"ref-link-section-d79362424e5482\" rel=\"nofollow noopener\" target=\"_blank\">43<\/a> as the CNN backbone in the image encoder and RoBERTa-Large<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 42\" title=\"Cui, Y. et al. Revisiting pre-trained models for chinese natural language processing. In Conference on Empirical Methods in Natural Language Processing: Findings, 657&#x2013;668 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR42\" id=\"ref-link-section-d79362424e5486\" rel=\"nofollow noopener\" target=\"_blank\">42<\/a> as the basis Transformer in the text encoder. For both image and text encoders, the self-attention block consists of 4 Transformer encoder layers and the MLP block has two fully-connected layers with a ReLU activation layer. The final embedding size of the joint cross-modal space is 2,560. We select the hyper-parameters heuristically for pre-training our BriVL model due to the computational constraint: the temperature hyper-parameter \u03c4\u2009=\u20090.07, momentum m\u2009=\u20090.99, and the queue size Nq\u2009=\u200913,\u2009440. We adopt the Adam optimizer<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 59\" title=\"Kingma, D. P. &amp; Ba, J. Adam: A method for stochastic optimization. In International Conference on Learning Representations (2015).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR59\" id=\"ref-link-section-d79362424e5503\" rel=\"nofollow noopener\" target=\"_blank\">59<\/a>, with the weight decay 1e-5 and the learning rate 1e-4. We use a mini-batch size of 192 for each of the 14 machines (each machine has 8 NVIDIA A100 GPUs), resulting in a total batch size of 2688 (far smaller than Nq). The resource-saving advantages of such batch setting are shown by the ablation study results in Supplementary Note Fig. S<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>. We also deploy the latest distributed-training framework DeepSpeed<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 26\" title=\"Rajbhandari, S., Ruwase, O., Rasley, J., Smith, S. &amp; He, Y. Zero-infinity: Breaking the GPU memory wall for extreme scale deep learning. In International Conference for High Performance Computing, Networking, Storage and Analysis (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR26\" id=\"ref-link-section-d79362424e5516\" rel=\"nofollow noopener\" target=\"_blank\">26<\/a> to accelerate the pre-training process and save the GPU memories. With 112 NVIDIA A100 GPUs in total, it takes about 10 days to pre-train our BriVL model over our WSCD of 650 million image-text pairs.<\/p>\n<p>Differences from CLIP\/ALIGN<\/p>\n<p>We have stated two main differences between our BriVL and CLIP\/ALIGN in the Introduction section. Below we give more detailed differences technically. (1) We adopt a four-tower network architecture (see Supplementary Note Fig. S<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>a) for pre-training. By extending the original single-modal contrastive learning (CL) algorithm MoCo<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 29\" title=\"He, K., Fan, H., Wu, Y., Xie, S. &amp; Girshick, R. Momentum contrast for unsupervised visual representation learning. In IEEE Conference on Computer Vision and Pattern Recognition, 9729&#x2013;9738 (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR29\" id=\"ref-link-section-d79362424e5531\" rel=\"nofollow noopener\" target=\"_blank\">29<\/a>, we introduce momentum encoders and negative sample queues for multimodal pre-training in a more GPU-resource-saving way. In contrast, both CLIP and ALIGN employ the standard two-tower architecture, which requires large batch size (thus enough negative samples) to be effective, taking up a mass of GPU memories. (2) We additionally devise a multi-scale patch pooling (MSPP) module (see Supplementary Note Fig. S<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>b) to capture fine-grained image region representations without using object detectors. While CLIP and ALIGN only consider global-level image embeddings, which impedes their ability to learn fine-grained\/local image features.<\/p>\n<p>Formalization of neural network visualization<\/p>\n<p>Neural network visualization is developed to directly show the visual response\/imagination of BriVL w.r.t. the semantic input. Formally, given the pre-trained image and text encoders f(i) and f(t) of BriVL, we first input a piece of text x(t) and obtain its text embedding \\({{{{{{{{\\bf{z}}}}}}}}}^{(t)}={f}^{(t)}({x}^{(t)})\\in {{\\mathbb{R}}}^{d}\\). In the mean time, we randomly initialize a noisy image \\({x}^{(i)}\\in {{\\mathbb{R}}}^{600\\times 600\\times 3}\\), which contains all the learnable parameters throughout the entire visualization process. Further, we obtain the image embedding \\({{{{{{{{\\bf{z}}}}}}}}}^{(i)}={f}^{(i)}({x}^{(i)})\\in {{\\mathbb{R}}}^{d}\\) and define the learning objective by matching the two embeddings:<\/p>\n<p>$${{{{{{{{\\mathcal{L}}}}}}}}}_{vis}=-\\cos \\left({{{{{{{{\\bf{z}}}}}}}}}^{(i)},{{{{{{{{\\bf{z}}}}}}}}}^{(t)}\\right),$$<\/p>\n<p>\n                    (13)\n                <\/p>\n<p>where \\(\\cos (\\cdot ,\\cdot )\\) computes the cosine similarity between two vectors. With the resultant gradients, we are able to update the input image x(i) by back-propagation. After repeating the above updating step with multiple iterations, we finally obtain an image x(i), which can be regarded as BriVL\u2019s response\/imagination about the input text. The algorithm for neural network visualization is summarized in Algorithm 1.<\/p>\n<p>                  Algorithm 1<\/p>\n<p>Neural Network Visualization<\/p>\n<p>Input: The pre-trained image and text encoder f(i) and f(t) of our BriVL<\/p>\n<p>\u2003\u2003\u2003A piece of text x(t)<\/p>\n<p>\u2003\u2003\u2003A randomly initialized image x(i)<\/p>\n<p>\u2003\u2003\u2003A learning rate parameter \u03bb<\/p>\n<p>Output: The updated input image<\/p>\n<p>1: Obtain the text embedding z(t)\u2009=\u2009f(t)(x(t));<\/p>\n<p>2: for all iteration = 1, 2,\u2009\u22ef\u2009\u2009, MaxIteration do<\/p>\n<p>3: \u2003\u2003\u2003Obtain the image embedding z(i)\u2009=\u2009f(i)(x(i));<\/p>\n<p>4: \u2003\u2003\u2003Compute \\({{{{{{{{\\mathcal{L}}}}}}}}}_{vis}\\) with Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#Equ13\" rel=\"nofollow noopener\" target=\"_blank\">13<\/a>);<\/p>\n<p>5: \u2003\u2003\u2003Compute the gradients \\({\\nabla }_{{x}^{(i)}}{{{{{{{{\\mathcal{L}}}}}}}}}_{vis}\\);<\/p>\n<p>6: \u2003\u2003\u2003Update x(i) using gradient descent with \u03bb;<\/p>\n<p>7: end for<\/p>\n<p>8: return the updated input image.<\/p>\n<p>                Formalization of text-to-image generation<\/p>\n<p>To make BriVL\u2019s response\/imagination on input texts better understood, we further adopt VQGAN<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 34\" title=\"Esser, P., Rombach, R. &amp; Ommer, B. Taming transformers for high-resolution image synthesis. In IEEE Conference on Computer Vision and Pattern Recognition, 12873&#x2013;12883 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR34\" id=\"ref-link-section-d79362424e6284\" rel=\"nofollow noopener\" target=\"_blank\">34<\/a> to help generate more photo-realistic images. The reason of utilizing VQGAN instead of other GANs<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 60\" title=\"Goodfellow, I. J. et al. Generative adversarial nets. In Advances in Neural Information Processing Systems, 2672&#x2013;2680 (2014).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR60\" id=\"ref-link-section-d79362424e6288\" rel=\"nofollow noopener\" target=\"_blank\">60<\/a> is as follows. Although classic GANs are able to generate high quality images under specific domains (e.g., natural sceneries or human faces), they tend to fail when complex scenarios are involved. In contrast, VQGAN alleviates this problem and performs better under complex scenarios by combining VQVAE<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 61\" title=\"van den Oord, A., Vinyals, O. &amp; Kavukcuoglu, K. Neural discrete representation learning. In Advances in Neural Information Processing Systems, 6306&#x2013;6315 (2017).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR61\" id=\"ref-link-section-d79362424e6292\" rel=\"nofollow noopener\" target=\"_blank\">61<\/a> and GAN. For our text-to-image generation, we only need a codebook \\({{{{{{{\\mathcal{C}}}}}}}}\\) and a CNN generator g of the VQGAN pre-trained on ILSVRC-2012<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 35\" title=\"Russakovsky, O. et al. ImageNet large scale visual recognition challenge. Int. J. Comput. Vision 115, 211&#x2013;252 (2015).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR35\" id=\"ref-link-section-d79362424e6318\" rel=\"nofollow noopener\" target=\"_blank\">35<\/a>. The pre-trained codebook \\({{{{{{{\\mathcal{C}}}}}}}}=\\{{{{{{{{{\\bf{c}}}}}}}}}_{k}\\in {{\\mathbb{R}}}^{{d}_{c}}| k=1,2,\\cdots ,{N}_{c}\\}\\) is a collection of tokens\/codes, where dc is the dimension of each code and Nc is the number of codes in the codebook (dc\u2009=\u2009256 and Nc\u2009=\u20091,\u2009024 in our case). The pre-trained CNN generator g takes a spatial collection of codebook entries \\({{{{{{{\\bf{U}}}}}}}}\\in {{\\mathbb{R}}}^{h\\times w\\times {d}_{c}}\\) as input to generate an image (U can also be regarded as a sequence of hw codes, h\u2009=\u2009w\u2009=\u200916 in our case), where each element \\({{{{{{{{\\bf{u}}}}}}}}}_{ij}\\in {{\\mathbb{R}}}^{{d}_{c}}\\) (i\u2009=\u20091,\u20092,\u2009\\(\\cdots,\\)\u2009h and j\u2009=\u20091,\u20092,\u2009\\(\\cdots,\\)\u2009w) must come from the codebook \\({{{{{{{\\mathcal{C}}}}}}}}\\) (i.e., \\({{{{{{{{\\bf{u}}}}}}}}}_{ij}\\in {{{{{{{\\mathcal{C}}}}}}}}\\)). With the pre-trained image and text encoders f(i) and f(t) of BriVL, we first input a piece of text x(t) and obtain its text embedding \\({{{{{{{{\\bf{z}}}}}}}}}^{(t)}={f}^{(t)}({x}^{(t)})\\in {{\\mathbb{R}}}^{d}\\). Meanwhile, we randomly initialize an input code collection U, which is the only parameter matrix to be learned. Afterwards, we generate an image from the generator x(i)\u2009=\u2009g(U) and further obtain its image embedding \\({{{{{{{{\\bf{z}}}}}}}}}^{(i)}={f}^{(i)}({x}^{(i)})\\in {{\\mathbb{R}}}^{d}\\). The learning objective is to maximize the similarity between two embeddings:<\/p>\n<p>$${{{{{{{{\\mathcal{L}}}}}}}}}_{t2i}=-\\cos \\left({{{{{{{{\\bf{z}}}}}}}}}^{(i)},{{{{{{{{\\bf{z}}}}}}}}}^{(t)}\\right).$$<\/p>\n<p>\n                    (14)\n                <\/p>\n<p>After updating the input U and obtaining \\({{{{{{{\\bf{U}}}}}}}}^{\\prime}\\) by back-propagation, we need to perform an element-wise quantization of each spatial code \\({{{{{{{{\\bf{u}}}}}}}}}_{ij}^{\\prime}\\in {{\\mathbb{R}}}^{{d}_{c}}\\) in \\({{{{{{{\\bf{U}}}}}}}}^{\\prime}\\) onto its closest codebook entry ck:<\/p>\n<p>$${{{{{{{{\\bf{u}}}}}}}}}_{ij}=\\arg \\mathop{\\min }\\limits_{{{{{{{{{\\bf{c}}}}}}}}}_{k}\\in {{{{{{{\\mathcal{C}}}}}}}}}{\\parallel} {{{{{{{{\\bf{u}}}}}}}}}_{ij}^{\\prime}-{{{{{{{{\\bf{c}}}}}}}}}_{k}{\\parallel} .$$<\/p>\n<p>\n                    (15)\n                <\/p>\n<p>By repeating the above updating step with multiple iterations, we finally obtain an image x(i) generated with the updated U. The algorithm for text-to-image generation is summarized in Algorithm 2.<\/p>\n<p>                  Algorithm 2<\/p>\n<p>Text-to-Image Generation<\/p>\n<p>Input: The pre-trained image and text encoder f(i) and f(t) of our BriVL<\/p>\n<p>\u2003\u2003\u2003The codebook \\({{{{{{{\\mathcal{C}}}}}}}}\\) and the CNN generator g of the pre-trained VQGAN<\/p>\n<p>\u2003\u2003\u2003A piece of text x(t)<\/p>\n<p>\u2003\u2003\u2003A randomly initialized collection of codebook entries U<\/p>\n<p>\u2003\u2003\u2003A learning rate parameter \u03bb<\/p>\n<p>Output: The image generated with the updated U<\/p>\n<p>1: Obtain the text embedding z(t)\u2009=\u2009f(t)(x(t));<\/p>\n<p>2: for all iteration = 1, 2,\u2009\u22ef\u2009\u2009, MaxIteration do<\/p>\n<p>3:\u2003\u2003\u2003Generate an image x(i)\u2009=\u2009g(U);<\/p>\n<p>4:\u2003\u2003\u2003Obtain the image embedding z(i)\u2009=\u2009f(i)(x(i));<\/p>\n<p>5:\u2003\u2003\u2003Compute \\({{{{{{{{\\mathcal{L}}}}}}}}}_{t2i}\\) with Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#Equ14\" rel=\"nofollow noopener\" target=\"_blank\">14<\/a>);<\/p>\n<p>6:\u2003\u2003\u2003Compute the gradients \\({\\nabla }_{{{{{{{{\\bf{U}}}}}}}}}{{{{{{{{\\mathcal{L}}}}}}}}}_{t2i}\\);<\/p>\n<p>7:\u2003\u2003\u2003Obtain \\({{{{{{{\\bf{U}}}}}}}}^{\\prime}\\) by updating U using gradient descent with \u03bb;<\/p>\n<p>8:\u2003\u2003\u2003Obtain U by performing element-wise quantization on \\({{{{{{{\\bf{U}}}}}}}}^{\\prime}\\) with Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#Equ15\" rel=\"nofollow noopener\" target=\"_blank\">15<\/a>);<\/p>\n<p>9: \u00a0end for<\/p>\n<p>10: return the image generated with the updated U.<\/p>\n<p>                Neural network visualization vs. text-to-image generation<\/p>\n<p>The intrinsic difference between neural network visualization and text-to-image generation lies in that they produce images following different data distributions. Not utilizing extra modules or data, neural network visualization exhibits BriVL\u2019s primitive visual understanding of a given piece of text. However, the VQGAN<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 34\" title=\"Esser, P., Rombach, R. &amp; Ommer, B. Taming transformers for high-resolution image synthesis. In IEEE Conference on Computer Vision and Pattern Recognition, 12873&#x2013;12883 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR34\" id=\"ref-link-section-d79362424e7690\" rel=\"nofollow noopener\" target=\"_blank\">34<\/a> used for text-to-image generation is pre-trained on ILSVRC-2012<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 35\" title=\"Russakovsky, O. et al. ImageNet large scale visual recognition challenge. Int. J. Comput. Vision 115, 211&#x2013;252 (2015).\" href=\"http:\/\/www.nature.com\/articles\/s41467-022-30761-2#ref-CR35\" id=\"ref-link-section-d79362424e7694\" rel=\"nofollow noopener\" target=\"_blank\">35<\/a> (i.e., the classic ImageNet dataset), which generates images following the data distribution of ImageNet and thus being more photo-realistic. Due to such an intrinsic difference, we present the visualization results of these two tasks for different purposes in this paper. Specifically, neural network visualization allows us to see what exactly a pre-trained multi-modal foundation model imagines about semantic concepts and sentences, while text-to-image generation is used to generate images matched with given texts in a more human-friendly way.<\/p>\n","protected":false},"excerpt":{"rendered":"Architecture overview The notion of pre-training a large-scale machine learning model and then using it for downstream tasks&hellip;\n","protected":false},"author":2,"featured_media":218571,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[6744,3013,1632,1633,1743,100152,1744,160],"class_list":["post-218570","post","type-post","status-publish","format-standard","has-post-thumbnail","category-agi","tag-agi","tag-artificial-general-intelligence","tag-computational-science","tag-computer-science","tag-humanities-and-social-sciences","tag-learning-algorithms","tag-multidisciplinary","tag-science"],"_links":{"self":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts\/218570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/comments?post=218570"}],"version-history":[{"count":0,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts\/218570\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/media\/218571"}],"wp:attachment":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/media?parent=218570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/categories?post=218570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/tags?post=218570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}