<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Viet Nguyen</title>
<link>https://quocviethere.github.io/blog.html</link>
<atom:link href="https://quocviethere.github.io/blog.xml" rel="self" type="application/rss+xml"/>
<description></description>
<generator>quarto-1.10.18</generator>
<lastBuildDate>Tue, 04 Feb 2025 15:00:00 GMT</lastBuildDate>
<item>
  <title>A Data-Centric Analysis of Vision-Language Models (VLMs)</title>
  <link>https://quocviethere.github.io/blogs/vlmdata.html</link>
  <description><![CDATA[ 





<p>Learning with multiple modalities have been proved to be better than with just a subset of modalities in terms of minimizing the population risk due to the fact that multimodal learning can better estimate the latent space representation <span class="citation" data-cites="huang2021what">[1]</span>. Despite the recent unprecendented progress in developing multimodal models, little analysis is done regarding the dataset used. The role of high-quality (and massive) datasets is indispensible in training capable VLMs. Hu et al.&nbsp;(2024) <span class="citation" data-cites="metaclip">[2]</span>, for example, state that data is the main factor leading to CLIP success rather than the model architecture or pre-training objective. Other research <span class="citation" data-cites="dfn">[3]</span> has demonstrated that a small contrastive image-text model trained exclusively on high-quality data is enough to build SOTA models.</p>
<p>While many surveys on VLMs have been conducted <span class="citation" data-cites="vlm-survey1 nguyen2024videolanguage vlm-survey2 vlm-survey3 vlm-survey4">[4–8]</span>, few specifically focus on datasets. Given the crucial role of data in shaping model performance, this post explores the VLM data landscape, covering key aspects such as data curation, different data formats (image-text pairs vs.&nbsp;interleaved data), data filtering methods ,and the rise of synthetic data.</p>
<section id="data-curation" class="level1">
<h1><strong>Data Curation</strong></h1>
<section id="image-text-pair-data" class="level2">
<h2 class="anchored" data-anchor-id="image-text-pair-data">Image-text pair data</h2>
<p>Prior to CLIP, most image-text data are created by combining different subsets of other publicly available image captioning datasets such as COCO <span class="citation" data-cites="coco">[9]</span>, Visual Genome (VG) <span class="citation" data-cites="vg">[10]</span>, and SBU captions <span class="citation" data-cites="sbu">[11]</span>. Such curation method benefits from the high-quality human-labeled datasets. However, this kind of data is often limited in around hundreds of thousands image-text pairs due to the expensive labeling cost.</p>
<p>Contrary to these methods, CLIP <span class="citation" data-cites="clip">[12]</span> propose crawling images and their associated text by querying 500,000 words occurring at least 100 times in the English version of Wikipedia, obtaining a 400M-sample image-text pair data dubbed <strong>WebImageText (WIT)</strong>. Figure&nbsp;1 illustrates the general trend of dataset sizes scaling up significantly in the <em>Post-CLIP era</em>, although a few hundred-million-image captioning datasets have also been introduced. The largest image-text pair data, as writing date, is Google’s WebLI <span class="citation" data-cites="chen2022pali">[13]</span> with around 10 billions multilingual data samples (10 billions images and 12 billions alt-texts). Furthermore, OCR tools are also used, resulting in an additional 29 billion image-OCR pairs. However, only a subset of 1B filtered data pairs of the WebLI dataset is used to train the PaLI model.</p>
<div id="fig-data1" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-data1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<embed src="../assets/vlmdata/DatasetSize1.html" width="900" height="370">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-data1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Image-text pair dataset size overtime. Drag a region for closer view, double click to zoom back out.
</figcaption>
</figure>
</div>
<p>Table&nbsp;1 depicts the dataset curation and preprocessing/filtering method in more detail. Some preprocessing are left blank because they are not mentioned in the paper regarding how the data is preprocessed, which causes clear issues in terms of reproducibility.</p>
<div id="tbl-data1" class="striped hover quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<div aria-describedby="tbl-data1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="table-striped table-hover table">
<colgroup>
<col style="width: 16%">
<col style="width: 44%">
<col style="width: 38%">
</colgroup>
<thead>
<tr class="header">
<th>Dataset</th>
<th>Curation method</th>
<th>Preprocessing</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>LXMERT</td>
<td>MS COCO + VG + VQAv2 + GQA + VG-QA</td>
<td>Minimal preprocessing</td>
</tr>
<tr class="even">
<td>UNITER</td>
<td>COCO+VG+CC3M+SBU Captions</td>
<td>Deduplicating images</td>
</tr>
<tr class="odd">
<td><strong>CC12M</strong></td>
<td>Images and their raw descriptions obtained from the Alt-text HTML attribute associated with web images.</td>
<td>Image-based and text-based (more relaxed compared to CC3M); image-text–based filtering.</td>
</tr>
<tr class="even">
<td>ALBEF</td>
<td>COCO + VG + CC3M + SBU Captions + CC12M</td>
<td></td>
</tr>
<tr class="odd">
<td>WIT400M (CLIP)</td>
<td>Search for (image, text) pairs whose text includes one of a set of 500,000 words occurring at least 100 times in the English version of Wikipedia.</td>
<td></td>
</tr>
<tr class="even">
<td>WIT</td>
<td>Extracting multiple different texts associated with an image from Wikipedia articles and Wikimedia image links.</td>
<td>Image-based and text-based; image-text–based filtering. Remove NSFW content, keeping only the top 100 languages.</td>
</tr>
<tr class="odd">
<td>ALIGN</td>
<td>Same as CC12M</td>
<td>Simple frequency-based filtering</td>
</tr>
<tr class="even">
<td>FILIP-300M</td>
<td>Image-text pairs collected from the Internet + CC3M + CC12M + YFCC100M</td>
<td>Image-based and text-based; image-text pairs deduplication, YFCC100M filtering rules.</td>
</tr>
<tr class="odd">
<td>Red Caps</td>
<td>Collect data from a manually curated set of subreddits with a high volume of image posts</td>
<td>Image posts filtering and minimal text cleaning</td>
</tr>
<tr class="even">
<td><strong>PMD (FLAVA)</strong></td>
<td>COCO + SBU Captions + Localized Narratives + CC3M + VG + WIT + CC12M + Red Caps + YFCC100M (filtered)</td>
<td>Discard non-English captions and only keeping captions with more than two words</td>
</tr>
<tr class="odd">
<td>LiT</td>
<td>Same as ALIGN</td>
<td>Image-based filtering same as ALIGN, text-based filtering, remove near-duplicate images</td>
</tr>
<tr class="even">
<td><strong>LAION-400M</strong></td>
<td>Parse through WAT files from Common Crawl and parse out all HTML IMG tags containing an alt-text attribute.</td>
<td>Length &amp; Size Filtering, Deduplication, Relevance Filtering (cosine similarity threshold from CLIP embeddings), Illegal Content Filtering</td>
</tr>
<tr class="odd">
<td>FLD-900M (Florence)</td>
<td>Employ a programmatic data curation pipeline that processes around 3 billion Internet images and their raw descriptions.</td>
<td>Image deduplication, small-size image removal, image-text relevance, CLIP sampling strategy</td>
</tr>
<tr class="even">
<td><strong>COYO-700M</strong></td>
<td>Collected about 10 billion pairs of alt-text and image sources in HTML documents in CommonCrawl.</td>
<td>Image-based and text-based; image-text filtering</td>
</tr>
<tr class="odd">
<td>BASIC</td>
<td>Extend ALIGN with 5B image-text pairs from JFT, converting class labels into text sequences.</td>
<td>Text filtering and filter duplicated pairs based on structural similarity index</td>
</tr>
</tbody>
</table>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-tbl" id="tbl-data1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;1: Compilation of different image-text pair datasets. Publicly available datasets are denoted in <strong>bold</strong>.
</figcaption>
</figure>
</div>
<p>The curation methods can roughly be classified into two categories: 1) combining pre-existing image captioning data subsets <span class="citation" data-cites="lxmert">[14]</span>, uniter, albef or 2) crawling from the web with alt-text HTML attribute <span class="citation" data-cites="cc3m cc12m clip coyo-700m align basic florence laion-400m laion-5b srinivasan2021wit">[12, 15–23]</span>.</p>
</section>
<section id="interleaved-image-text-data" class="level2">
<h2 class="anchored" data-anchor-id="interleaved-image-text-data">Interleaved Image-text data</h2>
<p>Along with image-text pair datasets, another kind of dataset that is often used to train VLMs is interleaved image-text pair. An example of the difference between two types of datasets is illustrated in Figure&nbsp;2.</p>
<div id="fig-data2" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-data2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<embed src="../assets/vlmdata/Interleaved.html" width="750" height="370">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-data2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Interleaved image-text dataset size over time. Dataset size measured in terms of number of tokens.
</figcaption>
</figure>
</div>
<p>CM3 <span class="citation" data-cites="cm3">[24]</span> introduce the dataset with 223 billion number of tokens crawled from CC-News and English Wikipidea. For each <code>&lt;img&gt;</code> tag with a valid <code>src</code> URL, the image is downloaded and tokenized with VQVAE-GAN. The tokens are then inserted into the original text, replacing the <code>src</code> attribute. Flamingo <span class="citation" data-cites="flamingo">[25]</span> propose a dataset called M3W, which are text and images extracted from ~43 million webpages. The <img> tags are inserted into the plain text where images appear and adding a learned <eoc> (end of chunk) token before each image and at the end of the document. The total number of tokens of the dataset is not disclosed in the paper.</eoc></p>
<p>Another notable dataset is Facebook’s Chameleon <span class="citation" data-cites="chameleon">[26]</span>, with 400 billion tokens and the filtering process is the same as OBELICS <span class="citation" data-cites="obelics">[27]</span>. Very little detail is provided in the paper.</p>
<p>The dataset used to train CM3, Flamingo, and Chameleon, however, is proprietarty. Attempts to curate open interleaved therefore have been made. OBELICS <span class="citation" data-cites="obelics">[27]</span> is an open interleaved dataset curated from 141 million multimodal English web documents. The final dataset has 115 billion tokens. The overall workflow of OBELICS curation is depicted in Figure&nbsp;3.</p>
<div id="fig-obelics" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-obelics-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/obelics.png" width="750" height="370" class="figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-obelics-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Overall workflow of OBELICS dataset curation. Figure source: Hugo et al.&nbsp;(2023)<span class="citation" data-cites="obelics">[27]</span>
</figcaption>
</figure>
</div>
<p>Another notable interleaved image-text dataset is Multimodal-C4 (MMC4) <span class="citation" data-cites="mmc4">[28]</span>, an extension of the C4 corpus <span class="citation" data-cites="c4">[29]</span>, where images are assigned to sentences using a bipartite linear assignment approach with CLIP ViT-L/14 for alignment. The dataset includes subsets like mmc4-ff (face-filtered) and mmc4-core (strictly filtered), ensuring diverse yet well-aligned image-text sequences. Initial evaluations show effective NSFW/ad removal, strong intra-document alignment, and promising applications, including improving few-shot learning in models like OpenFlamingo.</p>
<p>MINT-1T <span class="citation" data-cites="mint-1t">[30]</span> is a large-scale open-source dataset that aggregates diverse interleaved documents, including PDFs and ArXiv papers (which is untapped in previous dataset curation). It undergoes rigorous filtering, deduplication, and NSFW content removal to ensure high quality. The final dataset comprises 922B HTML tokens, 93B PDF tokens, and 9B ArXiv tokens, totalling around 1 trillion tokens (see Figure&nbsp;4).</p>
<div id="fig-mint1t" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-mint1t-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/mint.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-mint1t-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;4: Comparison of MINT-1T dataset and other interleaved datasets. Figure source: Anas et al.&nbsp;(2024). <span class="citation" data-cites="mint-1t">[30]</span>
</figcaption>
</figure>
</div>
<p>All of the aforementioned datasets, however, apply non-English data sample filtering, restricting it usage to only English. mOSCAR <span class="citation" data-cites="moscar">[31]</span> is the first large-scale multilingual and multimodal document corpus, covering 163 languages, 315M documents, 214B tokens, and 1.2B images. It is sourced from three 2023 Common Crawl dumps, processed using FastWARC, with documents under 500 bytes removed to reduce noise. The dataset is extracted using a depth-first search through the DOM tree, leveraging the ChatNoir library for targeted HTML tag retrieval. Another dataset that contain multiple (two) languages is OmniCorpus <span class="citation" data-cites="omnicorpus">[32]</span>, a 1.7-trillion-token dataset curated from Common Crawl and Chinese websites, making it a bilingual and largest interleaved data to date.</p>
</section>
</section>
<section id="data-filtering" class="level1">
<h1><strong>Data Filtering</strong></h1>
<p>The data filtering process for VLMs can roughly be divided into four different kinds, including (1) image-based filtering, (2) text-based filtering, (3) image-text filtering, and (4) model-based filtering. Different datasets employ different filtering methods, as given in Table&nbsp;1. The first three kinds of filtering are often heuristic and is hand-designed based on a specific set of rules (image resolution/ratio, sequence length, etc), while model-based filtering employs other models, often to extract features for similarity computation. Table&nbsp;2 gives a detailed descriptions of data filtering methods as employed in DataComp.</p>
<div id="tbl-filter" class="striped hover quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<div aria-describedby="tbl-filter-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="table-striped table-hover table">
<colgroup>
<col style="width: 20%">
<col style="width: 80%">
</colgroup>
<thead>
<tr class="header">
<th>Filtering Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Basic Filtering</strong></td>
<td>Selects data based on fundamental criteria such as English captions, specific caption lengths, and minimum image sizes to ensure data quality and relevance.</td>
</tr>
<tr class="even">
<td><strong>CLIP Score Filtering</strong></td>
<td>Utilizes the cosine similarity between CLIP’s image and text embeddings, retaining only examples where the similarity exceeds a predefined threshold, indicating a strong correspondence between image and caption.</td>
</tr>
<tr class="odd">
<td><strong>Text-Based Filtering</strong></td>
<td>Chooses captions that contain words overlapping with ImageNet’s labels, ensuring that the textual descriptions are closely related to recognized object categories.</td>
</tr>
<tr class="even">
<td><strong>Image-Based Filtering</strong></td>
<td>Selects a subset of examples whose visual content overlaps with ImageNet classes, ensuring that the images correspond to known categories and enhancing the relevance of the dataset.</td>
</tr>
</tbody>
</table>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-tbl" id="tbl-filter-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;2: Overview of Different Data Filtering Methods.
</figcaption>
</figure>
</div>
<section id="text-based-filtering" class="level2">
<h2 class="anchored" data-anchor-id="text-based-filtering">Text-based filtering</h2>
<p>In a work by Alex et al.&nbsp;(2024) <span class="citation" data-cites="fang2022data">[33]</span>, the dataset is cleaned using three filtering steps: (i) a bad-word list from the <em>better-profanity</em> library, which automatically excludes most samples (around 14,000) and marks 18 potentially non-profane words for human review; (ii) a <em>profanity-check</em> model using an SVM, which filters 482 samples; and (iii) manual annotation, which removes 114 offensive samples. In total, these steps filter 14,322 samples, approximately 3% of the dataset.</p>
<p>MetaCLIP <span class="citation" data-cites="metaclip">[2]</span> replicates OpenAI CLIP’s data curation by using substring matching to filter low-quality text and structuring unstructured data with metadata. It balances data distribution by capping metadata matches at 20k, reducing noise and enhancing diversity for task-agnostic pre-training. Training on MetaCLIP-400M improves CLIP-ViT-L/14’s zero-shot image classification from 65.7 to 67.1.</p>
</section>
<section id="image-based-filtering" class="level2">
<h2 class="anchored" data-anchor-id="image-based-filtering">Image-based filtering</h2>
<p>Stemming from the observation that LAION-5B has nearly 40% images which contain text that overlaps significantly with the caption, T-MARS <span class="citation" data-cites="tmars">[34]</span> first mask the text in the images and keep only the data points with the highest similarity scores instead of feeding the image-text pair directly into CLIP, as shown in Figure&nbsp;5.</p>
<div id="fig-tmars" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-tmars-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/tmars1.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-tmars-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;5: T-MARS mask the text in the images that overlaps with the captions (left). As we scale the (filtered) data, the accuracy when trained the model on LAION increase (right).
</figcaption>
</figure>
</div>
<p>CAT filtering <span class="citation" data-cites="cat-filter">[35]</span> extends T-MARS by removing image-text pairs where MMOCR detects text with <img src="https://latex.codecogs.com/png.latex?%5Cgeq"> 0.8 confidence and <img src="https://latex.codecogs.com/png.latex?%5Cgeq"> 5 matching characters in a sliding window. It also filters captions based on complexity, defined as the maximum number of relations to any object in the parse graph, and retains only samples with at least C1 complexity. To further exclude pairs likely depicting products, captions are filtered out unless they contain at least one action.</p>
</section>
<section id="model-based-filtering" class="level2">
<h2 class="anchored" data-anchor-id="model-based-filtering">Model-based filtering</h2>
<p>For model-based filtering, an exemplary work is CLIPScore <span class="citation" data-cites="clipscore">[36]</span> that has been widely used for constructing large-scale datasets like COYO-700M and LAION-400M <span class="citation" data-cites="coyo-700m">[17]</span>, laion-400m. The CLIPSCore is defined as the cosine similarity between each pair of image-text CLIP embeddings as follows:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Ctexttt%7BCLIP-S%7D(%5Cmathbf%7Bc,v%7D)%20=%20w%20*%20%5Cmax%20(cos(%5Cmathbf%7Bc,v%7D),0),%0A"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%5Cbf%7Bc%7D"> is the textual embedding, <img src="https://latex.codecogs.com/png.latex?%5Cbf%7Bv%7D"> is the image embedding, and <img src="https://latex.codecogs.com/png.latex?w"> is the scaling factor. One advantage of CLIPScore is that it does not need a reference sample compared to prior captioning metrics like BLEU, ROUGE, or CiDER.</p>
<p>Empirical results from DataComp <span class="citation" data-cites="datacomp">[37]</span> show that in general, for data that is above the medium scale, the filtering strategies that work best is to combine CLIP Score and Image-based filtering. For small scale dataset (1M-3M samples), CLIP Score alone yields the best average performance on 38 different downstream tasks, as shown in Table&nbsp;3.</p>
<div id="tbl-datacomp" class="striped hover quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<div aria-describedby="tbl-datacomp-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="table-striped table-hover table">
<colgroup>
<col style="width: 11%">
<col style="width: 15%">
<col style="width: 10%">
<col style="width: 10%">
<col style="width: 8%">
<col style="width: 13%">
<col style="width: 5%">
<col style="width: 8%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>Scale</th>
<th>Filtering Strategy</th>
<th>Dataset Size</th>
<th>Samples Seen</th>
<th>ImageNet</th>
<th>ImageNet Dist. Shifts</th>
<th>VTAB</th>
<th>Retrieval</th>
<th>Average Over <br> 38 Datasets</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>small</strong></td>
<td>CLIP score</td>
<td>3.8M</td>
<td>12.8M</td>
<td>0.051</td>
<td>0.055</td>
<td>0.190</td>
<td>0.119</td>
<td>0.173</td>
</tr>
<tr class="even">
<td></td>
<td>Image-based <br> ∩ CLIP score</td>
<td>1.4M</td>
<td>12.8M</td>
<td>0.039</td>
<td>0.045</td>
<td>0.162</td>
<td>0.094</td>
<td>0.144</td>
</tr>
<tr class="odd">
<td><strong>medium</strong></td>
<td>CLIP score</td>
<td>38M</td>
<td>128M</td>
<td>0.273</td>
<td>0.230</td>
<td>0.338</td>
<td>0.251</td>
<td>0.328</td>
</tr>
<tr class="even">
<td></td>
<td>Image-based <br>∩ CLIP score</td>
<td>14M</td>
<td>128M</td>
<td>0.297</td>
<td>0.239</td>
<td>0.346</td>
<td>0.231</td>
<td>0.328</td>
</tr>
<tr class="odd">
<td><strong>large</strong></td>
<td>CLIP score</td>
<td>384M</td>
<td>1.28B</td>
<td>0.578</td>
<td>0.474</td>
<td>0.538</td>
<td>0.466</td>
<td>0.529</td>
</tr>
<tr class="even">
<td></td>
<td>Image-based <br> ∩ CLIP score</td>
<td>140M</td>
<td>1.28B</td>
<td>0.631</td>
<td>0.508</td>
<td>0.546</td>
<td>0.498</td>
<td>0.537</td>
</tr>
<tr class="odd">
<td><strong>xlarge</strong></td>
<td>CLIP score</td>
<td>3.8B</td>
<td>12.8B</td>
<td>0.764</td>
<td>0.655</td>
<td>0.643</td>
<td>0.588</td>
<td>0.650</td>
</tr>
<tr class="even">
<td></td>
<td>Image-based <br> ∩ CLIP score</td>
<td>1.4B</td>
<td>12.8B</td>
<td>0.792</td>
<td>0.679</td>
<td>0.652</td>
<td>0.608</td>
<td>0.663</td>
</tr>
</tbody>
</table>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-tbl" id="tbl-datacomp-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;3: Performance Comparison of Different Filtering Strategies Across Dataset Scales and Evaluation Benchmarks.
</figcaption>
</figure>
</div>
<p>MLM-filter <span class="citation" data-cites="wang2024finetuned">[38]</span> propose a three-stage pipeline for data filtering, including 1) fine-tune an MLM for quality assessment, 2) use it to filter high-quality data, 3) pre-train VLMs on the filtered data and evaluate on downstream tasks. However, an important thing to note here is that prior research work <span class="citation" data-cites="dfn">[3]</span> have shown that the quality of a network for filtering is not necessarily correlated with its performance on downstream tasks. Empirical results show that using MLM Filter improves CLIP’s zero-shot performance on the <code>large</code> scale of DataComp benchmark.</p>
<p>Data Filtering Networks (DFNs) <span class="citation" data-cites="dfn">[3]</span> filters image-text pairs based on similarity embeddings. It finds that a DFN’s accuracy on a task doesn’t directly predict its effectiveness in data selection. Training DFNs on high-quality datasets and fine-tuning them improves performance across tasks, even at different data scales. Table 4 table highlights the performance improvements of DFN datasets across different DataComp scales and model architectures, showing consistent gains over other datasets. Notably, DFN-2B and DFN-5B outperform alternatives like LAION-2B and OpenAI WIT-400M, with DFN-5B achieving the highest average score (0.710) when scaled to ViT-H/14-378px.</p>
<div class="quarto-layout-panel" data-layout="[35, 65]">
<div class="quarto-layout-row">
<div id="first-column" class="quarto-layout-cell" style="flex-basis: 35.0%;justify-content: flex-start;">
<p>SemDeDup <span class="citation" data-cites="semdedup">[39]</span> uses CLIP to filter out <i>semantically identical</i> data pairs, showing improved performance on zero-shot image classification with just 63% subset of LAION-400M. SemDeDup detects semantic duplicates in the embedding space, using clustering to make large-scale comparison feasible. Applying it to datasets like LAION reveals that 50% of examples have semantic duplicates, allowing for a 50% reduction in training data with minimal performance loss and 2x faster learning. Figure&nbsp;6 illustrates the effectiveness of SemDeDup on zero-shot and OOD image classification tasks.</p>
</div>
<div id="second-column" class="quarto-layout-cell" style="flex-basis: 65.0%;justify-content: flex-start;">
<div id="fig-semededup" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-semededup-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/semdedup.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-semededup-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;6: Zero-shot and OOD performance comparison of CLIP model trained on 63% of LAION-440M (after SemDeDup) vs.&nbsp;a baseline CLIP trained on 100% of the data (left) and OpenAI CLIP (right) across 30 tasks. Figure source: <a href="https://arxiv.org/abs/2303.09540" target="_blank">Abbas et al.&nbsp;(2023)</a>.
</figcaption>
</figure>
</div>
</div>
</div>
</div>
<p>Given that we already have the high-quality datasets, one question is <em>how useful would these data be as we increase the amount of computation (i.e.&nbsp;training the model for more epochs) ?</em></p>
<div id="fig-compute-ag" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-compute-ag-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/qqt.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-compute-ag-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;7: Impact of Data Filtering and Compute Allocation on Model Performance. The left panel illustrates the heterogeneity of web data and the quality-quantity tradeoff (QQT) in data filtering. The middle panel shows how the best data pools change with total compute availability. The right panel presents estimated scaling curves, highlighting the optimal filtering strategy for different compute scales, where more aggressive filtering benefits smaller compute budgets, while larger compute scales favor less aggressive filtering. Figure source: Goyal et al.&nbsp;(2024) <span class="citation" data-cites="goyal2024science">[40]</span>.
</figcaption>
</figure>
</div>
<p>Goyal et al.&nbsp;(2024) <span class="citation" data-cites="goyal2024science">[40]</span> introduce a scaling law and show that the ultility of high-quality datasets would decrease as we increase the number of epochs, as illustrated in Figure&nbsp;7. In particular, the benefit of data filtering steadily declines as the compute budget increases. Notably, after 450M iterations, training on the unfiltered Common Crawl dataset surpasses that on LAION-filtered data.</p>
</section>
</section>
<section id="synthetic-data" class="level1">
<h1><strong>Synthetic Data</strong></h1>
<div class="quarto-layout-panel" data-layout="[50, 50]">
<div class="quarto-layout-row">
<div id="first-column" class="quarto-layout-cell" style="flex-basis: 50.0%;justify-content: flex-start;">
<p>As the datasets used to train VLMs are becoming bigger, it’s actually becoming non-trivial that we’ll run out of datasets. This creates an urge to ultilize other off-the-self models to create synthetic datasets. This section introduces recent techniques that employ the use of pre-trained models (either LLM or VLM) to synthesize new datasets, forming a bootstrapping procedure to train VLMs. This section outlines current research direction on enriching data for VLM training, from rewriting/generating image captions to image synthesis. We’ll also delve into why and in what case is synthetic data beneficial.</p>
</div>
<div id="second-column" class="quarto-layout-cell" style="flex-basis: 50.0%;justify-content: center;">
<p><img src="https://quocviethere.github.io/assets/vlmdata/taxonomy.svg" class="img-fluid"></p>
</div>
</div>
</div>
<section id="rewriting-the-captions" class="level2">
<h2 class="anchored" data-anchor-id="rewriting-the-captions">Rewriting the captions</h2>
<p>One of the most well-studied directions in terms of improving the datasets is rewriting the captions. BLIP <span class="citation" data-cites="blip">[41]</span> is one of the most notable model that follows this synthetic approach by traininng a <em>captioner</em> to rewrite the noisy web image captions. An additional filter is used to further enhance the dataset quality. Ablation study shows that the use of <em>captioner</em> increase the model’s performance on image captioning and retrieval tasks.</p>
<p>LaCLIP <span class="citation" data-cites="laclip">[42]</span> employs LLM (LlaMA) to rewrite the captions in well-established captioning datasets such as CC12M and RedCaps. LaCLIP enhances CLIP’s performance in both zero-shot and few-shot image classification tasks. When trained on the CC12M dataset, LaCLIP method improves 8% on top-1 accuracy on ImageNet and 7% improvement on average over the other downstream datasets compared to the vanilla CLIP model.</p>
<p>However, as noted by Nguyen et al.&nbsp;(2023) <span class="citation" data-cites="nguyen2023improving">[43]</span>, LaCLIP assumes access to raw text and that the image captioner is not conditioned on the image, which may limit effectiveness when captions lack descriptiveness. Additionally, since LaCLIP utilizes datasets like CC12M, which already contain high-quality captions, VeCLIP <span class="citation" data-cites="veclip">[44]</span> argues that using large language models to rewrite noisy alt texts may yield only trivial improvements. VeCLIP therfore first use LLaVA <span class="citation" data-cites="llava">[45]</span> as an intial image captioners to generate image captions, then they incorporate the generated captions and alttexts using LLMs, yielding the final captions dubbed VECaps. Training the VeCLIP model WIT dataset with VeCaps is shown to improve the model’s performance on both image classification and retrieval tasks.</p>
<p>ChatCaptioner <span class="citation" data-cites="zhu2024chatgpt">[46]</span> ChatGPT to ask BLIP-2 a series of question relating to the input image. Then, the final description/summarization is generated by BLIP-2, which is used as the new image captions containing more visual details. The overall pipeline is shown in Figure&nbsp;8. This approach is shown to contain more information and number of object in image captions.</p>
<div id="fig-chat" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-chat-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/caption1.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-chat-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;8: Overall workflow of ChatCaptioner. ChatGPT is used to ask a series of questions about the details of the input image, BLIP-2 answers the questions. The final description of the image is obtained by ChatGPT’s summary of the conversation. Figure source: <a href="https://arxiv.org/pdf/2303.06594" target="_blank">Deyao et al.&nbsp;(2023)</a>
</figcaption>
</figure>
</div>
<p>The use of proprietary models like ChatGPT, however, might be restrictive. CapsFusion <span class="citation" data-cites="capsfusion">[47]</span> therefore first generating the image captions using BLIP <span class="citation" data-cites="blip">[41]</span>, use LlaMA-2 model <span class="citation" data-cites="touvron2023llama">[48]</span> fine-tuned on ChatGPT’s outputs to fuse the synthetic and original captions. Compared to other works, CapsFusion focuses on training Large Multimodal Models (LMMs) rather than CLIP, as shown in Figure&nbsp;9</p>
<div id="fig-capsfusion" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-capsfusion-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/capsfusion.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-capsfusion-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;9: Overall workflow of CapsFusion. Figure source: <a href="https://arxiv.org/pdf/2310.20550" target="_blank">Deyao et al.&nbsp;(202)</a>.
</figcaption>
</figure>
</div>
<p>On a similar vein, Recap-DataComp-1B <span class="citation" data-cites="li2024what">[49]</span> train a LlaVA model that use LlaMA-3 as the LLM backbone on image captioning task and then use this model to recaption the DataComp-1B dataset. The generated captions has on average a sequence length 49.5, compared to 10.2 of the original captions from DataComp-1B. Training the model on this new dataset with đifferent mixing ratio (of synthetic and raw captions) yeilds improved results on top-1-recall retrieval task.</p>
<p>FuseCap <span class="citation" data-cites="fusecap">[50]</span> uses <em>vision experts</em> (i.e.&nbsp;object detectors, attribute recognizers, and OCR models) to extract the visual information from the image and then incorporate these information with the original captions using LLMs. The FuseCap dataset, with 12M generated captions, improves image captioning and retrieval tasks. A BLIP-like model fine-tuned on FuseCap achieves higher CLIPScore and better COCO retrieval performance compared to BLIP2.</p>
<p>VILA² <span class="citation" data-cites="fang2024vila">[51]</span> observes diminishing returns when rewriting captions. After the fourth iteration, the quality of the captions no longer improves, often due to limitations in the capacity of the captioning model. To address this, they propose enhancing the model with more specialized vision tasks, such as spatial and grounding understanding or OCR, by fine-tuning the VILA model to further improve the results.</p>
<p>CLIPS <span class="citation" data-cites="clips">[52]</span> shows that a subset of the caption surprising leads to better performance rather than feeding full-length (synthetic) captions. ALIP <span class="citation" data-cites="alip">[53]</span> uses OFA model <span class="citation" data-cites="ofa">[54]</span> to generate synthetic captions. Instead of hand-tuning the mixing ratio of synthetic and original data samples <span class="citation" data-cites="li2024what">[49]</span>, laclip, gadre2023datacomp, ALIP proposes the use of <i>Language Consistency Gate (LCG)</i> and <i>Description Consistency Gate (DCG)</i> to adaptively adjust the weight of the synthetic caption and the intial raw text in the contrastive loss during model training. When pre-trained on YFCC15M, ALIP yields SOTA results on image and text retrieval metrics.</p>
</section>
<section id="synthetic-caption-effectiveness." class="level2">
<h2 class="anchored" data-anchor-id="synthetic-caption-effectiveness."><b>Synthetic caption effectiveness.</b></h2>
<p>Nguyen et al.&nbsp;(2024) <span class="citation" data-cites="nguyen2023improving">[43]</span> investigates the benefits of synthetic captions for VLMs’ performance. The two main findings are that (1) Higher CIDEr scores do not necessarily lead to better captions for training CLIP. For instance, OpenCLIP-CoCa ViT-L/14 achieves a relatively low CIDEr score of 0.354 yet attains the highest ImageNet classification score (0.321). In contrast, models with CIDEr scores between 80–120 perform worse, with scores ranging from 0.2 to 0.28. (2) Synthetic captions tend to be longer and contain more visual tokens than raw captions. CLIP score filtering on raw captions, as well as mixing raw and synthetic captions, enhances these properties, ultimately improving caption quality.</p>
<div class="quarto-layout-panel" data-layout="[65, 35]">
<div class="quarto-layout-row">
<div id="first-column" class="quarto-layout-cell" style="flex-basis: 65.0%;justify-content: flex-start;">
<p>The use of synthetic captions, however, is not always beneficial. MM1 <span class="citation" data-cites="mm1">[55]</span> shows that incorporating high-quality synthetic data like VeCap <span class="citation" data-cites="veclip">[44]</span> enhances few-shot learning. Despite making up only 7% of all caption data, it significantly boosts performance by 2.4% and 4%. While VeCap slightly improves performance in TextCore and significantly boosts results in 4-shot and 8-shot scenarios. However, it negatively impacts 0-shot performance, leading to a decrease of 3%, as shown in Figure&nbsp;10.</p>
</div>
<div id="second-column" class="quarto-layout-cell" style="flex-basis: 35.0%;justify-content: flex-start;">
<div id="fig-vecap" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-vecap-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/vecap.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-vecap-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;10: Impact of VeCap on few-shot learning. Figure source: <a href="https://arxiv.org/pdf/2310.20550" target="_blank">Deyao et al.&nbsp;(202)</a>.
</figcaption>
</figure>
</div>
</div>
</div>
</div>
</section>
<section id="images-synthesis-and-fully-synthetic-data-training" class="level2">
<h2 class="anchored" data-anchor-id="images-synthesis-and-fully-synthetic-data-training">Images Synthesis and Fully Synthetic Data Training</h2>
<div class="quarto-layout-panel" data-layout="[40, 60]">
<div class="quarto-layout-row">
<div id="first-column" class="quarto-layout-cell" style="flex-basis: 40.0%;justify-content: flex-start;">
<p>SynthVLM <span class="citation" data-cites="synthvlm">[56]</span> uses Stable Diffusion to create images from a set of filtered captions compiled from a range of captioning datasets such as CC and SBU, retaining 40% of the original dataset. A subset of 1000 captions is randomly samples to feed into Stable Diffusion model for image generation. The generated images have resolution of 1024x1024. The resulting dataset is shown to have higher CLIPScore (0.34 and 0.38 compared to 0.32 and 0,31 in the raw datasets). Empirical experiments using SDXL for image generation and LLaVA 1.5 (13B) for robust visual understanding, employing CLIP 336 (14-patch) as the encoder and Vicuna v1.5 (13B) as the language model. The model trained on 100k synthetic data samples achieves SoTA across multiple visual and language benchmarks while reducing computational usage.</p>
</div>
<div id="second-column" class="quarto-layout-cell" style="flex-basis: 60.0%;justify-content: flex-start;">
<div id="fig-synthvlm" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-synthvlm-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/synthvlm.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-synthvlm-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;11: Performance comparison of Synth Select 100k and LLaVA models across multiple benchmarks. Synth Select 100k (orange, red) outperforms LLaVA (green, blue), achieving superior results in both visual and language tasks while maintaining efficiency.. Figure source: <a href="https://arxiv.org/pdf/2407.20756" target="_blank">Liu et al.&nbsp;(2024)</a>..
</figcaption>
</figure>
</div>
</div>
</div>
</div>
<p>Synth² <span class="citation" data-cites="synth2">[57]</span> develop a pipeline to create an entirely synthetic datasets, both the captions and images. Using Gemini Pro, the captions are first created with classes from ImageNet datasets. These captions are then uses to prompt a text-to-image model to create synthetic images. The overall architecture of Synth² is depicted in Figure&nbsp;12.</p>
<div class="quarto-layout-panel" data-layout="[40, 60]">
<div class="quarto-layout-row">
<div id="first-column" class="quarto-layout-cell" style="flex-basis: 40.0%;justify-content: flex-start;">
<p>However, rather than generating images in the pixel space, this work generate the images in the <strong>embedding space</strong> and use it to directly train the VLM. Table 8 shows that adding 1M synthetic samples (GenPair) improves the zero-shot evaluation result significantly compared to training the model on 1M additional data samples from WebLI <span class="citation" data-cites="chen2022pali">[13]</span> or LTIP <span class="citation" data-cites="flamingo">[25]</span> dataset. Concurrent to Synth², SynthCLIP <span class="citation" data-cites="synthclip">[58]</span> starts from building a concept bank containing <img src="https://latex.codecogs.com/png.latex?N_C"> concepts similar to MetaCLIP <span class="citation" data-cites="metaclip">[2]</span> and prompt the Mistral-7B-Instruct V0.2 model to create the image</p>
</div>
<div id="second-column" class="quarto-layout-cell" style="flex-basis: 60.0%;justify-content: flex-start;">
<div id="fig-synth2" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-synth2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/synth2.png" class="img-fluid figure-img" width="500">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-synth2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;12: Overall workflow of Synth². Figure source: Sahand et al.&nbsp;(2024) <span class="citation" data-cites="synth2">[57]</span>
</figcaption>
</figure>
</div>
</div>
</div>
</div>
<p>captions. The generated captions are then filtered by substring matching to determine concept frequencies and probability balancing to prevent over-representation of common concepts while boosting long-tail concepts. This ensures a diverse and task-agnostic caption set suitable for foundation model pre-training, similar to MetaCLIP <span class="citation" data-cites="metaclip">[2]</span>. These filtered captions are then used as inputs to Stable Diffusion for image generation, resulting in the final 30M-sample dataset called <strong>SynthCI</strong>. <strong>SynthCLIP</strong> is trained on the synthetic dataset <strong>SynthCI</strong> at varying scales. As the size of <strong>SynthCI</strong> increases, a consistent improvement in performance is observed across both <strong>vision</strong> and <strong>vision-language</strong> tasks, rivaling with the performance of CLIP models trained on CC3M and CC12M.</p>
</section>
</section>
<section id="data-augmentation" class="level1">
<h1><strong>Data Augmentation</strong></h1>
<hr>
<p>Popular datasets like LAION <span class="citation" data-cites="laion-400m laion-5b">[21, 22]</span> have been shown to exhibit a long-tailed distributions, which might lead to bias when training the models. Contrary to traditional datasets, where concept frequency estimation is straightforward that we can just count the number of classes, pre-training datasets for VLMs, however, the task of concept frequency estimation is non-trivial because of the variations in natural language. For example, <code>sneakers</code> can also be referred to in the dataset as <code>running shoes</code> or <code>trainers</code>. Parashar et al.&nbsp;(2024) <span class="citation" data-cites="parashar2024neglected">[59]</span> address this by using LLMs to list the synonyms (<i>eg.</i> tiger, Panthera tigris, …).</p>
<p>Furthermore, to filter out irrelevant pretraining texts, simple string matching is insufficient due to linguistic ambiguities, so Llama-2 is used to verify whether a retrieved caption’s concept matches its intended definition, excluding mismatched cases to ensure accurate concept frequency estimation. This strategy is called <strong>REAL-Prompt</strong> and it is shown to enhance accuracy and efficiency, outperforming methods like DCLIP and CuPL while significantly reducing token usage and cost.</p>
<p>Another variant of REAL-Prompt, called <strong>REAL-Linear</strong>, retrieves concept-relevant images from pretraining data to create a more balanced subset for training a robust linear classifier (see Figure 13 for an illustration). REAL-Linear achieves SOTA performance, outperforming REACT by 3% in accuracy while using only 1% of its compute, with additional gains from synonym expansion, cross-modal learning, and optimized retrieval size, benefiting both head and tail classes.</p>
<p>Most approach consider CLIP’s embedding on a Euclidean space, creating two separated clusters for image and text. <img src="https://latex.codecogs.com/png.latex?m%5E2">-Mix <span class="citation" data-cites="geodesic">[60]</span> addresses this by mixing image and text embeddings through multi-modal Mixup, ensuring the mixed embeddings remain on CLIP’s hypersphere using a novel geodesic Mixup approach (see Figure&nbsp;13). Unlike standard Mixup, which does not guarantee hypersphere alignment, geodesic Mixup interpolates along a geodesic path to maintain this property.</p>
<div id="fig-geodesic" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-geodesic-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vlmdata/mixup1.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-geodesic-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;13: (Left) Pre-trained CLIP has separate image and text clusters with poor alignment and transferability. (Middle) m2-Mix bridges this gap by mixing embeddings on the hypersphere, creating hard negatives. (Right) Fine-tuning with m2-Mix enhances robustness and transferability. Figure source: Changdae et al.&nbsp;(2023) <span class="citation" data-cites="geodesic">[60]</span>.
</figcaption>
</figure>
</div>
<p><img src="https://latex.codecogs.com/png.latex?m%5E2">-Mix can be considered a data augmentation method in the embedding space rather than the input space. Traditional data augmentation techniques (<i>e.g.</i> cropping, flipping, or color jittering) modify raw input data, while <img src="https://latex.codecogs.com/png.latex?m%5E2">-Mix augments the feature representations by generating virtual samples through multi-modal Mixup.</p>
<p>Since it creates hard negative samples that improve contrastive learning by better distinguishing between similar concepts, it aligns with the goal of augmentation: expanding the training distribution to enhance model robustness. This is particularly useful for contrastive learning-based models like CLIP, where embedding space augmentation can lead to better generalization. <img src="https://latex.codecogs.com/png.latex?m%5E2">-Mix consistently enhances representation learning across various tasks, including cross-modal retrieval, uni-modal and multi-modal classification, and image captioning, by effectively aligning mixed embeddings from different modalities. It achieves notable performance gains, particularly in fine-tuning scenarios, with improvements observed across multiple datasets and models.</p>
<section id="multilinguality" class="level2">
<h2 class="anchored" data-anchor-id="multilinguality">Multilinguality</h2>
<p>A common practice in training VLMs is to filter out non-English data samples from massive web-scraped datasets <span class="citation" data-cites="clip align">[12, 18]</span>, which lead to potential biases. For example, CLIP filter tends to keep only Western-related data points, excluding those that are non-Western. In particular, English data samples have a pass rate of approximately 0.5, while that of Korean and Chinese data is below 0.1.</p>
<p>In attempt to address the problem of English-dominant web-scaled datasets, Nguyen et al.&nbsp;(2024) <span class="citation" data-cites="nguyen2024multilingual">[61]</span> translate non-English data samples from DataComp-128M dataset to English. Empirical results show consistent improvement when using the translated data samples. The conjecture for this improvement is that multilingual data <em>enriches</em> monolingual data distribution by adding cultural insights and diverse annotations for the same visual category.</p>
<p>On the DataComp benchmark, training on translated captions outperforms training on raw captions across multiple metrics, including ImageNet accuracy, distribution shifts, retrieval, and GeoDE worst-region accuracy. Using both translated and raw captions together yields even greater performance gains, with the best results achieved by tuning the filtering threshold for each baseline.</p>
<p>Google PaLI-X and Ying-VLM <span class="citation" data-cites="pali-x">[62]</span>, ying-vlm both leverage multilingual training to enhance vision-language understanding across diverse languages. PaLI-X, trained on the WebLI dataset covering 100 languages, achieves state-of-the-art results in 5 out of 7 languages on the XM-3600 multilingual image captioning benchmark, while Ying-VLM, trained on the Multi-Modal, Multilingual Instruction Tuning (<img src="https://latex.codecogs.com/png.latex?%5Ctext%7BM%7D%5E3%5Ctext%7BIT%7D">) dataset spanning 80 languages, surpasses InstructBLIP in video-language tasks based on the ROUGE-L score. Through these findings, it is important to incorporate multilingual data in VLM training, as it not only mitigates biases in web-scale datasets but also enhances model performance across diverse linguistic and cultural contexts.</p>
</section>
</section>


<div id="quarto-appendix" class="default"><section id="citation" class="level1 appendix"><h2 class="anchored quarto-appendix-heading">Citation</h2><div class="quarto-appendix-contents">

<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bibtex code-with-copy"><code class="sourceCode bibtex"><span id="cb1-1"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">@article</span>{<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">viet2025vlmdata</span>,</span>
<span id="cb1-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">title</span>   = {A Data-Centric Analysis on Advancing Vision-Language Models},</span>
<span id="cb1-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">author</span>  = {Viet Nguyen},</span>
<span id="cb1-4">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">year</span>    = {2025},</span>
<span id="cb1-5">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">month</span>   = {Feb},</span>
<span id="cb1-6">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">url</span>     = {https://quocviethere.github.io/blog/2025/vlmdata}</span>
<span id="cb1-7">}</span></code></pre></div></div>



</div></section><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body">
<div id="ref-huang2021what" class="csl-entry">
<div class="csl-left-margin">1. </div><div class="csl-right-inline">Huang Y, Du C, Xue Z, Chen X, Zhao H, Huang L (2021) What makes multi-modal learning better than single (provably). In: Conference on neural information processing systems (NeurIPS). pp 10944–10956</div>
</div>
<div id="ref-metaclip" class="csl-entry">
<div class="csl-left-margin">2. </div><div class="csl-right-inline">Xu H, Xie S, Tan X, et al (2024) Demystifying CLIP data. In: The twelfth international conference on learning representations</div>
</div>
<div id="ref-dfn" class="csl-entry">
<div class="csl-left-margin">3. </div><div class="csl-right-inline">Fang A, Jose AM, Jain A, Schmidt L, Toshev AT, Shankar V (2024) Data filtering networks. In: The twelfth international conference on learning representations</div>
</div>
<div id="ref-vlm-survey1" class="csl-entry">
<div class="csl-left-margin">4. </div><div class="csl-right-inline">Bordes F, Pang RY, Ajay A, et al (2024) <a href="https://arxiv.org/abs/2405.17247">An introduction to vision-language modeling</a></div>
</div>
<div id="ref-nguyen2024videolanguage" class="csl-entry">
<div class="csl-left-margin">5. </div><div class="csl-right-inline">Nguyen T, Bin Y, Xiao J, et al (2024) Video-language understanding: A survey from model architecture, model training, and data perspectives. arXiv</div>
</div>
<div id="ref-vlm-survey2" class="csl-entry">
<div class="csl-left-margin">6. </div><div class="csl-right-inline">Zhang J, Huang J, Jin S, Lu S (2024) Vision-language models for vision tasks: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence 1–20</div>
</div>
<div id="ref-vlm-survey3" class="csl-entry">
<div class="csl-left-margin">7. </div><div class="csl-right-inline">Du Y, Liu Z, Li J, Zhao WX (2022) A survey of vision-language pre-trained models. In: International joint conference on artificial intelligence (IJCAI). pp 5436–5443</div>
</div>
<div id="ref-vlm-survey4" class="csl-entry">
<div class="csl-left-margin">8. </div><div class="csl-right-inline">Ghosh A, Acharya A, Saha S, Jain V, Chadha A (2024) Exploring the frontier of vision-language models: A survey of current methodologies and future directions. arXiv abs/2404.07214</div>
</div>
<div id="ref-coco" class="csl-entry">
<div class="csl-left-margin">9. </div><div class="csl-right-inline">Lin T-Y, Maire M, Belongie S, et al (2014) Microsoft COCO: Common objects in context. arXiv</div>
</div>
<div id="ref-vg" class="csl-entry">
<div class="csl-left-margin">10. </div><div class="csl-right-inline">Krishna R, Zhu Y, Groth O, et al (2017) Visual genome: Connecting language and vision using crowdsourced dense image annotations. International Journal of Computer Vision 123(1):32–73</div>
</div>
<div id="ref-sbu" class="csl-entry">
<div class="csl-left-margin">11. </div><div class="csl-right-inline">Ordonez V, Kulkarni G, Berg TL (2011) Im2Text: Describing images using 1 million captioned photographs. In: Conference on neural information processing systems (NeurIPS). pp 1143–1151</div>
</div>
<div id="ref-clip" class="csl-entry">
<div class="csl-left-margin">12. </div><div class="csl-right-inline"><span class="nocase">Radford A, Kim JW, Hallacy C, et al</span> (2021) Learning transferable visual models from natural language supervision. In: International conference on machine learning. PMLR</div>
</div>
<div id="ref-chen2022pali" class="csl-entry">
<div class="csl-left-margin">13. </div><div class="csl-right-inline">Chen X, Wang X, Changpinyo S, et al (2022) PaLI: A jointly-scaled multilingual language-image model. In: International conference on learning representations</div>
</div>
<div id="ref-lxmert" class="csl-entry">
<div class="csl-left-margin">14. </div><div class="csl-right-inline">Tan H, Bansal M (2019) LXMERT: Learning cross-modality encoder representations from transformers. In: Conference on empirical methods in natural language processing (EMNLP). pp 5099–5110</div>
</div>
<div id="ref-cc3m" class="csl-entry">
<div class="csl-left-margin">15. </div><div class="csl-right-inline">Sharma P, Ding N, Goodman S, Soricut R (2018) Conceptual captions: A cleaned, <span>Hypernymed</span>, <span>Image</span> <span>Alt</span>-text <span>Dataset</span> <span>For</span> <span>Automatic</span> <span>Image</span> <span>Captioning</span>. In: Proceedings of the 56th annual meeting of the association for computational linguistics (volume 1: Long papers). Association for Computational Linguistics</div>
</div>
<div id="ref-cc12m" class="csl-entry">
<div class="csl-left-margin">16. </div><div class="csl-right-inline">Changpinyo S, Sharma P, Ding N, Soricut R (2021) Conceptual 12M: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In: Computer vision and pattern recognition (CVPR). pp 3558–3568</div>
</div>
<div id="ref-coyo-700m" class="csl-entry">
<div class="csl-left-margin">17. </div><div class="csl-right-inline">Minwoo Byeon HK Beomhee Park (2022) COYO-700M: Image-text pair dataset</div>
</div>
<div id="ref-align" class="csl-entry">
<div class="csl-left-margin">18. </div><div class="csl-right-inline">Jia C, Yang Y, Xia Y, et al (2021) Scaling up visual and vision-language representation learning with noisy text supervision. In: International conference on machine learning (ICML). pp 4904–4916</div>
</div>
<div id="ref-basic" class="csl-entry">
<div class="csl-left-margin">19. </div><div class="csl-right-inline">Pham H, Dai Z, Ghiasi G, et al (2023) Combined scaling for zero-shot transfer learning. Neurocomputing 555:126658</div>
</div>
<div id="ref-florence" class="csl-entry">
<div class="csl-left-margin">20. </div><div class="csl-right-inline">Yuan L, Chen D, Chen Y-L, et al (2021) Florence: A new foundation model for computer vision. ArXiv abs/2111.11432</div>
</div>
<div id="ref-laion-400m" class="csl-entry">
<div class="csl-left-margin">21. </div><div class="csl-right-inline">Schuhmann C, Vencu R, Beaumont R, et al (2021) LAION-400M: Open dataset of CLIP-filtered 400 million image-text pairs. arXiv</div>
</div>
<div id="ref-laion-5b" class="csl-entry">
<div class="csl-left-margin">22. </div><div class="csl-right-inline">Schuhmann C, Beaumont R, Vencu R, et al (2022) LAION-5B: An open large-scale dataset for training next generation image-text models. In: Conference on neural information processing systems (NeurIPS)</div>
</div>
<div id="ref-srinivasan2021wit" class="csl-entry">
<div class="csl-left-margin">23. </div><div class="csl-right-inline">Srinivasan K, Raman K, Chen J, Bendersky M, Najork M (2021) WIT: Wikipedia-based image text dataset for multimodal multilingual machine learning. In: Annual international ACM SIGIR conference on research and development in information retrieval (SIGIR). pp 2443–2449</div>
</div>
<div id="ref-cm3" class="csl-entry">
<div class="csl-left-margin">24. </div><div class="csl-right-inline">Aghajanyan A, Huang B, Ross C, et al (2022) CM3: A causal masked multimodal model of the internet. arXiv</div>
</div>
<div id="ref-flamingo" class="csl-entry">
<div class="csl-left-margin">25. </div><div class="csl-right-inline">Alayrac J-B, Donahue J, Luc P, et al (2022) Flamingo: A visual language model for few-shot learning. In: Oh AH, Agarwal A, Belgrave D, Cho K (eds) Advances in neural information processing systems</div>
</div>
<div id="ref-chameleon" class="csl-entry">
<div class="csl-left-margin">26. </div><div class="csl-right-inline">Team C (2024) Chameleon: Mixed-modal early-fusion foundation models. arXiv</div>
</div>
<div id="ref-obelics" class="csl-entry">
<div class="csl-left-margin">27. </div><div class="csl-right-inline">Laurençon H, Saulnier L, Tronchon L, et al (2023) OBELICS: An open web-scale filtered dataset of interleaved image-text documents. In: Conference on neural information processing systems (NeurIPS)</div>
</div>
<div id="ref-mmc4" class="csl-entry">
<div class="csl-left-margin">28. </div><div class="csl-right-inline">Zhu W, Hessel J, Awadalla A, et al (2023) Multimodal C4: An open, <span>Billion</span>-scale <span>Corpus</span> of <span>Images</span> <span>Interleaved</span> with <span>Text</span>. arXiv</div>
</div>
<div id="ref-c4" class="csl-entry">
<div class="csl-left-margin">29. </div><div class="csl-right-inline">Raffel C, Shazeer N, Roberts A, et al (2020) Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research (JMLR) 21:140:1–140:67</div>
</div>
<div id="ref-mint-1t" class="csl-entry">
<div class="csl-left-margin">30. </div><div class="csl-right-inline">Awadalla A, Xue L, Lo O, et al (2024) MINT-1T: Scaling open-source multimodal data by 10x: A multimodal dataset with one trillion tokens. In: The thirty-eight conference on neural information processing systems datasets and benchmarks track</div>
</div>
<div id="ref-moscar" class="csl-entry">
<div class="csl-left-margin">31. </div><div class="csl-right-inline">Futeral M, Zebaze A, Suarez PO, et al (2024) mOSCAR: A large-scale multilingual and multimodal document-level corpus. arXiv</div>
</div>
<div id="ref-omnicorpus" class="csl-entry">
<div class="csl-left-margin">32. </div><div class="csl-right-inline">Li Q, Chen Z, Wang W, et al (2024) OmniCorpus: A unified multimodal corpus of 10 billion-level images interleaved with text. arXiv abs/2406.08418</div>
</div>
<div id="ref-fang2022data" class="csl-entry">
<div class="csl-left-margin">33. </div><div class="csl-right-inline">Fang A, Ilharco G, Wortsman M, et al (2022) Data determines distributional robustness in contrastive language image pre-training (CLIP). In: International conference on machine learning (ICML). pp 6216–6234</div>
</div>
<div id="ref-tmars" class="csl-entry">
<div class="csl-left-margin">34. </div><div class="csl-right-inline">Maini P, Goyal S, Lipton ZC, Kolter JZ, Raghunathan A (2024) T-MARS: Improving visual representations by circumventing text feature learning. In: International conference on learning representations (ICLR)</div>
</div>
<div id="ref-cat-filter" class="csl-entry">
<div class="csl-left-margin">35. </div><div class="csl-right-inline">Radenovic F, Dubey A, Kadian A, et al (2023) Filtering, distillation, and hard negatives for vision-language pre-training. In: Computer vision and pattern recognition (CVPR). pp 6967–6977</div>
</div>
<div id="ref-clipscore" class="csl-entry">
<div class="csl-left-margin">36. </div><div class="csl-right-inline">Hessel J, Holtzman A, Forbes M, Bras RL, Choi Y (2021) CLIPScore: A reference-free evaluation metric for image captioning. arXiv preprint arXiv:210408718</div>
</div>
<div id="ref-datacomp" class="csl-entry">
<div class="csl-left-margin">37. </div><div class="csl-right-inline">Gadre SY, Ilharco G, Fang A, et al (2023) DATAComp: In search of the next generation of multimodal datasets. In: Advances on neural information processing systems datasets and benchmarks track</div>
</div>
<div id="ref-wang2024finetuned" class="csl-entry">
<div class="csl-left-margin">38. </div><div class="csl-right-inline">Wang W, Mrini K, Yang L, et al (2024) Finetuned multimodal language models are high-quality image-text data filters. arXiv</div>
</div>
<div id="ref-semdedup" class="csl-entry">
<div class="csl-left-margin">39. </div><div class="csl-right-inline">Abbas AKM, Tirumala K, Simig D, Ganguli S, Morcos AS (2023) SemDeDup: Data-efficient learning at web-scale through semantic deduplication. In: ICLR 2023 workshop on multimodal representation learning: Perks and pitfalls</div>
</div>
<div id="ref-goyal2024science" class="csl-entry">
<div class="csl-left-margin">40. </div><div class="csl-right-inline">Goyal S, Maini P, Lipton Z, Raghunathan A, Kolter Z (2024) The science of data filtering: Data curation cannot be compute agnostic. In: IEEE/CVF conference on computer vision and pattern recognition (CVPR)</div>
</div>
<div id="ref-blip" class="csl-entry">
<div class="csl-left-margin">41. </div><div class="csl-right-inline">Li J, Li D, Xiong C, Hoi SCH (2022) BLIP: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In: International conference on machine learning (ICML). pp 12888–12900</div>
</div>
<div id="ref-laclip" class="csl-entry">
<div class="csl-left-margin">42. </div><div class="csl-right-inline">Fan L, Krishnan D, Isola P, Katabi D, Tian Y (2023) Improving CLIP training with language rewrites. In: Conference on neural information processing systems (NeurIPS)</div>
</div>
<div id="ref-nguyen2023improving" class="csl-entry">
<div class="csl-left-margin">43. </div><div class="csl-right-inline">Nguyen T, Gadre SY, Ilharco G, Oh S, Schmidt L (2023) Improving multimodal datasets with image captioning. In: Advances on neural information processing systems datasets and benchmarks track</div>
</div>
<div id="ref-veclip" class="csl-entry">
<div class="csl-left-margin">44. </div><div class="csl-right-inline">Lai Z, Zhang H, Zhang B, et al (2025) VeCLIP: Improving CLIP training via visual-enriched captions. Springer Nature Switzerland</div>
</div>
<div id="ref-llava" class="csl-entry">
<div class="csl-left-margin">45. </div><div class="csl-right-inline">Liu H, Li C, Wu Q, Lee YJ (2023) Visual instruction tuning. In: Conference on neural information processing systems (NeurIPS)</div>
</div>
<div id="ref-zhu2024chatgpt" class="csl-entry">
<div class="csl-left-margin">46. </div><div class="csl-right-inline">Zhu D, Chen J, Haydarov K, Shen X, Zhang W, Elhoseiny M (2024) ChatGPT asks, <span>BLIP</span>-2 <span>Answers</span>: Automatic <span>Questioning</span> <span>Towards</span> <span>Enriched</span> <span>Visual</span> <span>Descriptions</span>. Transactions on Machine Learning Research (TMLR) 2024</div>
</div>
<div id="ref-capsfusion" class="csl-entry">
<div class="csl-left-margin">47. </div><div class="csl-right-inline">Yu Q, Sun Q, Zhang X, et al (2024) CapsFusion: Rethinking image-text data at scale. In: IEEE/CVF conference on computer vision and pattern recognition (CVPR)</div>
</div>
<div id="ref-touvron2023llama" class="csl-entry">
<div class="csl-left-margin">48. </div><div class="csl-right-inline">Touvron H, Martin L, Stone K, et al (2023) Llama 2: Open foundation and fine-tuned chat models. arXiv</div>
</div>
<div id="ref-li2024what" class="csl-entry">
<div class="csl-left-margin">49. </div><div class="csl-right-inline">Li X, Tu H, Hui M, et al (2024) What if we recaption billions of web images with LLaMA-3? arXiv</div>
</div>
<div id="ref-fusecap" class="csl-entry">
<div class="csl-left-margin">50. </div><div class="csl-right-inline">Rotstein N, Bensaïd D, Brody S, Ganz R, Kimmel R (2024) FuseCap: Leveraging large language models for enriched fused image captions. In: IEEE/CVF winter conference on applications of computer vision (WACV). pp 5677–5688</div>
</div>
<div id="ref-fang2024vila" class="csl-entry">
<div class="csl-left-margin">51. </div><div class="csl-right-inline">Fang Y, Zhu L, Lu Y, et al (2024) VILA<img src="https://latex.codecogs.com/png.latex?%5E2">: VILA augmented VILA. arXiv</div>
</div>
<div id="ref-clips" class="csl-entry">
<div class="csl-left-margin">52. </div><div class="csl-right-inline">Liu Y, Li X, Wang Z, Zhao B, Xie C (2024) CLIPS: An enhanced CLIP framework for learning with synthetic captions. arXiv</div>
</div>
<div id="ref-alip" class="csl-entry">
<div class="csl-left-margin">53. </div><div class="csl-right-inline">Yang K, Deng J, An X, et al (2023) ALIP: Adaptive language-image pre-training with synthetic caption. In: IEEE international conference on computer vision (ICCV). pp 2910–2919</div>
</div>
<div id="ref-ofa" class="csl-entry">
<div class="csl-left-margin">54. </div><div class="csl-right-inline">Wang P, Yang A, Men R, et al (2022) OFA: Unifying architectures, <span>Tasks</span>, and <span>Modalities</span> <span>Through</span> a <span>Simple</span> <span>Sequence</span>-to-<span>Sequence</span> <span>Learning</span> <span>Framework</span>. In: International conference on machine learning (ICML). pp 23318–23340</div>
</div>
<div id="ref-mm1" class="csl-entry">
<div class="csl-left-margin">55. </div><div class="csl-right-inline">McKinzie B, Gan Z, Fauconnier J-P, et al (2025) MM1: Methods, analysis and insight from multimodal LLM pre-training. In: European <span>Conference</span> on <span>Computer</span> <span>Vision</span> (<span>ECCV</span>). Springer Nature Switzerland, pp 304–323</div>
</div>
<div id="ref-synthvlm" class="csl-entry">
<div class="csl-left-margin">56. </div><div class="csl-right-inline">Liu Z, Liang H, Huang X, et al (2024) SynthVLM: High-efficiency and high-quality synthetic data for vision language models. arXiv</div>
</div>
<div id="ref-synth2" class="csl-entry">
<div class="csl-left-margin">57. </div><div class="csl-right-inline">Sharifzadeh S, Kaplanis C, Pathak S, et al (2024) Synth2: Boosting visual-language models with synthetic captions and image embeddings. ArXiv abs/2403.07750</div>
</div>
<div id="ref-synthclip" class="csl-entry">
<div class="csl-left-margin">58. </div><div class="csl-right-inline">Hammoud HAAK, Itani H, Pizzati F, Torr PHS, Bibi A, Ghanem B (2024) SynthCLIP: Are we ready for a fully synthetic CLIP training? Synthetic Data for Computer Vision Workshop @ CVPR 2024 abs/2402.01832</div>
</div>
<div id="ref-parashar2024neglected" class="csl-entry">
<div class="csl-left-margin">59. </div><div class="csl-right-inline">Parashar S, Liu T, Lin Z, et al (2024) The neglected tails in vision-language models. In: IEEE/CVF conference on computer vision and pattern recognition (CVPR)</div>
</div>
<div id="ref-geodesic" class="csl-entry">
<div class="csl-left-margin">60. </div><div class="csl-right-inline">Oh C, So J, Byun H, et al (2023) Geodesic multi-modal mixup for robust fine-tuning. In: Conference on <span>Neural</span> <span>Information</span> <span>Processing</span> <span>Systems</span> (<span>NeurIPS</span>)</div>
</div>
<div id="ref-nguyen2024multilingual" class="csl-entry">
<div class="csl-left-margin">61. </div><div class="csl-right-inline">Nguyen T, Wallingford M, Santy S, et al (2024) Multilingual diversity improves vision-language representations. arXiv</div>
</div>
<div id="ref-pali-x" class="csl-entry">
<div class="csl-left-margin">62. </div><div class="csl-right-inline">Chen X, Djolonga J, Padlewski P, et al (2024) On scaling up a multilingual vision and language model. In: 2024 <span>IEEE</span>/<span>CVF</span> <span>Conference</span> on <span>Computer</span> <span>Vision</span> and <span>Pattern</span> <span>Recognition</span> (<span>CVPR</span>). pp 14432–14444</div>
</div>
</div></section></div> ]]></description>
  <category>vlm</category>
  <guid>https://quocviethere.github.io/blogs/vlmdata.html</guid>
  <pubDate>Tue, 04 Feb 2025 15:00:00 GMT</pubDate>
</item>
<item>
  <title>All Things KL Divergence</title>
  <link>https://quocviethere.github.io/blogs/kld.html</link>
  <description><![CDATA[ 





<p>While studying Machine Learning, I often come across the concept of KL Divergence. It is omnipresent, at least in the field of ML, and I often find myself studying the concept over and over again, so I think that it’d be useful to (finally and) formally note down for the sake of self-reference and revision. Hopefully others will find it useful too. Of course this is by no means everything about KL Divergence. Feedback are more than welcome.</p>
<section id="definition" class="level1">
<h1>Definition</h1>
<p>Given two distributions <img src="https://latex.codecogs.com/png.latex?P"> and <img src="https://latex.codecogs.com/png.latex?Q"> of a continuous random variable <img src="https://latex.codecogs.com/png.latex?x">, the KL Divergence between <img src="https://latex.codecogs.com/png.latex?P"> and <img src="https://latex.codecogs.com/png.latex?Q"> is defined as:</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Note</span>KL Divergence Definition
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Bequation%7D%20%5Clabel%7Bkl-def%7D%0A%5Cint_%5Cmathcal%7BX%7D%20P(x)%20%20%5Clog%20%5Cdfrac%7BP(x)%7D%7BQ(x)%7Ddx.%0A%5Cend%7Bequation%7D"></p>
</div>
</div>
</section>
<section id="an-example-kl-divergence-between-two-gaussian-distributions" class="level1">
<h1>An example: KL Divergence between two Gaussian distributions</h1>
<p>Suppose we are given two Gaussian distributions <img src="https://latex.codecogs.com/png.latex?P%20%5Csim%20%5Cmathcal%7BN%7D(%5Cmu_1,%20%5CSigma_1)">; <img src="https://latex.codecogs.com/png.latex?Q%20%5Csim%20%5Cmathcal%7BN%7D(%5Cmu_2,%20%5CSigma_2)">, and a random vector <img src="https://latex.codecogs.com/png.latex?x%20%5Cin%20%5Cmathbb%7BR%7D%5E%7Bn%20%5Ctimes%201%7D">, the KL Divergence between <img src="https://latex.codecogs.com/png.latex?P"> and <img src="https://latex.codecogs.com/png.latex?Q"> has the following analytic form:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AD_%7B%5Ctext%7BKL%7D%7D(P(x)%20%5C%7C%20Q(x))%20=%20%5Cdfrac%7B1%7D%7B2%7D%20%5Cleft%5B(%5Cmu_2%20-%20%5Cmu_1)%5ET%20%5CSigma_2%5E%7B-1%7D%20(%5Cmu_2%20-%20%5Cmu_1)%20+%20%5Ctext%7Btr%7D(%5CSigma_2%5E%7B-1%7D%5CSigma_1%5E1)%20-%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_1%7C%7D%7B%7C%5CSigma_2%7C%7D%20-%20n%20%5Cright%5D%0A"></p>
<p>Additionally, consider the following derivation:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(P%20%5C%7C%20Q)%20&amp;=%20%5Cint_%5Cmathcal%7BX%7D%20P(x)%20%5Clog%20%5Cdfrac%7BP(x)%7D%7BQ(x)%7D%20dx%20&amp;&amp;%20%5Ctext%7B(from%20%7D%20%5Ceqref%7Bkl-def%7D)%20%5C%5C%0A&amp;=%20%5Cint_%5Cmathcal%7BX%7D%20%5Cmathcal%7BN%7D(x;%20%5Cmu_1,%20%5CSigma_1)%20%5Clog%20%5Cdfrac%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_1,%20%5CSigma_1)%7D%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_2,%20%5CSigma_2)%7D%20%5C%5C%0A&amp;=%20%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%5Clog%20%5Cdfrac%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_1,%20%5CSigma_1)%7D%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_2,%20%5CSigma_2)%7D%20%5Cright%5D.%0A%5Cend%7Baligned%7D">
<p>Plugging in the multivariate Gaussian PDF, we have:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%5Clog%20%5Cdfrac%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_1,%20%5CSigma_1)%7D%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_2,%20%5CSigma_2)%7D%20%5Cright%5D%0A&amp;=%20%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%5Cdfrac%7B%5Cfrac%7B1%7D%7B%5Csqrt%7B2(%5Cpi)%5En%7C%5CSigma_1%7C%7D%7D%20%5Cexp(-%5Cfrac%7B1%7D%7B2%7D%20(x-%5Cmu_1)%5ET%20%5CSigma_1%5E%7B-1%7D%20(x-%5Cmu_1))%7D%7B%5Cfrac%7B1%7D%7B%5Csqrt%7B(2%5Cpi)%5En%7C%5CSigma_2%7C%7D%7D%20%5Cexp(-%5Cfrac%7B1%7D%7B2%7D%20(x-%5Cmu_2)%5ET%20%5CSigma_2%5E%7B-1%7D%20(x-%5Cmu_2))%7D%20%5Cright%5D%20%5C%5C%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20(x-%5Cmu_1)%5ET%20%5CSigma_1%5E%7B-1%7D%20(x-%5Cmu_1)%20+%20(x-%5Cmu_2)%5ET%20%5CSigma_2%5E%7B-1%7D%20(x-%5Cmu_2)%20%5Cright%5D%0A%5Cend%7Baligned%7D">
<p>Using the fact that <img src="https://latex.codecogs.com/png.latex?x%20=%20%5Ctext%7Btr%7D(x)"> and <img src="https://latex.codecogs.com/png.latex?%5Ctext%7Btr%7D(ABC)%20=%20%5Ctext%7Btr%7D(BCA)">, we have:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%5Clog%20%5Cdfrac%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_1,%20%5CSigma_1)%7D%7B%5Cmathcal%7BN%7D(x;%20%5Cmu_2,%20%5CSigma_2)%7D%20%5Cright%5D%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20%5Ctext%7Btr%7D%5B(x-%5Cmu_1)%5ET%20%5CSigma_1%5E%7B-1%7D%20(x-%5Cmu_1)%5D%20+%20%5Ctext%7Btr%7D%5B(x-%5Cmu_2)%5ET%20%5CSigma_2%5E%7B-1%7D%20(x-%5Cmu_2)%5D%20%5Cright%5D%20%5C%5C%0A%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20%5Ctext%7Btr%7D%5B%5CSigma_1%5E%7B-1%7D(x-%5Cmu_1)(x-%5Cmu_1)%5ET%5D%20+%20%5Ctext%7Btr%7D%5B%5CSigma_2%5E%7B-1%7D(xx%5ET%20-%202%5Cmu_2%20x%5ET%20+%20%5Cmu_2%20%5Cmu_2%5ET)%5D%20%5Cright%5D%20%5C%5C%0A%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20%5Ctext%7Btr%7D%5B%5CSigma_1%5E%7B-1%7D%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B(x-%5Cmu_1)(x-%5Cmu_1)%5ET%5D%5D%20+%20%5Ctext%7Btr%7D%5B%5CSigma_2%5E%7B-1%7D%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B(xx%5ET%20-%202%5Cmu_2%20x%5ET%20+%20%5Cmu_2%20%5Cmu_2%5ET)%5D%5D%20%5Cright%5D%20%5C%5C%0A%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20%5Ctext%7Btr%7D%5B%5CSigma_1%5E%7B-1%7D%20%5CSigma_1%5D%20+%20%5Ctext%7Btr%7D%5B%5CSigma_2%5E%7B-1%7D%5B%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B(xx%5ET)%5D%20-%202%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Cmu_2%20x%5ET%5D%20+%20%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B(%5Cmu_2%20%5Cmu_2%5ET)%5D%5D%20%5Cright%5D%20%5C%5C%0A%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20n%20+%20%5Ctext%7Btr%7D%5B%5CSigma_2%5E%7B-1%7D%5B%5CSigma_1%20+%20%5Cmu_1%5Cmu_1%5ET%20-%202%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Cmu_2%20%5Cmu_1%5ET%5D%20+%20%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B(%5Cmu_2%20%5Cmu_2%5ET)%5D%5D%20%5Cright%5D%20%5C%5C%0A%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20n%20+%20%5Ctext%7Btr%7D%5B%5CSigma_2%5E%7B-1%7D%5CSigma_1%5D%20+%20%5Ctext%7Btr%7D%5B%5Cmu_1%5ET%20%5CSigma_2%5E%7B-1%7D%20%5Cmu_1%20-%202%5B%5Cmu_1%5ET%20%5CSigma_2%5E%7B-1%7D%20%5Cmu_2%5D%20+(%5Cmu_2%5ET%20%5CSigma_2%5E%7B-1%7D%20%5Cmu_2)%5D%5D%20%5Cright%5D%20%5C%5C%0A%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%5Cleft%5B%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_2%7C%7D%7B%7C%5CSigma_1%7C%7D%20-%20n%20+%20%5Ctext%7Btr%7D%5B%5CSigma_2%5E%7B-1%7D%5CSigma_1%5D%20+%20%20(%5Cmu_2%20-%20%5Cmu_1)%5ET%20%5CSigma_2%5E%7B-1%7D%20(%5Cmu_2%20-%20%5Cmu_1)%20%5Cright%5D%20%5C%5C%0A%0A&amp;=%20%5Cdfrac%7B1%7D%7B2%7D%20%5Cleft%5B(%5Cmu_2%20-%20%5Cmu_1)%5ET%20%5CSigma_2%5E%7B-1%7D%20(%5Cmu_2%20-%20%5Cmu_1)%20+%20%5Ctext%7Btr%7D(%5CSigma_2%5E%7B-1%7D%5CSigma_1%5E1)%20-%20%5Clog%20%5Cdfrac%7B%7C%5CSigma_1%7C%7D%7B%7C%5CSigma_2%7C%7D%20-%20n%20%5Cright%5D%0A%5Cend%7Baligned%7D">
<p>In code, this could be implemented as:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">## KL Divergence Function for multivariate Gaussian</span></span>
<span id="cb1-2"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> kl_divergence(mu1, mu2, sigma1, sigma2):</span>
<span id="cb1-3">    diff_mu <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> mu2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> mu1</span>
<span id="cb1-4">    sigma2_inv <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> inv(sigma2)</span>
<span id="cb1-5">    </span>
<span id="cb1-6">    term1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> diff_mu.T <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> sigma2_inv <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> diff_mu</span>
<span id="cb1-7">    term2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.trace(sigma2_inv <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> sigma1)</span>
<span id="cb1-8">    term3 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>np.log(np.linalg.det(sigma1) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> np.linalg.det(sigma2))</span>
<span id="cb1-9">    term4 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(mu1)</span>
<span id="cb1-10">    </span>
<span id="cb1-11">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (term1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> term2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> term3 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> term4)</span></code></pre></div></div>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/kld/kl-gaussians.gif" class="img-fluid figure-img" width="500"></p>
<figcaption><small> The relationship between the KL divergence and the distance between two 2D Gaussian distributions. As the means of the distributions move closer together, the KL divergence decreases. Conversely, larger separation between the means results in a higher KL divergence. </small></figcaption>
</figure>
</div>
<section id="kl-divergence-of-distributions-in-the-exponential-family" class="level2">
<h2 class="anchored" data-anchor-id="kl-divergence-of-distributions-in-the-exponential-family">KL Divergence of distributions in the exponential family</h2>
<p>The exponential family is a particular family of probability distributions that can be rewritten in the following form:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Ap(x%20%5Cvert%20%5Ceta)%20=%20h(x)%5Cexp(%5Ceta%5ET%20%5Cmathcal%7BT%7D(x)%20-%20%5Cmathcal%7BA%7D(%5Ceta)).%0A"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?h(x)"> is the base measure, <img src="https://latex.codecogs.com/png.latex?%5Ceta"> is the natural parameters, <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BT%7D(x)"> is the sufficient statistic, and <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BA%7D(%5Ceta)"> is the log-partition function.</p>
<p>The KL divergence between two distributions from the same exponential family can be expressed in a closed-form analytic expression. Consider the following derivation:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(p(x%20%5Cvert%20%5Ceta_1)%20%5C%7C%20p(x%20%5Cvert%20%5Ceta_2))%20&amp;=%20%5Cint%20p(x%20%5Cvert%20%5Ceta_1)%20%5Clog%20%5Cdfrac%7Bp(x%20%5Cvert%20%5Ceta_1)%7D%7Bp(x%20%5Cvert%20%5Ceta_2)%7Ddx%20%5C%5C%0A&amp;=%20%5Cint%20p(x%20%5Cvert%20%5Ceta_1)%20-%20%5Cmathcal%7BA%7D(%5Ceta_1))%20%5Clog%20%5Cdfrac%7Bh(x)%5Cexp(%5Ceta_1%5ET%20%5Cmathcal%7BT%7D(x)%20-%20%5Cmathcal%7BA%7D(%5Ceta_1))%7D%7Bh(x)%5Cexp(%5Ceta_2%5ET%20%5Cmathcal%7BT%7D(x)%20-%20%5Cmathcal%7BA%7D(%5Ceta_2))%7D%20dx%20%5C%5C%0A&amp;=%20%5Cint%20p(x%20%5Cvert%20%5Ceta_1)%20%5B%5Ceta_1%5ET%20%5Cmathcal%7BT%7D(x)%20-%20%5Cmathcal%7BA%7D(%5Ceta_1)%20-%20%5Ceta_2%5ET%20%5Cmathcal%7BT%7D(x)%20+%20%5Cmathcal%7BA%7D(%5Ceta_2)%5D%20dx%5C%5C%0A&amp;=%20%5Cint%20p(x%20%5Cvert%20%5Ceta_1)%20%5B%5Cmathcal%7BT%7D(x)%20(%5Ceta_1%5ET-%5Ceta_2%5ET%20)%20-%5Cmathcal%7BA%7D(%5Ceta_1)+%5Cmathcal%7BA%7D(%5Ceta_2)%5D%20dx%5C%5C%0A&amp;=%20%5Cunderset%7Bp(x%20%5Cvert%20%5Ceta_1)%7D%7B%5Cmathbb%7BE%7D%7D%5B(%5Ceta_1%5ET-%5Ceta_2%5ET%20)%5D%20-%5Cmathcal%7BA%7D(%5Ceta_1)+%5Cmathcal%7BA%7D(%5Ceta_2)%0A%5Cend%7Baligned%7D">
<p>Therefore, the KL divergence between two distributions from the same exponential family, parameterized by their natural parameters <img src="https://latex.codecogs.com/png.latex?%5Ceta_1"> and <img src="https://latex.codecogs.com/png.latex?%5Ceta_2"> is <img src="https://latex.codecogs.com/png.latex?%5Cunderset%7Bp(x%20%5Cvert%20%5Ceta_1)%7D%7B%5Cmathbb%7BE%7D%7D%5B(%5Ceta_1%5ET-%5Ceta_2%5ET%20)%5D%20-%5Cmathcal%7BA%7D(%5Ceta_1)+%5Cmathcal%7BA%7D(%5Ceta_2)">.</p>
<p>As a quick sanity check, we can calculate the KL divergence between two Poisson distributions, both in the naive way and under the lens of the closed form for KL divergence of distributions in the exponential family.</p>
<p>We first start by showing that the Poisson distribution with parameter <img src="https://latex.codecogs.com/png.latex?%5Clambda"> is in the exponential family by rewriting its PMF as:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AP(x;%20%5Clambda)%20&amp;=%20%5Csum_%7Bx%7D%20%5Cdfrac%7B%5Clambda%5Ex%20%5Cexp(-%5Clambda)%7D%7Bx!%7D%20%5C%5C%0A&amp;=%20%5Cfrac%7B1%7D%7Bx!%7D%20%5Cexp(x%20%5Clog%20%5Clambda%20-%20%5Clambda)%20%5C%5C%0A%5Cend%7Baligned%7D">
<p>Therefore, the Poisson distribution is in the exponential family, where <img src="https://latex.codecogs.com/png.latex?%5Ceta%20=%20%5Clog%20%5Clambda">, <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BT%7D(x)%20=%20x">, <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BA%7D(%5Ceta)%20=%20%5Clambda%20=%20%5Cexp(x)">, and <img src="https://latex.codecogs.com/png.latex?h(x)=%5Cfrac%7B1%7D%7Bx!%7D">.</p>
<p>We now calculate the KL Divergence between two Poisson distributions parameterized by <img src="https://latex.codecogs.com/png.latex?%5Clambda_1"> and <img src="https://latex.codecogs.com/png.latex?%5Clambda_2">:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(p(x;%20%5Clambda_1)%20%5C%7C%20p(x;%20%5Clambda_2))%20&amp;=%20%5Csum_x%20p(x;%20%5Clambda_1)%20%5Clog%20%5Cdfrac%7Bp(x;%20%5Clambda_1)%7D%7Bp(x;%20%5Clambda_2)%7D%20&amp;&amp;%20%5Ctext%7B(by%20definition)%7D%20%5C%5C%0A%0A&amp;=%20%5Csum_x%20%5Cdfrac%7B%5Clambda_1%5Ex%20%5Cexp(-%5Clambda_1)%7D%7Bx!%7D%20%5Clog%20%5Cdfrac%7B%5Clambda_1%5Ex%20%5Cexp(-%5Clambda_1)%7D%7B%5Clambda_2%5Ex%20%5Cexp(-%5Clambda_2)%7D%20&amp;&amp;%20%5Ctext%7B(by%20plugging%20in%20the%20Poisson%20PMF)%7D%20%5C%5C%0A%0A&amp;=%20%5Csum_x%20%5Cdfrac%7B%5Clambda_1%5Ex%20%5Cexp(-%5Clambda_1)%7D%7Bx!%7D%20%5Cleft(x%20%5Clog%20%5Cdfrac%7B%5Clambda_1%7D%7B%5Clambda_2%7D%20+%20%5Clambda_2%20-%20%5Clambda_1%20%5Cright)%20%5C%5C%0A%0A&amp;=%20%5Csum_x%20%5Cdfrac%7B%5Clambda_1%5Ex%20%5Cexp(-%5Clambda_1)%7D%7Bx!%7D%20%20%5Cleft(x%20%5Clog%20%5Cdfrac%7B%5Clambda_1%7D%7B%5Clambda_2%7D%5Cright)%20+%20(%5Clambda_2%20-%20%5Clambda_1)%5Csum_x%20%5Cdfrac%7B%5Clambda_1%5Ex%20%5Cexp(-%5Clambda_1)%7D%7Bx!%7D%20&amp;&amp;%20%5Ctext%7B(by%20rearranging%20the%20sum)%7D%20%5C%5C%0A%0A&amp;=%20%5Cunderset%7Bp(x;%20%5Ceta_1)%7D%7B%5Cmathbb%7BE%7D%7D%5Bx%5D%20%20%5Clog%20%5Cdfrac%7B%5Clambda_1%7D%7B%5Clambda_2%7D%20+%20(%5Clambda_2%20-%20%5Clambda_1)%20&amp;&amp;%20%5C%5C%0A&amp;=%20%5Clambda_1%20%5Clog%20%5Cdfrac%7B%5Clambda_1%7D%7B%5Clambda_2%7D%20+%20(%5Clambda_2%20-%20%5Clambda_1)%20%5Clabel%7Beq1%7D%0A%5Cend%7Baligned%7D">
<p>Therefore we have:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cbegin%7Bequation%7D%20%5Clabel%7Beq:poisson%7D%0AD_%7B%5Ctext%7BKL%7D%7D(p(x;%20%5Clambda_1)%20%5C%7C%20p(x;%20%5Clambda_2))%20=%20%5Clambda_1%20%5Clog%20%5Cdfrac%7B%5Clambda_1%7D%7B%5Clambda_2%7D%20+%20(%5Clambda_2%20-%20%5Clambda_1)%0A%5Cend%7Bequation%7D%0A"></p>
<p>Now, consider the closed-form expression for the KL Divergence between two distributions from the same exponential family:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AD_%7B%5Ctext%7BKL%7D%7D(p(x%20%5Cvert%20%5Ceta_1)%20%5C%7C%20p(x%20%5Cvert%20%5Ceta_2))%20=%20%5Cunderset%7Bp(x%20%5Cvert%20%5Ceta_1)%7D%7B%5Cmathbb%7BE%7D%7D%5Bx%5D(%5Ceta_1-%5Ceta_2)%5ET%20-%5Cmathcal%7BA%7D(%5Ceta_1)+%5Cmathcal%7BA%7D(%5Ceta_2)%0A"></p>
<p>Plugging in each component for two Poisson distributions, we have:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(p(x;%20%5Clambda_1)%20%5C%7C%20p(x;%20%5Clambda_2))%20&amp;=%20(%5Clog%20%5Clambda_1%20-%20%5Clog%20%5Clambda_2)%20%5Cunderset%7Bp(x;%20%5Clambda_1)%7D%7B%5Cmathbb%7BE%7D%7D(x)%20-%20%5Clambda_1%20+%20%5Clambda_2%20%5C%5C%0A&amp;=%20%5Clambda_1%20%5Clog%20%5Cdfrac%7B%5Clambda_1%7D%7B%5Clambda_2%7D%20+%20%5Clambda_2%20-%20%5Clambda_1,%0A%5Cend%7Baligned%7D">
<p>which is analogous to the previous closed-form expression.</p>
<hr>
</section>
<section id="kl-divergence-minimization-meets-mle" class="level2">
<h2 class="anchored" data-anchor-id="kl-divergence-minimization-meets-mle">KL Divergence Minimization meets MLE</h2>
<p>Recall that in Maximum Likelihood Estimation, our goal is to find the parameters <img src="https://latex.codecogs.com/png.latex?%5Ctheta%5E*"> that maximizes the likelihood function, i.e.:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Ctheta%5E*_%7B%5Ctext%7BMLE%7D%7D%20&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmin%20%7D%7D%20p_%5Ctheta(x%5E%7B(1)%7D,%20x%5E%7B(2)%7D,%20%5Ccdots,%20x%5E%7B(n)%7D)%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmax%20%7D%7D%20%5Cprod_%7Bi=1%7D%5E%7Bn%7D%20p_%5Ctheta(x%5E%7B(i)%7D)%20%5Cquad%20%5Ctext%7B(suppose%20that%20$x%5E%7B(i)%7D$%20are%20i.i.d.)%7D%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmax%20%7D%7D%20%5Clog%20%5Cprod_%7Bi=1%7D%5E%7Bn%7D%20p_%5Ctheta(x%5E%7B(i)%7D)%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmax%20%7D%7D%20%20%5Csum_%7Bi=1%7D%5E%7Bn%7D%20%5Clog%20p_%5Ctheta(x%5E%7B(i)%7D).%0A%5Cend%7Baligned%7D">
<p>We now show that minimizing the KL divergence between two distributions is equivalent to MLE. Suppose our data is drawn from some arbitrary distribution <img src="https://latex.codecogs.com/png.latex?P_%7B%5Ctext%7Bdata%7D%7D">, our goal is to find the parameters <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> such that <img src="https://latex.codecogs.com/png.latex?P_%5Ctheta"> is as close to <img src="https://latex.codecogs.com/png.latex?P_%5Ctext%7Bdata%7D"> as possible. This can be achieved by minimizing the KL Divergence between <img src="https://latex.codecogs.com/png.latex?P_%7B%5Ctext%7Bdata%7D%7D"> and <img src="https://latex.codecogs.com/png.latex?P_%5Ctheta">. The objective can thus be written as:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Ctheta%5E*%20&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmin%20%7D%7D%20D_%5Ctext%7BKL%7D(P_%5Ctext%7Bdata%7D%20(x)%20%5C%7C%20P_%5Ctheta%20(x))%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmin%20%7D%7D%20%5Cint_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20P_%5Ctext%7Bdata%7D(x)%20%5Clog%20%5Cdfrac%7BP_%5Ctext%7Bdata%7D(x)%7D%7BP_%5Ctheta%20(x)%7Ddx%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmin%20%7D%7D%20%5Cunderset%7Bx%20%5Csim%20%20P_%5Ctext%7Bdata%7D(x)%7D%7B%5Cmathbb%7BE%7D%7D%20%5Cleft%5B%5Clog%20%5Cdfrac%7BP_%5Ctext%7Bdata%7D(x)%7D%7BP_%5Ctheta%20(x)%7D%5Cright%5D%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmin%20%7D%7D%20%5Cunderset%7Bx%20%5Csim%20%20P_%5Ctext%7Bdata%7D(x)%7D%7B%5Cmathbb%7BE%7D%7D%20%5B%5Clog%20P_%5Ctext%7Bdata%7D(x)%20-%20%5Clog%20P_%5Ctheta%20(x)%5D%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmin%20%7D%7D%20%5Cunderset%7Bx%20%5Csim%20%20P_%5Ctext%7Bdata%7D(x)%7D%7B%5Cmathbb%7BE%7D%7D%20%5B%5Clog%20P_%5Ctext%7Bdata%7D(x)%5D%20-%20%5Cunderset%7Bx%20%5Csim%20%20P_%5Ctext%7Bdata%7D(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Clog%20P_%5Ctheta%20(x)%5D%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmin%20%7D%7D%20%5Cunderset%7Bx%20%5Csim%20%20P_%5Ctext%7Bdata%7D(x)%7D%7B-%5Cmathbb%7BE%7D%7D%5B%5Clog%20P_%5Ctheta%20(x)%5D%20%5C%5C%0A&amp;=%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmax%20%7D%7D%20%5Cunderset%7Bx%20%5Csim%20%20P_%5Ctext%7Bdata%7D(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Clog%20P_%5Ctheta%20(x)%5D%20%5C%5C%0A&amp;%5Capprox%20%5Cunderset%7B%5Ctheta%7D%7B%5Ctext%7Bargmax%20%7D%7D%20%5Cdfrac%7B1%7D%7Bn%7D%5Csum_%7Bi=1%7D%5E%7Bn%7D%20%5Clog%20p_%5Ctheta(x%5E%7B(i)%7D).%0A%5Cend%7Baligned%7D">
<p>Now, we observe that the <img src="https://latex.codecogs.com/png.latex?%5Cfrac%7B1%7D%7Bn%7D"> term does not affect the optimization since it is a constant scalar factor independent of <img src="https://latex.codecogs.com/png.latex?%5Ctheta">. Maximizing <img src="https://latex.codecogs.com/png.latex?%5Cfrac%7B1%7D%7Bn%7D%20%5Csum_%7Bi=1%7D%5En%20%5Clog%20p_%5Ctheta(x%5E%7B(i)%7D)"> is equivalent to maximizing <img src="https://latex.codecogs.com/png.latex?%5Csum_%7Bi=1%7D%5En%20%5Clog%20p_%5Ctheta(x%5E%7B(i)%7D)">. Therefore:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctheta%5E*_%7B%5Ctext%7BMLE%7D%7D%20=%20%5Carg%5Cmax_%7B%5Ctheta%7D%20%5Csum_%7Bi=1%7D%5En%20%5Clog%20p_%5Ctheta(x%5E%7B(i)%7D)"></p>
<p>is equivalent to minimizing the KL divergence:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctheta%5E*%20=%20%5Carg%5Cmin_%7B%5Ctheta%7D%20D_%7BKL%7D(P_%5Ctext%7Bdata%7D%20%5C%7C%20P_%5Ctheta)."></p>
<hr>
</section>
</section>
<section id="kl-divergence-properties" class="level1">
<h1>KL Divergence Properties</h1>
<section id="non-negativity" class="level2">
<h2 class="anchored" data-anchor-id="non-negativity">Non-negativity</h2>
<p>Using <a href="jensen.qmd">Jensen’s inequality</a>, we can show that the KL Divergence is non-negative. Consider the following derivation:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(P%20%5C%7C%20Q)%0A&amp;=%20%5Csum_%7Bx%7D%20P(x)%20%5Clog%20%20%5Cdfrac%7BP(x)%7D%7BQ(x)%7D%20%5C%5C%0A&amp;=%20-%5Csum_%7Bx%7D%20P(x)%20%5Clog%20%20%5Cdfrac%7BQ(x)%7D%7BP(x)%7D%20%5C%5C%0A&amp;=%20%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B-%5Clog%20%5Cdfrac%7BQ(x)%7D%7BP(x)%7D%5Cright%5D%20%5C%5C%0A&amp;%5Cgeq%20-%5Clog%20%5Cunderset%7Bx%20%5Csim%20P(x)%7D%7B%5Cmathbb%7BE%7D%7D%5Cleft%5B%5Cdfrac%7BQ(x)%7D%7BP(x)%7D%5Cright%5D%20%5C%5C%0A&amp;=%20-%5Clog%20%5Csum_x%20P(x)%20%5Cdfrac%7BQ(x)%7D%7BP(x)%7D%20%5C%5C%0A&amp;=%20-%5Clog%20%5Csum_x%20Q(x)%20%5C%5C%0A&amp;=%20-%5Clog%201%20=%200.%0A%5Cend%7Baligned%7D">
<p>Therefore <img src="https://latex.codecogs.com/png.latex?D_%7B%5Ctext%7BKL%7D%7D(P(x)%20%5C%7C%20Q(x))%20%5Cgeq%200"> for all <img src="https://latex.codecogs.com/png.latex?x">.</p>
<hr>
</section>
<section id="asymmetry" class="level2">
<h2 class="anchored" data-anchor-id="asymmetry">Asymmetry</h2>
<p>In the intuition section, we see why the KL divergence needs to be asymmetric. We now formally prove that it is indeed asymmetric. We can simply do so by taking one concrete example and calculate the KL divergence between the two distributions, if these two values are not equal, then it suffices that the KL divergence is not symmetric.</p>
<p>Let <img src="https://latex.codecogs.com/png.latex?P(x)"> and <img src="https://latex.codecogs.com/png.latex?Q(x)"> be two distributions defined as:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AP(x)%20=%20%5Cbegin%7Bcases%7D%0A-1,%20&amp;%20%5Ctext%7Bw.p.%20%7D%200.5%20%5C%5C%0A1,%20&amp;%20%5Ctext%7Bw.p.%20%7D%200.5%0A%5Cend%7Bcases%7D%0A%5Cquad%20%5Ctext%7B%20and%20%7D%0AQ(x)%20=%20%5Cbegin%7Bcases%7D%0A-1,%20&amp;%20%5Ctext%7Bw.p.%20%7D%200.1%20%5C%5C%0A1,%20&amp;%20%5Ctext%7Bw.p.%20%7D%200.9%0A%5Cend%7Bcases%7D%0A"></p>
<p>You can easily verify that <img src="https://latex.codecogs.com/png.latex?D_%7B%5Ctext%7BKL%7D%7D(P%20%5C%7C%20Q)%20=%200.5%20%5Ccdot%20%5Cln%5Cleft(%5Cfrac%7B0.5%7D%7B0.1%7D%5Cright)%20+%200.5%20%5Ccdot%20%5Cln%5Cleft(%5Cfrac%7B0.5%7D%7B0.9%7D%5Cright)"> and <img src="https://latex.codecogs.com/png.latex?D_%7B%5Ctext%7BKL%7D%7D(Q%20%5C%7C%20P)%20=%200.1%20%5Ccdot%20%5Cln%5Cleft(%5Cfrac%7B0.1%7D%7B0.5%7D%5Cright)%20+%200.9%20%5Ccdot%20%5Cln%5Cleft(%5Cfrac%7B0.9%7D%7B0.5%7D%5Cright),"> and they are not equal.</p>
<hr>
</section>
<section id="convexity" class="level2">
<h2 class="anchored" data-anchor-id="convexity">Convexity</h2>
<p>A continuous function <img src="https://latex.codecogs.com/png.latex?f"> is said to be convex if</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cbegin%7Bequation%7D%20%5Clabel%7Beq:convex1%7D%0Af(%5Clambda%20x%20+%20(1-%5Clambda)y)%20%5Cleq%20%5Clambda%20f(x)%20+%20(1-%5Clambda)%20f(y)%20%5Ctext%7B%20for%20%7D%200%20%5Cleq%20%5Clambda%20%5Cleq%201.%0A%5Cend%7Bequation%7D%0A"></p>
<p>This equation can be generalized when we have two input variables. In particular, for a convex function <img src="https://latex.codecogs.com/png.latex?f(x,y)"> and two inputs <img src="https://latex.codecogs.com/png.latex?(x_1,%20y_1)">; <img src="https://latex.codecogs.com/png.latex?(x_2,%20y_2)">, it holds that:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Af(%5Clambda%20x_1%20+%20(1-%5Clambda)x_2,%20%5Clambda%20y_1%20+%20(1-%5Clambda)y_2)%20%5Cleq%20%5Clambda%20f(x_1,%20y_1)%20+%20(1-%5Clambda)%20f(x_2,%20y_2)%20%5Ctext%7B%20for%20%7D%200%20%5Cleq%20%5Clambda%20%5Cleq%201%0A"></p>
<p>Thus, to prove that the KL divergence is convex, this means that we have to prove the following statement:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cbegin%7Bequation%7D%20%5Clabel%7Beq-kl-convex%7D%0AD_%7B%5Ctext%7BKL%7D%7D%5B%5Clambda%20p_1%20+%20(1-%5Clambda)p_2%20%5C%7C%20%5Clambda%20q_1%20+%20(1-%5Clambda)q_2%5D%20%5Cleq%20%5Clambda%20D_%7B%5Ctext%7BKL%7D%7D%5Bp_1%20%5C%7C%20q_1%5D%20+%20(1-%5Clambda)%20D_%7B%5Ctext%7BKL%7D%7D(p_2%20%5C%7C%20q_2).%0A%5Cend%7Bequation%7D%0A"></p>
<p>To do this, we first need to know the <a href="log-sum.qmd">Log sum inequality</a>, which states that:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cleft(%5Csum_%7Bi=1%7D%5En%20a_i%20%5Cright)%5Clog%20%5Cdfrac%7B%5Csum_%7Bi=1%7D%5En%20a_i%7D%7B%5Csum_%7Bi=1%7D%5En%20b_i%7D%20%5Cleq%20%5Csum_%7Bi=1%7D%5En%20%5Cleft(%20a_i%20%5Clog%20%5Cdfrac%7Ba_i%7D%7Bb_i%7D%5Cright).%0A"></p>
<p>For example, if we have <img src="https://latex.codecogs.com/png.latex?a%20=%20a_1%20+%20a_2"> and <img src="https://latex.codecogs.com/png.latex?b=%20b_1+b_2">, what the Log sum inequality is telling us is the following:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cbegin%7Bequation%7D%20%5Clabel%7Beq:log-sum%7D%0A(%7Ba_1%7D%20+%20%7Ba_2%7D)%20%5Clog%20%5Cdfrac%7Ba_1+a_2%7D%7Bb_1%20+%20b_2%7D%20%5Cleq%20%7Ba_1%7D%20%5Clog%20%5Cdfrac%7Ba_1%7D%7Bb_1%7D%20+%20%7Ba_2%7D%20%5Clog%20%5Cdfrac%7Ba_2%7D%7Bb_2%7D.%0A%5Cend%7Bequation%7D%0A"></p>
<p>Let <img src="https://latex.codecogs.com/png.latex?%7Bp_%7B%5Clambda%7D%20=%20%5Clambda%20p_1%20+%20(1-%5Clambda)%20p_2%7D"> and <img src="https://latex.codecogs.com/png.latex?%7Bq_%7B%5Clambda%7D%20=%20%5Clambda%20q_1%20+%20(1-%5Clambda)%20q_2%7D">. Applying the Log sum inequality, it holds that:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D%20(p_%7B%5Clambda%7D%20%5C%7C%20q_%7B%5Clambda%7D)%20&amp;=%20%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20p_%7B%5Clambda%7D(x)%20%5Clog%20%5Cfrac%7Bp_%7B%5Clambda%7D(x)%7D%7Bq_%7B%5Clambda%7D(x)%7D%20&amp;&amp;%20%5Ctext%7B(by%20definition)%7D%20%5C%5C%0A&amp;%5Cgeq%20%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20p_%7B%5Clambda%7D(x)%20%5Clog%20%5Cfrac%7B%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20p_%7B%5Clambda%7D(x)%7D%7B%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20q_%7B%5Clambda%7D(x)%7D%20&amp;&amp;%20%5Ctext%7B(by%20log-sum%20inequality)%7D.%0A%5Cend%7Baligned%7D">
<p>Expanding out <img src="https://latex.codecogs.com/png.latex?%7Bp_%7B%5Clambda%7D%7D">$ and $<img src="https://latex.codecogs.com/png.latex?%7Bq_%7B%5Clambda%7D%7D">, we have:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D%20%5Cbig(%5Clambda%20p_1%20+%20(1-%5Clambda)%20p_2%20%5C,%20%5Cbig%5C%7C%20%5C,%20%5Clambda%20q_1%20+%20(1-%5Clambda)%20q_2%20%5Cbig)%0A&amp;=%20%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20%5Cbig(%5Clambda%20p_1(x)%20+%20(1-%5Clambda)%20p_2(x)%5Cbig)%20%5Clog%20%5Cfrac%7B%5Clambda%20p_1(x)%20+%20(1-%5Clambda)%20p_2(x)%7D%7B%5Clambda%20q_1(x)%20+%20(1-%5Clambda)%20q_2(x)%7D%20%5C%5C%0A&amp;%5Cleq%20%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20%5Cleft(%5Clambda%20p_1(x)%20%5Clog%20%5Cfrac%7B%5Clambda%20p_1(x)%7D%7B%5Clambda%20q_1(x)%7D%20+%20(1-%5Clambda)%20p_2(x)%20%5Clog%20%5Cfrac%7B(1-%5Clambda)%20p_2(x)%7D%7B(1-%5Clambda)%20q_2(x)%7D%5Cright)%20%5C%5C%0A&amp;=%20%5Clambda%20%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20p_1(x)%20%5Clog%20%5Cfrac%7Bp_1(x)%7D%7Bq_1(x)%7D%20+%20(1-%5Clambda)%20%5Csum_%7Bx%20%5Cin%20%5Cmathcal%7BX%7D%7D%20p_2(x)%20%5Clog%20%5Cfrac%7Bp_2(x)%7D%7Bq_2(x)%7D%20%5C%5C%0A&amp;=%20%5Clambda%20D_%7B%5Ctext%7BKL%7D%7D(p_1%20%5C%7C%20q_1)%20+%20(1-%5Clambda)%20D_%7B%5Ctext%7BKL%7D%7D(p_2%20%5C%7C%20q_2).%0A%5Cend%7Baligned%7D">
<p>Here, we’re applying the Log-sum inequality, where <img src="https://latex.codecogs.com/png.latex?a_1%20=%20%7B%5Clambda%20p_1%7D">, <img src="https://latex.codecogs.com/png.latex?a_2%20=%20%7B(1-%5Clambda)%20p_2%7D">, <img src="https://latex.codecogs.com/png.latex?b_1%20=%20%20%7B%5Clambda%20q_1%7D">, and <img src="https://latex.codecogs.com/png.latex?b_2%20=%20%20%7B(1-%5Clambda)%20q_2%7D">.</p>
<hr>
</section>
<section id="kl-divergence-chain-rule" class="level2">
<h2 class="anchored" data-anchor-id="kl-divergence-chain-rule">KL Divergence Chain rule</h2>
<p>We now show the KL Divergence chain rule, i.e.&nbsp;it holds that:</p>
<p><img src="https://latex.codecogs.com/png.latex?D_%7B%5Ctext%7BKL%7D%7D(P(X,Y)%20%5C%7C%20Q(X,%20Y))%20=%20D_%7B%5Ctext%7BKL%7D%7D(P(X)%20%5C%7C%20Q(X))%20+%20D_%7B%5Ctext%7BKL%7D%7D(P(Y%20%5Cvert%20X)%20%5C%7C%20Q(Y%20%5Cvert%20X))."></p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(P(X,Y)%20%5C%7C%20Q(X,%20Y))%20&amp;=%20%5Csum_X%20%5Csum_Y%20P(x,y)%20%5Clog%20%5Cfrac%7BP(x,%20y)%7D%7BQ(x,%20y)%7D%20%5C%5C%0A&amp;=%20%5Csum_X%20%5Csum_Y%20P(x)%20P(y%20%5Cvert%20x)%20%5Clog%20%5Cfrac%7BP(x)P(y%20%5Cvert%20x)%7D%7BQ(x)%20Q(y%20%5Cvert%20x)%7D%20%5C%5C%0A&amp;=%20%5Csum_X%20%5Csum_Y%20P(x)%20P(y%20%5Cvert%20x)%20%5Cleft(%5Clog%20%5Cfrac%7BP(x)%7D%7BQ(x)%20%7D%20+%20%5Clog%20%5Cfrac%7BP(y%20%5Cvert%20x)%7D%7BQ(y%20%5Cvert%20x)%7D%5Cright)%20%5C%5C%0A&amp;=%20%5Csum_X%20%20P(x)%20%5Clog%20%5Cfrac%7BP(x)%7D%7BQ(x)%20%7D%20%5Csum_Y%20P(y%20%5Cvert%20x)%20+%20%5Csum_Y%20%20P(y%20%5Cvert%20x)%20%20%5Clog%20%5Cfrac%7BP(y%20%5Cvert%20x)%7D%7BQ(y%20%5Cvert%20x)%7D%20%5Csum_X%20P(x)%20%5C%5C%0A&amp;=%20D_%7B%5Ctext%7BKL%7D%7D(P(X)%20%5C%7C%20Q(X))%20+%20D_%7B%5Ctext%7BKL%7D%7D(P(Y%20%5Cvert%20X)%20%5C%7C%20Q(Y%20%5Cvert%20X))%0A%5Cend%7Baligned%7D">
<p>This result also generalizes for <img src="https://latex.codecogs.com/png.latex?n"> random variables, i.e.:</p>
<p><img src="https://latex.codecogs.com/png.latex?D_%7B%5Ctext%7BKL%7D%7D(P(X_1,%20%5Ccdots,%20X_n)%20%5C%7C%20Q(X_1,%20%5Ccdots,%20X_n))%20=%20%5Csum_%7Bi=1%7D%5En%20D_%7B%5Ctext%7BKL%7D%7D(P(X_i%20%5Cvert%20X_1,%20%5Ccdots,%20X_%7Bi-1%7D)%20%5C%7C%20Q(X_i%20%5Cvert%20X_1,%20%5Ccdots,%20X_%7Bi-1%7D))."></p>
<hr>
</section>
<section id="approximating-the-kl-divergence-with-fisher-information" class="level2">
<h2 class="anchored" data-anchor-id="approximating-the-kl-divergence-with-fisher-information">Approximating the KL Divergence with Fisher Information</h2>
<p>The main derivation for this section is from Section 5.1.9 in <a href="https://probml.github.io/pml-book/book2.html">Probabilistic Machine Learning: Advanced Topics by Kelvin P. Murphy</a>.</p>
<p>The Fisher Information Matrix (FIM) is defined to be a covariance of the score function <img src="https://latex.codecogs.com/png.latex?%5Cnabla_%5Ctheta%20%5Clog%20p(x%20%5Cvert%20%5Ctheta)">, i.e.:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AF(%5Ctheta)%20=%20%5Cunderset%7Bx%20%5Csim%20p_%5Ctheta%20(x)%7D%7B%5Cmathbb%7BE%7D%7D%20%5B%5Cnabla_%5Ctheta%20%5Clog%20p(x%20%5Cvert%20%5Ctheta)%20%5Cnabla_%5Ctheta%20%5Clog%20p(x%20%5Cvert%20%5Ctheta)%5ET%5D.%0A"></p>
<p>Suppose we want to compute the KL Divergence term between two distributions <img src="https://latex.codecogs.com/png.latex?p_%5Ctheta(x)"> and <img src="https://latex.codecogs.com/png.latex?p_%5Ctheta'(x)">, where <img src="https://latex.codecogs.com/png.latex?%5Ctheta'%20=%20%5Ctheta%20+%20%5Cdelta">. Then we have:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(p_%5Ctheta%20(x)%20%5C%7C%20p_%7B%5Ctheta'%7D(x))%20=%20%5Cunderset%7Bp_%5Ctheta(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Clog%20p_%5Ctheta(x)%20-%20%5Clog%20p_%7B%5Ctheta'%7D(x)%5D%0A%5Cend%7Baligned%7D">
<p>Now consider the second order Taylor expansion, we have:</p>
<img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AD_%7B%5Ctext%7BKL%7D%7D(p_%5Ctheta%20(x)%20%5C%7C%20p_%7B%5Ctheta'%7D(x))%20&amp;%5Capprox%20-%5Cdelta%5ET%20%5Cunderset%7Bp_%5Ctheta(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Cnabla%20%5Clog%20p_%5Ctheta(x)%5D%20-%20%5Cdfrac%7B1%7D%7B2%7D%20%5Cdelta%5ET%20%5Cunderset%7Bp_%5Ctheta(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Cnabla%5E2%20%5Clog%20p_%5Ctheta(x)%5D%20%5Cdelta%20%5C%5C%0A&amp;=%20-%20%5Cdfrac%7B1%7D%7B2%7D%20%5Cdelta%5ET%20%5Cunderset%7Bp_%5Ctheta(x)%7D%7B%5Cmathbb%7BE%7D%7D%5B%5Cnabla%20%5Clog%20p_%5Ctheta(x)%20%5Cnabla%20%5Clog%20p_%5Ctheta(x)%5ET%5D%20%5Cdelta%20%5C%5C%0A&amp;=%20-%5Cdfrac%7B1%7D%7B2%7D%20%5Cdelta%5ET%20%5Cmathbf%7BF%7D%20%5Cdelta%0A%5Cend%7Baligned%7D">
<p>The second-order Taylor expansion of KL divergence shows that, locally, it takes a quadratic form involving the Fisher Information Matrix <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BF%7D">, which underscores its role in shaping the geometry of the parameter space, linking KL divergence to natural gradient methods and statistical inference.</p>
</section>

</section>

<div id="quarto-appendix" class="default"><section id="references" class="level2 appendix"><h2 class="anchored quarto-appendix-heading">References</h2><div class="quarto-appendix-contents">

<ul>
<li><p><a href="https://blog.alexalemi.com/kl-is-all-you-need.html">KL is all you need</a></p></li>
<li><p><a href="https://web.stanford.edu/class/archive/stats/stats200/stats200.1172/Lecture16.pdf">STATS 200: Introduction to Statistical Inference (Autumn 2016) - Lecture 16 — MLE under model misspecification</a></p></li>
<li><p><a href="https://www.kelvinc123.com/blog/2023/kl-mle/">The Dual Nature of MLE and KL Divergence in Generative Modeling</a> by Kelvin Christian.</p></li>
</ul>


</div></section></div> ]]></description>
  <category>stats</category>
  <guid>https://quocviethere.github.io/blogs/kld.html</guid>
  <pubDate>Sun, 19 Jan 2025 15:00:00 GMT</pubDate>
</item>
<item>
  <title>The VILA Model Family</title>
  <link>https://quocviethere.github.io/blogs/vila.html</link>
  <description><![CDATA[ 





<style>
/* ── Booktabs-style tables: no vertical lines, three horizontal rules ── */
table {
  border-collapse: collapse !important;
  width: 100%;
}

/* Strip all cell-level borders (overrides Bootstrap defaults) */
table > :not(caption) > * > * {
  border: none !important;
  padding: 4px 10px !important;
  font-size: 0.82em !important;
}

/* Top rule: 2px solid above header */
table > thead > tr:first-child > * {
  border-top: 2px solid #111 !important;
}

/* Mid rule: 1px solid below header */
table > thead > tr:last-child > * {
  border-bottom: 1px solid #555 !important;
}

/* Bottom rule: 2px solid below last body row */
table > tbody > tr:last-child > * {
  border-bottom: 2px solid #111 !important;
}

/* Section-separator rows (e.g. "Alternative Designs") */
table > tbody > tr.section-sep > * {
  border-top: 0.75px solid #aaa !important;
  font-weight: 600;
}

/* Unified caption: below the table, grey, justified, small */
table caption {
  caption-side: bottom;
  color: #555;
  font-size: 0.82em;
  text-align: justify;
  padding: 5px 2px 0 2px;
  line-height: 1.45;
}
</style>
<hr style="width: 100%; height: 4px; solid grey;">
<details>
<summary>
Change log
</summary>
<ul>
<li><strong>Feb 10:</strong> Add <a href="https://arxiv.org/pdf/2401.12902">Elephant in the room</a>.<br>
</li>
<li><strong>Feb 09:</strong> Move back from al-folio to Quarto :).</li>
</ul>
</details>
<hr style="width: 100%; height: 4px; solid grey;">
<p>For a long time, traditional ML models focus only on one modality, such as text, image, or audio. As humans, we are capable of dealing with multiple modalities at the same time. The human experience is multimodal. We see, hear, smell, and touch. In addition, the Internet and many applications nowadays are multimodal. For example, we can rarely see any webpages that contain only text or images, and we hardly watch any video without any sound. The explosion of Internet data comes with vast data resources and availability that we can use to train advanced AI models.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/vila_demo.gif" class="img-fluid figure-img"></p>
<figcaption><em>A sample video description generated by the VILA1.5-3b model running on Jetson Orin NX.</em></figcaption>
</figure>
</div>
<p>While there are many different modalities that have been considered in the ML community, in this blog post, we will focus on vision and text modality. There are many different ways that we can use to categorize Vision-Language Models, either based on their training paradigms, input/output modalities, or pre-training objectives. Following Bordes et al.&nbsp;(2024) <span class="citation" data-cites="vlm-survey1">[1]</span>, one way of categorizing different VLMs is via their training paradigms, which include 1) contrastive; 2) masking; 3) generative; and 4) using pre-trained backbones. These methods are, however, not mutually exclusive, there have been work that combine two or more training paradigms. Among the most popular VLMs, VILA <span class="citation" data-cites="vila">[2]</span> and its variants are a family of models that focus on efficiency while maintaining impressive performance.</p>
<section id="vila" class="level1">
<h1><strong>VILA</strong></h1>
<hr style="width: 100%; height: 4px; solid grey;">
<p>Given the explosion of LLMs in recent years, it is natural to come up with ways to extend such LLMs to be able to work with the visual modality (eg images and videos). VILA <span class="citation" data-cites="vila">[2]</span> is a VLM introduced by NVIDIA and MIT that is based on such approach by integrating visual and textual information. It is pre-trained based on the recipes that the authors observe. At its core, VILA consists of three main components, including 1) a visual encoder, 2) an LLM, and 3) a projector. The vision backbone is CLIP visual encoder <span class="citation" data-cites="clip">[3]</span> and the LLM used is Llama2-7b and Llama2-13b <span class="citation" data-cites="llama2">[4]</span>. A projector acts as a mapping to connect the images and text embeddings onto the same space, it can either be as simple as a linear layer or MLP, or as complicated as a Transformer block. VILA takes visual and text inputs and generates text outputs. This section outlines several design choices to improve the model’s performance based on empirical observation.</p>
<section id="full-fine-tuning-or-visual-prompt-tuning" class="level2">
<h2 class="anchored" data-anchor-id="full-fine-tuning-or-visual-prompt-tuning">Full fine-tuning or visual prompt tuning ?</h2>
<p>The two common methods that have often been used to augment LLMs with visual inputs is either to 1) fine-tune the LLM with the visual tokens (also referred to as <strong>(full) fine-tuning</strong>) or 2) only train the visual input while freezing the weights of the LLM (often known as <strong>(visual) prompt tuning</strong>). The prompt-tuning approach treats the visual input projector as a way to “prompt” the LLM with visual embeddings while keeping the text-only model intact. It can be thought of as a “translator” between the vision encoder and the text-only LLM, effectively acting as the “prompt.”</p>
<p>The question of whether to use the former or latter approach comes with different tradeoffs. While fine-tuning is essential for the VLM to inherit the LLMs’ in-context learning ability, it comes with the risk of <em>catastrophic forgetting</em>, where the model’s ability degrades on text-only tasks. Such a problem can be prevented by using prompt tuning, however, this leads to poor performance and degrades in-context learning capabilities.</p>
<div id="tbl-pret" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-pret-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;1: Performance comparison of different LLM training settings with varying projector types and fine-tuning strategies. 0s denotes zero-shot and 4s denotes 4-shot setting.
</figcaption>
<div aria-describedby="tbl-pret-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 5%">
<col style="width: 3%">
<col style="width: 2%">
<col style="width: 6%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 9%">
<col style="width: 9%">
<col style="width: 7%">
<col style="width: 7%">
<col style="width: 7%">
<col style="width: 7%">
<col style="width: 8%">
<col style="width: 8%">
</colgroup>
<thead>
<tr class="header">
<th>Setting</th>
<th>PreT</th>
<th>SFT</th>
<th>Projector</th>
<th>OKVQA (0s)</th>
<th>OKVQA (4s)</th>
<th>TextVQA (0s)</th>
<th>TextVQA (4s)</th>
<th>COCO (0s)</th>
<th>COCO (4s)</th>
<th>Flickr (0s)</th>
<th>Flickr (4s)</th>
<th>Average (0s)</th>
<th>Average (4s)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>a)</td>
<td>✗</td>
<td>✗</td>
<td>Transformer</td>
<td>10.4</td>
<td>19.2</td>
<td>14.8</td>
<td>23.1</td>
<td>17.4</td>
<td>60.2</td>
<td>11.0</td>
<td>47.4</td>
<td>13.4</td>
<td>37.5</td>
</tr>
<tr class="even">
<td>b)</td>
<td>✗</td>
<td>✓</td>
<td>Transformer</td>
<td>47.1</td>
<td>47.7</td>
<td>37.2</td>
<td>36.6</td>
<td>109.4</td>
<td>88.0</td>
<td>73.6</td>
<td>58.1</td>
<td>66.8</td>
<td>57.6</td>
</tr>
<tr class="odd">
<td>c)</td>
<td>✓</td>
<td>✓</td>
<td>Transformer</td>
<td>44.8</td>
<td>49.8</td>
<td>38.5</td>
<td>38.8</td>
<td>112.3</td>
<td>113.5</td>
<td>71.5</td>
<td>72.9</td>
<td>66.8</td>
<td>68.8</td>
</tr>
<tr class="even">
<td>d)</td>
<td>✓</td>
<td>✓</td>
<td>Linear</td>
<td>45.2</td>
<td>50.3</td>
<td>39.7</td>
<td>40.2</td>
<td>115.7</td>
<td>118.5</td>
<td>74.2</td>
<td>74.7</td>
<td>68.7</td>
<td>70.9</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p><strong>Full fine-tuning is important.</strong> In the VILA paper, the authors did experiments with different settings (A-D, where setting a) and b) focus on prompt tuning (LLM is frozen); c) and d) involve fine-tuning (LLM is updated). Table&nbsp;1 shows that freezing the LLM during pre-training does not negatively impact zero-shot accuracy, but it results in a reduced ability for in-context learning. Another observation from this experiment is that using a simple projector (linear layer) leads to better performance. The hypothesis is that using a simple projector enforces the LLM to learn more from visual tokens, and thus the model can generalize better.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/pret.png" class="img-fluid figure-img"></p>
<figcaption><strong>Left.</strong> Visual Prompt Tuning freezes the LLMs weights in <img src="https://latex.codecogs.com/png.latex?N"> layers <img src="https://latex.codecogs.com/png.latex?L_1,%20L_2,%20%5Ccdots,%20L_N">, updating only a subset of parameters, which lead to in-context ability degradation. <strong>Middle.</strong> Full Fine-Tuning updates the weights of the LLM in every layer. <strong>Right.</strong> Bar chart comparing their performance in 0-shot (0s) and 4-shot (4s) settings. Figure adapted from Cheng et al.&nbsp;(2024) <span class="citation" data-cites="pret">[5]</span>, bar chart based on Lin et al.&nbsp;(2024)’s empirical results <span class="citation" data-cites="vila">[2]</span>.</figcaption>
</figure>
</div>
<p>The benefits of full finetuning approach is, however, depends on the size of the downstream dataset size, as shown by Cheng et al.&nbsp;(2024) in Figure&nbsp;1.</p>
<div id="fig-fft" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-fft-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://quocviethere.github.io/assets/vila/fft.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-fft-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: VTAB-1k analysis across Natural (left), Specialized (middle), and Structured (right) tasks. FT (solid) vs.&nbsp;VPT (dotted) accuracy shows FT outperforming VPT in 9/12 cases as dataset size increases.
</figcaption>
</figure>
</div>
</section>
<section id="training-data" class="level2">
<h2 class="anchored" data-anchor-id="training-data">Training Data</h2>
<p>Training data is one of the most important aspects of training VLMs <sup>1</sup>. Some common practices to preprocess the image-text data are to 1) remove the duplicate, 2) balance the labels, 3) prune (removing the data pairs where the captions do not match with the image), and 4) improve the captions with other LLMs.</p>
<p>The two most common types of data used for training VLMs include interleaved image-text data and image-text pair data (i.e.&nbsp;the images and their corresponding captions). In the VILA paper, the authors train the model with different types of data to analyze their influence on the model’s performance.</p>
<section id="interleaved-or-image-text-pair-data" class="level3">
<h3 class="anchored" data-anchor-id="interleaved-or-image-text-pair-data">Interleaved or Image-text pair Data ?</h3>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/data1.png" class="img-fluid figure-img"></p>
<figcaption>Figure 2. <em>An example of the difference between interleaved image-text data (top) and image-text pair data (bottom).</em></figcaption>
</figure>
</div>
<p>The VILA paper shows that interleaved image-text data like MMC4 <span class="citation" data-cites="mmc4">[6]</span> is more effective regarding training VLM because it prevents the model from catastrophic forgetting, which can degrade the model’s text capability. For example, using COYO <span class="citation" data-cites="coyo-700m">[7]</span>, an image-text pair dataset for pretraining can lead to text-only accuracy (MMLU) degrading by 17.2%, while training the model using MMC4 interleaved dataset degrades text-only accuracy by only 5%. This degradation gap can further be addressed when using a larger LLM. A similar conclusion is provided in the Flamingo paper <span class="citation" data-cites="flamingo">[8]</span>, where interleaved data is found to be better to reserve the model’s text-only capability, as shown in Table&nbsp;2.</p>
<div id="tbl-2" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;2: Ablated study on pre-training data for Flamingo-3B model. Without training the model on M3W, an interleaved image-text data, the model overall performance drops significantly. Table Source: Alayrac et al., (2022) <span class="citation" data-cites="flamingo">[8]</span>.
</figcaption>
<div aria-describedby="tbl-2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 24%">
<col style="width: 4%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 13%">
</colgroup>
<thead>
<tr class="header">
<th>Ablated Setting</th>
<th>Step</th>
<th>COCO <br> CIDEr ↑</th>
<th>OKVQA <br> top1 ↑</th>
<th>VQAv2 <br> top1 ↑</th>
<th>MSVDQA <br> top1 ↑</th>
<th>VATEX <br> CIDEr ↑</th>
<th>Overall <br> score ↑</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Flamingo-3B model</strong></td>
<td>1.74s</td>
<td>86.5</td>
<td>42.1</td>
<td>55.8</td>
<td>36.3</td>
<td>53.4</td>
<td>70.7</td>
</tr>
<tr class="even">
<td><strong>w/o Video-Text pairs</strong></td>
<td>1.42s</td>
<td>84.2</td>
<td>43.0</td>
<td>53.9</td>
<td>34.5</td>
<td>46.0</td>
<td>67.3</td>
</tr>
<tr class="odd">
<td><strong>w/o Image-Text pairs</strong></td>
<td>0.95s</td>
<td>66.3</td>
<td>39.2</td>
<td>51.6</td>
<td>32.0</td>
<td>41.6</td>
<td>60.9</td>
</tr>
<tr class="even">
<td><strong>Image-Text pairs → LAION</strong></td>
<td>1.74s</td>
<td>79.5</td>
<td>41.4</td>
<td>53.5</td>
<td>33.9</td>
<td>47.6</td>
<td>66.4</td>
</tr>
<tr class="odd">
<td><strong>w/o M3W</strong></td>
<td>1.02s</td>
<td>54.1</td>
<td>36.5</td>
<td>52.7</td>
<td>31.4</td>
<td>23.5</td>
<td>53.4</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>Given this observation, the authors propose Joint Supervised Fine-tuning (SFT), which blends text-only instruction data with visual instruction-tuning data to improve the model’s textual ability. Such training technique, according to the ablation study, reduces the degradation in text-only accuracy while improving the visual language accuracy at the same time, as shown in Table&nbsp;3.</p>
<div id="tbl-3" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-3-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;3: Ablation study for Joint SFT. Additionally adding text instruction tuning data for SFT helps reduce the model drop on MMLU benchmark. Table Source: Lin et al., (2024) <span class="citation" data-cites="vila">[2]</span>.
</figcaption>
<div aria-describedby="tbl-3-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>PT Data</th>
<th>SFT Data</th>
<th>VLM Acc. (avg)</th>
<th>MMLU Acc.</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Llama-2</td>
<td>-</td>
<td>-</td>
<td>46.0%</td>
</tr>
<tr class="even">
<td>MMC4</td>
<td>Visual</td>
<td>68.7% / 70.9%</td>
<td>40.7% (-5.3%)</td>
</tr>
<tr class="odd">
<td>MMC4+COYO</td>
<td>Visual</td>
<td>69.0% / 71.3%</td>
<td>40.2% (-5.8%)</td>
</tr>
<tr class="even">
<td>Llama-2</td>
<td>Text</td>
<td>-</td>
<td>51.2%</td>
</tr>
<tr class="odd">
<td>MMC4</td>
<td>Vis.+Text</td>
<td>71.0% / 72.1%</td>
<td>51.4% (+0.2%)</td>
</tr>
<tr class="even">
<td>MMC4+COYO</td>
<td>Vis.+Text</td>
<td>72.3% / 73.6%</td>
<td>50.9% (-0.3%)</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
</section>
<section id="image-resolution-or-number-of-tokens" class="level3">
<h3 class="anchored" data-anchor-id="image-resolution-or-number-of-tokens">Image resolution or number of tokens ?</h3>
<p>TL;DR: Image resolution</p>
<p>In VILA experiments, as shown in Table&nbsp;4, increasing the image resolution from 224 to 336 increases the TextVQA benchmark from 41.6% to 49.8%. The tradeoff is that a higher-resolution image leads to more tokens per image (336x336 corresponds to 576 tokens/image) and a higher computational cost, which is even worse for video understanding given the limited context length.</p>
<div id="tbl-resolution" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-resolution-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;4: Ablation study for image resolution. Table Source: Lin et al., (2024) <span class="citation" data-cites="vila">[2]</span>.
</figcaption>
<div aria-describedby="tbl-resolution-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Resolution</th>
<th>Projector</th>
<th>#Tokens</th>
<th>OKVQA</th>
<th>TextVQA</th>
<th>COCO</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>224</td>
<td>linear</td>
<td>256</td>
<td>49.9%</td>
<td>41.6%</td>
<td>116.0</td>
</tr>
<tr class="even">
<td>336</td>
<td>linear</td>
<td>576</td>
<td>49.7%</td>
<td>49.8%</td>
<td>117.7</td>
</tr>
<tr class="odd">
<td>336</td>
<td>downsample</td>
<td>144</td>
<td>49.3%</td>
<td>45.6%</td>
<td>115.7</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>However, the raw resolution matters more than the number of visual tokens/images. The authors’ solution is to reduce the number of visual tokens using a downsample projector that concatenated every 2x2 token into a single one and used the linear layer to fuse the information. Using such a downsample projector improves the TextVQA accuracy from 41.6% to 45.6%, compared to 49.8% when we naively feed the 336x336 image.</p>
</section>
<section id="data-quality-or-quantity" class="level3">
<h3 class="anchored" data-anchor-id="data-quality-or-quantity">Data quality or quantity?</h3>
<p>TL;DR: Data quality</p>
<p>In VILA experiments, scaling up the dataset size from 25M to 50M doesn’t give much benefit, but adding 1M of high-quality data improves the benchmark results. The data quality is quantified using the CLIPScore <span class="citation" data-cites="clipscore">[9]</span>.</p>
<div id="tbl-datacomp" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-datacomp-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;5: Effect of data quality on ImageNet accuracy. Training on DATAComp-1B achieves the highest accuracy with ~60.8% less data.
</figcaption>
<div aria-describedby="tbl-datacomp-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 15%">
<col style="width: 13%">
<col style="width: 16%">
<col style="width: 14%">
<col style="width: 22%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>Dataset</th>
<th>Dataset size</th>
<th># samples seen</th>
<th>Architecture</th>
<th>Train compute (MACs)</th>
<th>ImageNet accuracy</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>OpenAI’s WIT</td>
<td>0.4B</td>
<td>13B</td>
<td>ViT-L/14</td>
<td>1.1 × 10²¹</td>
<td>75.5%</td>
</tr>
<tr class="even">
<td>LAION-400M</td>
<td>0.4B</td>
<td>13B</td>
<td>ViT-L/14</td>
<td>1.1 × 10²¹</td>
<td>72.8%</td>
</tr>
<tr class="odd">
<td>LAION-2B</td>
<td>2.3B</td>
<td>13B</td>
<td>ViT-L/14</td>
<td>1.1 × 10²¹</td>
<td>73.1%</td>
</tr>
<tr class="even">
<td>LAION-2B</td>
<td>2.3B</td>
<td>34B</td>
<td>ViT-H/14</td>
<td>6.5 × 10²¹</td>
<td>78.0%</td>
</tr>
<tr class="odd">
<td>LAION-2B</td>
<td>2.3B</td>
<td>34B</td>
<td>ViT-g/14</td>
<td>9.9 × 10²¹</td>
<td>78.5%</td>
</tr>
<tr class="even">
<td>DATAComp-1B</td>
<td>1.4B</td>
<td>13B</td>
<td>ViT-L/14</td>
<td>1.1 × 10²¹</td>
<td>79.2%</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>There exists another benchmark such as DATAComp <span class="citation" data-cites="datacomp">[10]</span> with the same observation that data quality matters more than quantity regarding training VLMs. Table&nbsp;5 from the DATAComp paper shows the effect of data quality on the ImageNet classification task.</p>
</section>
</section>
</section>
<section id="vila2" class="level1">
<h1><strong>VILA<img src="https://latex.codecogs.com/png.latex?%5E2"></strong></h1>
<hr style="width: 100%; height: 4px; solid grey;">
<p>Data curation for training vision-language models (VLMs) is both costly and challenging, often limited by closed-source model APIs or the use of noisy web-crawled data. When data is sourced from the internet, its quality cannot be reliably ensured. One problem with Internet-crawled and available public image-text datasets such as MMC4 <span class="citation" data-cites="mmc4">[6]</span> and COYO <span class="citation" data-cites="coyo-700m">[7]</span> is that the captions associated with the images are often of short length and that human descriptions of the image often lack semantic elements (which is essential for LLM). shows the average caption length. It can roughly be inferred that the longer the caption length, the better the performance of the models on VQAv2 benchmark. Note that the MMC4 dataset is not re-captioned because of its interleaved nature.</p>
<div id="tbl-caption-length" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-caption-length-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;6: The effect of caption length on the model performance on VQAv2 benchmark. Only the COYO dataset is recaptioned. The MMC4 dataset is not recaptioned due to the interleaved nature. Table source: Fang, et al., (2024) <span class="citation" data-cites="vila2">[11]</span>
</figcaption>
<div aria-describedby="tbl-caption-length-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 12%">
<col style="width: 10%">
<col style="width: 10%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th></th>
<th>MMC4</th>
<th>COYO</th>
<th>COYO-VILA₁</th>
<th>COYO-VILA₂</th>
<th>COYO-VILA₃</th>
<th>COYO-VILA₄</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Avg #Words</td>
<td>17.1 ± 25.0</td>
<td>11.9 ± 9.0</td>
<td>101.2 ± 43.0</td>
<td>117.1 ± 49.1</td>
<td>126.77 ± 50.10</td>
<td>125.9 ± 51.2</td>
</tr>
<tr class="even">
<td>VQAv2</td>
<td>N.A.</td>
<td>61.6</td>
<td>62.5</td>
<td>63.5</td>
<td>63.7</td>
<td>63.6</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>Motivated by this, VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> is proposed and introduces a VLM augmentation scheme that includes <strong>self-augment</strong> and <strong>specialist-augment</strong> steps to improve the data quality. On a high level, the captions corresponding to the images in the COYO dataset are first rewritten using the VILA model.</p>
<p>Such an approach to rewriting the image captions is similar to the BLIP model <span class="citation" data-cites="blip">[12]</span> except for two main differences. First, BLIP uses an additional filtering step to preprocess the data. Second, in VILA<img src="https://latex.codecogs.com/png.latex?%5E2">, the caption rewriting process is repeated three times, resulting in the artifact models dubbed VILA<img src="https://latex.codecogs.com/png.latex?_1">, VILA<img src="https://latex.codecogs.com/png.latex?_2">, VILA<img src="https://latex.codecogs.com/png.latex?_3">, … Such a process is called self-augmenting. Meanwhile, for BLIP, the captions are rewritten only once with a pre-trained image-grounded text decoder. Both BLIP and VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> models blend in human-annotated with the synthetic data. The VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> paper shows the improved benchmark when mixing the human-annotated and the synthetic data together. One problem arises when the performance of the model is bounded by the ability of the captioners. Moreover, to the fourth iteration of self-augmenting (in Table 7), there is no longer an increase in performance.</p>
<div id="tbl-vila-iter" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-vila-iter-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;7: VILA<img src="https://latex.codecogs.com/png.latex?_i">’s performance on different benchmarks after i<img src="https://latex.codecogs.com/png.latex?%5E%7Bth%7D"> iterations. Up to the fourth iteration, there is no further increase in performance, suggesting the need for a more specialized augmentation scheme. Table source: Fang et al.&nbsp;(2024) <span class="citation" data-cites="vila2">[11]</span>.
</figcaption>
<div aria-describedby="tbl-vila-iter-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 22%">
<col style="width: 10%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 8%">
</colgroup>
<thead>
<tr class="header">
<th>Method</th>
<th style="text-align: right;">VQAv2</th>
<th style="text-align: right;">GQA</th>
<th style="text-align: right;">SQA1</th>
<th style="text-align: right;">VQAT</th>
<th style="text-align: right;">POPE</th>
<th style="text-align: right;">LLaVAW</th>
<th style="text-align: right;">MM-Vet</th>
<th style="text-align: right;">MMMU</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>VILA0 - Baseline</td>
<td style="text-align: right;">79.6</td>
<td style="text-align: right;">62.4</td>
<td style="text-align: right;">68.4</td>
<td style="text-align: right;">61.6</td>
<td style="text-align: right;">84.2</td>
<td style="text-align: right;">68.4</td>
<td style="text-align: right;">34.5</td>
<td style="text-align: right;">33.8</td>
</tr>
<tr class="even">
<td>VILA1</td>
<td style="text-align: right;">80.0</td>
<td style="text-align: right;">63.2</td>
<td style="text-align: right;">71.0</td>
<td style="text-align: right;">62.5</td>
<td style="text-align: right;">84.6</td>
<td style="text-align: right;">72.2</td>
<td style="text-align: right;">34.8</td>
<td style="text-align: right;">35.8</td>
</tr>
<tr class="odd">
<td>VILA2</td>
<td style="text-align: right;">80.8</td>
<td style="text-align: right;">63.5</td>
<td style="text-align: right;">71.5</td>
<td style="text-align: right;">63.5</td>
<td style="text-align: right;">84.7</td>
<td style="text-align: right;">71.2</td>
<td style="text-align: right;">34.9</td>
<td style="text-align: right;">35.2</td>
</tr>
<tr class="even">
<td>VILA3</td>
<td style="text-align: right;">80.7</td>
<td style="text-align: right;">63.5</td>
<td style="text-align: right;">71.5</td>
<td style="text-align: right;">63.7</td>
<td style="text-align: right;">84.5</td>
<td style="text-align: right;">72.3</td>
<td style="text-align: right;">35.5</td>
<td style="text-align: right;">35.5</td>
</tr>
<tr class="odd">
<td>VILA4</td>
<td style="text-align: right;">80.7</td>
<td style="text-align: right;">63.4</td>
<td style="text-align: right;">71.2</td>
<td style="text-align: right;">63.6</td>
<td style="text-align: right;">85.0</td>
<td style="text-align: right;">72.3</td>
<td style="text-align: right;">35.5</td>
<td style="text-align: right;">35.0</td>
</tr>
<tr class="even">
<td>VILA3 + <em>Spatial Specialist</em></td>
<td style="text-align: right;">81.1</td>
<td style="text-align: right;">62.8</td>
<td style="text-align: right;">72.9</td>
<td style="text-align: right;">65.0</td>
<td style="text-align: right;">85.0</td>
<td style="text-align: right;">71.4</td>
<td style="text-align: right;">37.1</td>
<td style="text-align: right;">36.8</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>Thus, the authors propose specialist-augment method that requires the model so that it has better cappabilities by integrating specialist tasks for the model, including 1) spatial understanding, 2) grounding, and 3) OCR using different datasets.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/vila2-specialist.png" class="img-fluid figure-img"></p>
<figcaption>An overview of specialist augmentation methods for VILA<img src="https://latex.codecogs.com/png.latex?%5E2">. Figure from <span class="citation" data-cites="vila2">[11]</span></figcaption>
</figure>
</div>
<p>Table shows the ablation result on the effect of different specialist augmentation methods. Overall, specialist augmentation helps improve the model performance on several benchmarks.</p>
<table class="table table-sm">
<caption>
Ablation study on specialist augmentation methods. Specialist augmentation consistently improves model performance across benchmarks. Table source: Fang et al.&nbsp;(2024) <span class="citation" data-cites="vila2">[11]</span>.
</caption>
<thead>
<tr>
<th>
Method
</th>
<th>
VQAv2
</th>
<th>
GQA
</th>
<th>
VQAT
</th>
<th>
POPE
</th>
<th>
SEED-I
</th>
<th>
MME
</th>
<th>
MM-Vet
</th>
<th>
MMMU
</th>
</tr>
</thead>
<tbody>
<tr class="section-sep">
<td colspan="9">
10% MMC4-core + 10% COYO-25M + ShareGPT4V-Pretrain
</td>
</tr>
<tr>
<td>
Original Caption
</td>
<td>
81.4
</td>
<td>
63.8
</td>
<td>
65.2
</td>
<td>
85.5
</td>
<td>
70.6
</td>
<td>
1472.5
</td>
<td>
34.0
</td>
<td>
31.8
</td>
</tr>
<tr>
<td>
+Spatial Specialist
</td>
<td>
81.9<sub style="color:green;">↑0.5</sub>
</td>
<td>
64.1<sub style="color:green;">↑0.3</sub>
</td>
<td>
66.0<sub style="color:green;">↑0.8</sub>
</td>
<td>
85.9<sub style="color:green;">↑0.4</sub>
</td>
<td>
71.8<sub style="color:green;">↑1.2</sub>
</td>
<td>
1476.5<sub style="color:green;">↑4.0</sub>
</td>
<td>
36.7<sub style="color:green;">↑2.7</sub>
</td>
<td>
32.5<sub style="color:green;">↑0.7</sub>
</td>
</tr>
<tr>
<td>
+OCR Specialist
</td>
<td>
81.8<sub style="color:green;">↑0.4</sub>
</td>
<td>
64.0<sub style="color:green;">↑0.2</sub>
</td>
<td>
65.3<sub style="color:green;">↑0.1</sub>
</td>
<td>
86.4<sub style="color:green;">↑0.9</sub>
</td>
<td>
72.1<sub style="color:green;">↑1.5</sub>
</td>
<td>
1500.2<sub style="color:green;">↑27.7</sub>
</td>
<td>
34.3<sub style="color:green;">↑0.3</sub>
</td>
<td>
32.1<sub style="color:green;">↑0.3</sub>
</td>
</tr>
<tr>
<td>
+Grounding Specialist
</td>
<td>
81.8<sub style="color:green;">↑0.4</sub>
</td>
<td>
64.0<sub style="color:green;">↑0.2</sub>
</td>
<td>
65.1<sub style="color:red;">↓0.1</sub>
</td>
<td>
86.7<sub style="color:green;">↑1.2</sub>
</td>
<td>
71.0<sub style="color:green;">↑0.4</sub>
</td>
<td>
1536.4<sub style="color:green;">↑63.9</sub>
</td>
<td>
37.5<sub style="color:green;">↑3.5</sub>
</td>
<td>
32.6<sub style="color:green;">↑0.8</sub>
</td>
</tr>
<tr class="section-sep">
<td colspan="9">
MMC4-core + COYO-25M + ShareGPT4V-Pretrain
</td>
</tr>
<tr>
<td>
Original Caption
</td>
<td>
82.2
</td>
<td>
63.9
</td>
<td>
66.7
</td>
<td>
86.5
</td>
<td>
71.2
</td>
<td>
1518.2
</td>
<td>
42.6
</td>
<td>
33.4
</td>
</tr>
<tr>
<td>
+All 3 Specialists
</td>
<td>
83.0<sub style="color:green;">↑0.8</sub>
</td>
<td>
64.7<sub style="color:green;">↑0.8</sub>
</td>
<td>
70.9<sub style="color:green;">↑4.2</sub>
</td>
<td>
86.4<sub style="color:red;">↓0.1</sub>
</td>
<td>
74.0<sub style="color:green;">↑2.8</sub>
</td>
<td>
1656.2<sub style="color:green;">↑142</sub>
</td>
<td>
44.7<sub style="color:green;">↑2.1</sub>
</td>
<td>
35.8<sub style="color:green;">↑2.4</sub>
</td>
</tr>
</tbody>
</table>
<p>VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> is trained using a common three-stage align-pretrain-SFT paradigm, including initializing the projector, pre-training vision-language using both interleaved image-text data and image-text pair data (with the rewritten captions). Finally, visual instruction tuning is applied. VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> is ranked among the most performant models among open-source VLMs. The figure below compares the performance of VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> across various benchmark. <iframe src="../assets/vila/vila2.html" width="120%" height="350px" style="border:none;  overflow: hidden;" scrolling="no"></iframe> The authors also show that data quality matters more than computation. In particular, VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> for one additional epoch does not improve the performance, while increasing the data quality (by rewriting the caption using VILA itself) significantly boosts the performance compared to training with one more epoch.</p>
</section>
<section id="longvila" class="level1">
<h1><strong>LongVILA</strong></h1>
<hr style="width: 100%; height: 4px; solid grey;">
<p>LongVILA <span class="citation" data-cites="longvila">[13]</span> addresses the challenge of processing long context in terms of the pipeline and the system. On the pipeline side, LongVILA introduces two new training paradigms including <strong>long context extension</strong> and <strong>long video-supervised fine-tuning</strong>. On the system side, they propose long-context <strong>Multi-modal Sequence parallelism (MM-SP)</strong> to parallelize video training and inference to further utilize the GPU computation.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/VILA Model Family.png" class="img-fluid figure-img"></p>
<figcaption>Overview of LongVILA training stages. Figure from <span class="citation" data-cites="longvila">[13]</span></figcaption>
</figure>
</div>
<p>In LongVILA, there are five training stages; including 1) multimodal alignment; 2) large-scale pre-training; 3) short supervised fine-tuning; 4) context extension for LLMs; and 5) long supervised fine-tuning.</p>
<p>The first three stages are similar to that of the VILA model:</p>
<ul>
<li><p>In stage 1, only the multimodal projector is trained.</p></li>
<li><p>In stage 2, the vision encoder is frozen and the LLM and multimodal projector is trained. VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> is applied to improve the dataset quality.</p></li>
<li><p>In stage 3, the model is fine-tuned with instruction-following data with images and short video datasets.</p></li>
<li><p>In stage 4, the LLM is pre-trained with text-only dataset to extend the context lengths. The LLM is progressively trained with different context length, ranging from 8192 to 262144.</p></li>
<li><p>In stage 5, the proposed MM-SP system is used to enhance the instruction-following ability, and all of the parameters are trainable in this stage.</p></li>
</ul>
<section id="training-data-1" class="level2">
<h2 class="anchored" data-anchor-id="training-data-1">Training data</h2>
<p>LongVILA adopts the VILA<img src="https://latex.codecogs.com/png.latex?%5E2"> method to first re-caption the images in the COYO dataset using the VILA model itself. In the supervised fine-tuning process, YouCook2 and ShareGPTVideo is used to train the model for short video comprehension.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/longvila-data.png" class="img-fluid figure-img"></p>
<figcaption>Proportion of data categories in LongVILA dataset. Figure from <span class="citation" data-cites="longvila">[13]</span>.</figcaption>
</figure>
</div>
<p>In addition, a new dataset consisting of over 15 thousands videos is introduced for long video instruction following in stage 5 of the model training process.</p>
</section>
<section id="multi-modal-sequence-parallelism" class="level2">
<h2 class="anchored" data-anchor-id="multi-modal-sequence-parallelism">Multi-modal Sequence Parallelism</h2>
<p>Previous methods of processing long context length have two limitations, one is modality heterogeneity and the other is networking heterogeneity. For Modality Heterogeneity, the text tokens are easy and fast to process, while visual tokens (like images or video frames) are more complex and require more resources. This can lead to an imbalance in GPU workloads, where some GPUs do much more work than others. For Networking Heterogeneity, GPUs that are close together (within the same machine) communicate very fast using NVLink, but GPUs that are far apart (across different machines) communicate more slowly using InfiniBand. This speed difference can create bottlenecks, slowing down the system.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/longvila-mmsp.png" class="img-fluid figure-img"></p>
<figcaption>Overview of the Multimodal Sequence Parallelism method. Figure from <span class="citation" data-cites="longvila">[13]</span>.</figcaption>
</figure>
</div>
<p>The two keys techniques adopted to address the aforementioned challenges are 2D-Attention <span class="citation" data-cites="2dattention">[14]</span> and two-stage sharding to distribute the work more evenly across multiple GPUs. The 2D-attention mechanism optimizes communication by organizing GPUs into a two dimensional mesh: intra-node communication is handled by splitting data along the attention head dimension, while inter-node communication transfers partitioned data chunks between GPUs. This structure ensures efficient and balanced computation.</p>
<p>To handle modality heterogeneity, the two-stage sharding strategy first distributes images evenly across GPUs for the image encoding stage. Then, in the second stage, it aggregates vision and text inputs, distributing tokens evenly for language modeling. This approach balances workloads across GPUs and maintains consistency using techniques like dummy token padding. For inference, the authors implement a system where all GPUs operate concurrently, avoiding bottlenecks in traditional methods like HuggingFace Pipeline Parallelism. This allows for efficient use of memory and computation, enabling the handling of longer sequences and faster processing.</p>
</section>
</section>
<section id="vila-u-a-unified-vlm" class="level1">
<h1><strong>VILA-U: A Unified VLM</strong></h1>
<hr style="width: 100%; height: 4px; solid grey;">
<p>At its core, VILA-U <span class="citation" data-cites="vila-u">[15]</span> is built upon two main principles: 1) creating an end-to-end autoregressive VLM that is able to generate images along with textual input alignment (instead of just trying to reconstruct the images); and 2) autoregressive image generators can create images that is of comparable quality to diffusion models as long as it is trained on a high-quality image-text dataset.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/vila-u.png" class="img-fluid figure-img"></p>
<figcaption>Overall architecture of VILA-U. The model is capable of both visual understanding and generation. Figure from <span class="citation" data-cites="vila-u">[15]</span>.</figcaption>
</figure>
</div>
<p>While developing a generative VLM is not new, previous works often offload the generation task to a seperate model, either Diffusion model <span class="citation" data-cites="emu jin2024unified">[16, 17]</span> or combining VQ-GAN and LLM <span class="citation" data-cites="yu2023scaling">[18]</span>. The key novelty in VILA-U is its unified approach to visual and text generation. It adopts a next-token prediction method for both text and visual content generation. Visual inputs are tokenized into discrete tokens and concatenated with textual tokens into a multi-modal token sequence. The visual input tokens are discretized using residual quantization. Both text and visual input tokens are, therefore, discrete, and thus we can train the LLM with next-token prediction task. The authors use special tokens: <code>&lt;image_start&gt;</code> and <code>&lt;image_end&gt;</code> for images; <code>&lt;video_start&gt;</code> and <code>&lt;video_end&gt;</code> for videos, with video tokens formed by concatenating image tokens.</p>
<p>This unified token sequence is then processed during training with a single next-token prediction objective, allowing the model to learn both text and visual generation in an integrated fashion.</p>
<section id="residual-vector-quantization" class="level2">
<h2 class="anchored" data-anchor-id="residual-vector-quantization">Residual Vector Quantization</h2>
<p>The visual inputs are first tokenized into discrete tokens, as shown in the figure below. These tokens are then concatenated with the textual tokens, forming a multimodal token sequence. Then, all of these tokens are used to train for next-token prediction task.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/vila-u-vision.png" class="img-fluid figure-img"></p>
<figcaption>Overall architecture of the vision tower in VILA-U. Figure from <span class="citation" data-cites="vila-u">[15]</span></figcaption>
</figure>
</div>
<p>To efficiently discretize the visual input tokens, the authors adopt a Residual Vector Quantization (RVQ) method as proposed in RQ-VAE. Given an input vector <img src="https://latex.codecogs.com/png.latex?%5Cbf%7Bz%7D">, we want to represent it as a sequence of <img src="https://latex.codecogs.com/png.latex?D"> discrete codes:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0ARQ(z;%20C,%20D)%20=%20(k_1,%20%5Ccdots,%20k_D)%20%5Cin%20%5BK%5D%5ED%0A"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?C"> is a codebook that contains a set of <img src="https://latex.codecogs.com/png.latex?K"> pre-defined vectors (also referred to as code), <img src="https://latex.codecogs.com/png.latex?D"> is the number of quantization step, and <img src="https://latex.codecogs.com/png.latex?k_d"> is the code selected from the codebook at step <img src="https://latex.codecogs.com/png.latex?d">. Then, the RVQ breaks the vector <img src="https://latex.codecogs.com/png.latex?%5Cbf%7Bz%7D"> into residuals across <img src="https://latex.codecogs.com/png.latex?D"> steps, where at each step <img src="https://latex.codecogs.com/png.latex?d">, it would first compute the code <img src="https://latex.codecogs.com/png.latex?k_d"> by finding the closest match to it from the codebook:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Ak_d%20=%20Q(r_%7Bd-1%7D,%20C)%20=%20%5Cunderset%7Bk%20%5Cin%20%5BK%5D%7D%7B%5Ctext%7Bargmin%7D%7D%20%5C%7Cr_%7Bd-1%7D%20-%20e(k)%5C%7C%5E2,%0A"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?e(k)"> is the embedding of the code <img src="https://latex.codecogs.com/png.latex?k">, and <img src="https://latex.codecogs.com/png.latex?r_%7Bd-1%7D"> is the current residual. Then, we would update the residual as follows:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Ar_d%20=%20r_%7Bd-1%7D%20-%20e(k_d)%0A"></p>
<p>This step is repeated for <img src="https://latex.codecogs.com/png.latex?d=1,2,%20%5Ccdots,%20D"> steps, starting with <img src="https://latex.codecogs.com/png.latex?r_0=z">. Finally, the approximated vector <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbf%7Bz%7D%7D"> of <img src="https://latex.codecogs.com/png.latex?%5Cbf%7Bz%7D"> is computed as:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathbf%7B%5Chat%7Bz%7D%7D%20=%20%5Csum_%7Bi=1%7D%5ED%20e(k_i)%0A"></p>
</section>
<section id="generative-pre-training" class="level2">
<h2 class="anchored" data-anchor-id="generative-pre-training">Generative Pre-training</h2>
<p>To achieve text and discrete visual token alignment, the authors propose using text-image contrastive loss along with VQ-based image reconstruction loss to equip the model with image generation capabilities.</p>
<p>However, while text-image contrastive loss requires the high-level understanding, reconstruction loss require low-level features. Therefore, naively training the vision tower from scratch to optimize those two objectives simultaneously would lead to conflicting goals. In fact, training a vision tower that way would lead to only 5% accuracy on zero-shot ImageNet classification. The training approach for the vision tower is, therefore, to first initialize it with CLIP weights for text-image alignment, and then freeze the text encoder to train only the visual encoder with both contrastive and reconstruction loss:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathcal%7BL%7D_%7B%5Ctext%7Btotal%7D%7D%20=%20w_%7B%5Ctext%7Bcontra%7D%7D%20%5Cmathcal%7BL%7D_%7B%5Ctext%7Bcontra%7D%7D%20+%20w_%7B%5Ctext%7Brecon%7D%7D%20%5Cmathcal%7BL%7D_%7B%5Ctext%7Brecon%7D%7D%0A"></p>
<p>Various training approaches have been attempted, but each faces significant challenges. Loading pre-trained CLIP weights into the text encoder and RQ-VAE weights into the vision encoder and decoder while training the rest of the model from scratch fails due to the absence of pre-trained CLIP weights for the vision encoder. Another approach is to freeze the vision encoder prevents learning crucial low-level features needed for reconstruction. making the text encoder trainable leads to instability in the early stages as chaotic quantized features and contrastive loss disrupt its weights, slowing down training overall.</p>
<p>Since both visual tokens and text tokens are discrete, we can train our LLM with the general language modeling next-token prediction objective. However, due to the use of residual quantization for visual tokens, the training objectives for text and visual tokens differ slightly. For text tokens, the negative log-likelihood loss is calculated as:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathcal%7BL%7D_%7B%5Ctext%7Btext%7D%7D%20=%20-%5Csum_%7Bi=1%7D%5ET%20%5Clog%20P_%5Ctheta(y_i%20%5Cmid%20y_%7B%5Clt%20i%7D),%0A"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?T"> is the length of the multi-modal sequence, and <img src="https://latex.codecogs.com/png.latex?i"> only counts when the text token appears at position.</p>
<p>For visual tokens, residual quantization introduces a depth-stacked structure of codes at each visual position <img src="https://latex.codecogs.com/png.latex?j">. Specifically, given the code embedding <img src="https://latex.codecogs.com/png.latex?h_j"> generated by the LLM for visual tokens at position <img src="https://latex.codecogs.com/png.latex?j">, the depth transformer autoregressively predicts <img src="https://latex.codecogs.com/png.latex?D"> residual tokens <img src="https://latex.codecogs.com/png.latex?(k_%7Bj1%7D,%20%5Ccdots,%20k_%7BjD%7D)">. During training, the input of the depth transformer <img src="https://latex.codecogs.com/png.latex?v_%7Bjd%7D"> at depth <img src="https://latex.codecogs.com/png.latex?d"> is defined as the sum of the code embeddings of up to depth <img src="https://latex.codecogs.com/png.latex?d-1"> for <img src="https://latex.codecogs.com/png.latex?d%3E1">, such that <img src="https://latex.codecogs.com/png.latex?v_%7Bjd%7D%20=%20%5Csum_%7Bd'=1%7D%5E%7Bd-1%7D%20e(k_%7Bjd'%7D)"> and <img src="https://latex.codecogs.com/png.latex?v_%7Bj1%7D%20=%20h_j">. Thus, the depth transformer predicts the next code for a finer estimation of the feature <img src="https://latex.codecogs.com/png.latex?%5Chat%7Bz%7D_j"> based on the previous estimations up to <img src="https://latex.codecogs.com/png.latex?d-1">. The negative log-likelihood loss for visual tokens is: <img src="https://latex.codecogs.com/png.latex?%0A%5Cmathcal%7BL%7D_%7B%5Ctext%7Bvisual%7D%7D%20=%20-%5Csum_%7Bj=1%7D%5ET%20%5Csum_%7Bd=1%7D%5ED%20%5Clog%20P_%5Cdelta(k_%7Bjd%7D%20%5Cmid%20k_%7Bj,%5Clt%20d%7D),%0A"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?T"> is the length of the multi-modal sequence, and <img src="https://latex.codecogs.com/png.latex?j"> only counts when a visual token appears at position <img src="https://latex.codecogs.com/png.latex?j">. During the multi-modal pre-training, the weights of the depth transformer are randomly initialized and updated together with the LLM.</p>
<div id="tbl-vila-u-quant" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-vila-u-quant-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;8: Comparison of quantization approaches. VILA-U with SigLIP-SO400M achieves the best rFID while attaining 78.0% top-1 accuracy. Table source: Wu et al.&nbsp;(2024) <span class="citation" data-cites="vila-u">[15]</span>.
</figcaption>
<div aria-describedby="tbl-vila-u-quant-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 11%">
<col style="width: 23%">
<col style="width: 15%">
<col style="width: 20%">
<col style="width: 10%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>Model</th>
<th>Pretrained Weights</th>
<th>Resolution</th>
<th>Shape of Code</th>
<th style="text-align: center;">rFID↓</th>
<th style="text-align: center;">Top-1 Accuracy↑</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>VQ-GAN</td>
<td>–</td>
<td>256 × 256</td>
<td>16 × 16</td>
<td style="text-align: center;">4.98</td>
<td style="text-align: center;">–</td>
</tr>
<tr class="even">
<td>RQ-VAE</td>
<td>–</td>
<td>256 × 256</td>
<td>8 × 8 × 4</td>
<td style="text-align: center;">3.20</td>
<td style="text-align: center;">–</td>
</tr>
<tr class="odd">
<td>RQ-VAE</td>
<td>–</td>
<td>256 × 256</td>
<td>16 × 16 × 4</td>
<td style="text-align: center;">1.30</td>
<td style="text-align: center;">–</td>
</tr>
<tr class="even">
<td>VILA-U</td>
<td>SigLIP-Large</td>
<td>256 × 256</td>
<td>16 × 16 × 4</td>
<td style="text-align: center;">1.80</td>
<td style="text-align: center;">73.3</td>
</tr>
<tr class="odd">
<td>VILA-U</td>
<td>SigLIP-SO400M</td>
<td>384 × 384</td>
<td>27 × 27 × 16</td>
<td style="text-align: center;">1.25</td>
<td style="text-align: center;">78.0</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
</section>
</section>
<section id="nvila" class="level1">
<h1><strong>NVILA</strong></h1>
<p>NVILA <span class="citation" data-cites="nvila">[19]</span> is a model built on top of VILA to improve the training efficiency regarding both algorithm and system side while maintaining the model’s performance. In the paper, the authors propose using data pruning and FP8 mixed precision training method.</p>
<section id="scale-and-compress-scheme" class="level2">
<h2 class="anchored" data-anchor-id="scale-and-compress-scheme">Scale-and-compress scheme</h2>
<p>The scaling is to preserve the visual features, while compress is to reduce the computation. The compressed visual tokens are expected to be information dense, as visual tokens are often found to be redundant <span class="citation" data-cites="liu2024multistage xing2024pyramiddrop">[20, 21]</span>. In this paper, the two types of visual token scaling are spatial and temporal, whe`re spatial means to increase the image resolution and temporal means to increase the number of frames sampled from the video.</p>
</section>
<section id="visual-token-compression" class="level2">
<h2 class="anchored" data-anchor-id="visual-token-compression">Visual token compression</h2>
<p>One way to compress the visual token is <img src="https://latex.codecogs.com/png.latex?S%5E2"> <span class="citation" data-cites="shi2025when">[22]</span>. Each image is first resized to be of different resolution: 448x448, 896x896, 1344x1344. Then, each image is splited into different tiles that have resolution of 448x448. The feature map of the tiles from the vision backbone will then be concatenated. However, resizing all of the image to be square might lead to distortion.</p>
<table class="table table-sm">
<caption>
Effect of scale-and-compress scheme on benchmark performance. Dynamic-S² with VEP achieves the best balance between token efficiency and accuracy. Table source: Liu et al.&nbsp;(2024) <span class="citation" data-cites="nvila">[19]</span>.
</caption>
<thead>
<tr>
<th>
Model
</th>
<th>
Spatial Pooling
</th>
<th>
#Tokens/Tile
</th>
<th>
#Tiles/Image
</th>
<th>
AI2D
</th>
<th>
DocVQA
</th>
<th>
TextVQA
</th>
<th>
Image-10
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Baseline (VILA-1.5)
</td>
<td>
2×2
</td>
<td>
256 (16×16)
</td>
<td>
1
</td>
<td>
87.0
</td>
<td>
61.3
</td>
<td>
67.5
</td>
<td>
61.2
</td>
</tr>
<tr>
<td>
Scale (Dynamic-S2)
</td>
<td>
2×2
</td>
<td>
256 (16×16)
</td>
<td>
9-12
</td>
<td>
90.1
</td>
<td>
91.1
</td>
<td>
77.0
</td>
<td>
71.5
</td>
</tr>
<tr>
<td>
Scale + Compress
</td>
<td>
3×3
</td>
<td>
121 (11×11)
</td>
<td>
1-12
</td>
<td>
87.4
</td>
<td>
82.3
</td>
<td>
74.1
</td>
<td>
67.1
</td>
</tr>
<tr>
<td>
Scale + Compress + VEP
</td>
<td>
3×3
</td>
<td>
121 (11×11)
</td>
<td>
1-12
</td>
<td>
89.8
</td>
<td>
88.8
</td>
<td>
76.1
</td>
<td>
70.8
</td>
</tr>
<tr class="section-sep">
<td colspan="8">
Alternative Designs
</td>
</tr>
<tr>
<td>
TokenLearner
</td>
<td>
–
</td>
<td>
121
</td>
<td>
1-12
</td>
<td>
90.0
</td>
<td>
86.5
</td>
<td>
75.6
</td>
<td>
69.8
</td>
</tr>
<tr>
<td>
Perceiver Resampler
</td>
<td>
–
</td>
<td>
121
</td>
<td>
1-12
</td>
<td>
76.8
</td>
<td>
71.8
</td>
<td>
65.3
</td>
<td>
59.4
</td>
</tr>
</tbody>
</table>
<p>Therefore, Dynamic-<img src="https://latex.codecogs.com/png.latex?S%5E2"> is proposed to resize the image to the resolution that is closest to the original solution that is divisible by 448. Using Dynamic-<img src="https://latex.codecogs.com/png.latex?S%5E2">, the model performance can improve up to 30% on text-heavy tasks, as shown in Table 10.</p>
</section>
<section id="efficient-training" class="level2">
<h2 class="anchored" data-anchor-id="efficient-training">Efficient training</h2>
<div class="quarto-layout-panel" data-layout="[ 40, 60 ]">
<div class="quarto-layout-row">
<div id="first-column" class="quarto-layout-cell" style="flex-basis: 40.0%;justify-content: flex-start;">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://quocviethere.github.io/assets/vila/nvila.png" class="img-fluid figure-img"></p>
<figcaption>Overall architecture of NVILA model. Figure from <span class="citation" data-cites="nvila">[19]</span> .</figcaption>
</figure>
</div>
</div>
<div id="second-column" class="quarto-layout-cell" style="flex-basis: 60.0%;justify-content: flex-start;">
<p>The NVILA training process consists of five stages: projector initialization, visual encoder pre-training, token processor pre-training, image instruction-tuning, and video instruction-tuning. Stages 1, 3, and 4 are similar to VILA, while stage 2 focuses on maintaining model accuracy after visual token compression, and stage 5 improves the ability to process long videos. Similar to LongVILA, NVILA aims to improve the training efficiency both on the algorithm and the system side with data pruning using Deltaloss <span class="citation" data-cites="gu2024miniplm">[23]</span> and FP8 mixed precision technique. Given that the dataset used to train NVIA involved over 100M samples, data pruning is essential. In NVILA, Deltaloss is used to prune the data in an unsupervised way. The Deltaloss is defined as:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AD'%20=%20%5Cbigcup_%7Bi=1%7D%5Ek%20%5Ctext%7Btop-K%7D%20%5Cleft%5C%7B%20%5Clog%20%5Cdfrac%7Bp_%7B%5Ctext%7Blarge%7D%7D(x)%7D%7Bp_%7B%5Ctext%7Bsmall%7D%7D(x)%7D%20%5Cbig%20%5Cvert%20x%20%5Cin%20D_i%5C%20%5Cright%5C%7D%0A"></p>
<p>Here, <img src="https://latex.codecogs.com/png.latex?D_i"> is the i-th subset of the fine-tuning dataset and <img src="https://latex.codecogs.com/png.latex?D'"> is the pruned training dataset. According to the ablation study, 50% is a safe threshold in a way that it does not hurt accuracy so much while speeding up the training time to <img src="https://latex.codecogs.com/png.latex?2%20%5Ctimes">.</p>
</div>
</div>
</div>
</section>
<section id="fp8-training" class="level2">
<h2 class="anchored" data-anchor-id="fp8-training">FP8 training</h2>
<p>FP8 precision offers significant benefits in computational and memory efficiency, supported by new NVIDIA GPUs like the H100 and B200. It accelerates training by performing matrix multiplications in FP8 and quantizing gradients, weights, and momentum, reducing memory usage and communication overhead.</p>
<table class="table table-sm">
<caption>
Effect of FP8 mixed-precision training with gradient checkpointing (GC) and batch size (BS) on throughput and model accuracy. Table source: Liu et al.&nbsp;(2024) <span class="citation" data-cites="nvila">[19]</span>.
</caption>
<thead>
<tr>
<th>
GC
</th>
<th>
BS
</th>
<th>
Throughput
</th>
<th>
MMMU
</th>
<th>
Video-MME
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
✗
</td>
<td>
4
</td>
<td>
199.2 (1.0×)
</td>
<td>
47.9
</td>
<td>
52.9
</td>
</tr>
<tr>
<td>
✗
</td>
<td>
16
</td>
<td>
390.1 (2.0×)
</td>
<td>
47.0
</td>
<td>
53.0
</td>
</tr>
<tr>
<td>
✓
</td>
<td>
30
</td>
<td>
491.7 (2.5×)
</td>
<td>
47.8
</td>
<td>
53.1
</td>
</tr>
<tr>
<td>
✓
</td>
<td>
36
</td>
<td>
579.9 (2.9×)
</td>
<td>
47.7
</td>
<td>
53.0
</td>
</tr>
</tbody>
</table>
<p>For NVILA, FP8 allows increasing batch size, resulting in a 2x speedup. In VLM training, where sequence lengths vary widely (e.g., video tokens vs.&nbsp;image tokens), FP8 helps optimize performance. When gradient checkpointing is used, FP8 still provides a 1.2x speedup over BF16 training. Overall, NVILA is found to rivals with top-tier proprietary models like GPT-4o or Gemini 1.5. Pro, and sometime even surpasses them.</p>
</section>

</section>


<div id="quarto-appendix" class="default"><section id="acknowledgments" class="level2 appendix"><h2 class="anchored quarto-appendix-heading">Acknowledgments</h2><div class="quarto-appendix-contents">

<p>Thank you TMA Solutions for providing the necessary compute resources for VILA1.5-3B model inference.</p>



</div></section><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body">
<div id="ref-vlm-survey1" class="csl-entry">
<div class="csl-left-margin">1. </div><div class="csl-right-inline">Bordes F, Pang RY, Ajay A, et al (2024) <a href="https://arxiv.org/abs/2405.17247">An introduction to vision-language modeling</a></div>
</div>
<div id="ref-vila" class="csl-entry">
<div class="csl-left-margin">2. </div><div class="csl-right-inline">Ji, Yin H, Ping W, Molchanov P, Shoeybi M, Han S (2024) VILA: On pre-training for visual language models. In: Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (CVPR). pp 26689–26699</div>
</div>
<div id="ref-clip" class="csl-entry">
<div class="csl-left-margin">3. </div><div class="csl-right-inline"><span class="nocase">Radford A, Kim JW, Hallacy C, et al</span> (2021) Learning transferable visual models from natural language supervision. In: International conference on machine learning. PMLR</div>
</div>
<div id="ref-llama2" class="csl-entry">
<div class="csl-left-margin">4. </div><div class="csl-right-inline">Touvron H, Martin L, Stone K, et al (2023) Llama 2: Open foundation and fine-tuned chat models. arXiv</div>
</div>
<div id="ref-pret" class="csl-entry">
<div class="csl-left-margin">5. </div><div class="csl-right-inline">Han C, Wang Q, Cui Y, et al (2024) Facing the <span>Elephant</span> in the <span>Room</span>: Visual <span>Prompt</span> <span>Tuning</span> or <span>Full</span> finetuning? In: International <span>Conference</span> on <span>Learning</span> <span>Representations</span> (<span>ICLR</span>)</div>
</div>
<div id="ref-mmc4" class="csl-entry">
<div class="csl-left-margin">6. </div><div class="csl-right-inline">Zhu W, Hessel J, Awadalla A, et al (2023) Multimodal C4: An open, <span>Billion</span>-scale <span>Corpus</span> of <span>Images</span> <span>Interleaved</span> with <span>Text</span>. arXiv</div>
</div>
<div id="ref-coyo-700m" class="csl-entry">
<div class="csl-left-margin">7. </div><div class="csl-right-inline">Minwoo Byeon HK Beomhee Park (2022) COYO-700M: Image-text pair dataset</div>
</div>
<div id="ref-flamingo" class="csl-entry">
<div class="csl-left-margin">8. </div><div class="csl-right-inline">Alayrac J-B, Donahue J, Luc P, et al (2022) Flamingo: A visual language model for few-shot learning. In: Oh AH, Agarwal A, Belgrave D, Cho K (eds) Advances in neural information processing systems</div>
</div>
<div id="ref-clipscore" class="csl-entry">
<div class="csl-left-margin">9. </div><div class="csl-right-inline">Hessel J, Holtzman A, Forbes M, Bras RL, Choi Y (2021) CLIPScore: A reference-free evaluation metric for image captioning. arXiv preprint arXiv:210408718</div>
</div>
<div id="ref-datacomp" class="csl-entry">
<div class="csl-left-margin">10. </div><div class="csl-right-inline">Gadre SY, Ilharco G, Fang A, et al (2023) DATAComp: In search of the next generation of multimodal datasets. In: Advances on neural information processing systems datasets and benchmarks track</div>
</div>
<div id="ref-vila2" class="csl-entry">
<div class="csl-left-margin">11. </div><div class="csl-right-inline">Fang Y, Zhu L, Lu Y, et al (2024) VILA<img src="https://latex.codecogs.com/png.latex?%5E2">: VILA augmented VILA. arXiv preprint arXiv:240717453</div>
</div>
<div id="ref-blip" class="csl-entry">
<div class="csl-left-margin">12. </div><div class="csl-right-inline">Li J, Li D, Xiong C, Hoi SCH (2022) BLIP: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In: International conference on machine learning (ICML). pp 12888–12900</div>
</div>
<div id="ref-longvila" class="csl-entry">
<div class="csl-left-margin">13. </div><div class="csl-right-inline"><span class="nocase">Xue F, Chen Y, Li D, et al</span> (2024) LongVILA: Scaling long-context visual language models for long videos. arXiv preprint arXiv:240810188</div>
</div>
<div id="ref-2dattention" class="csl-entry">
<div class="csl-left-margin">14. </div><div class="csl-right-inline">Gu D, Sun P, Hu Q, et al (2024) LoongTrain: Efficient <span>Training</span> of <span>Long</span>-<span>Sequence</span> <span>LLMs</span> with <span>Head</span>-<span>Context</span> <span>Parallelism</span>. arXiv</div>
</div>
<div id="ref-vila-u" class="csl-entry">
<div class="csl-left-margin">15. </div><div class="csl-right-inline">Wu Y, Zhang Z, Chen J, et al (2024) VILA-<span>U</span>: A <span>Unified</span> <span>Foundation</span> <span>Model</span> <span>Integrating</span> <span>Visual</span> <span>Understanding</span> and <span>Generation</span>. arXiv</div>
</div>
<div id="ref-emu" class="csl-entry">
<div class="csl-left-margin">16. </div><div class="csl-right-inline">Sun Q, Yu Q, Cui Y, et al (2024) Emu: Generative <span>Pretraining</span> in <span>Multimodality</span>. In: The <span>Twelfth</span> <span>International</span> <span>Conference</span> on <span>Learning</span> <span>Representations</span></div>
</div>
<div id="ref-jin2024unified" class="csl-entry">
<div class="csl-left-margin">17. </div><div class="csl-right-inline"><span class="nocase">Jin Y, Xu K, Xu K, et al</span> (2024) Unified <span>Language</span>-<span>Vision</span> <span>Pretraining</span> in <span>LLM</span> with <span>Dynamic</span> <span>Discrete</span> <span>Visual</span> <span>Tokenization</span>. The Twelfth International Conference on Learning Representations abs/2309.04669</div>
</div>
<div id="ref-yu2023scaling" class="csl-entry">
<div class="csl-left-margin">18. </div><div class="csl-right-inline">Yu L, Shi B, Pasunuru R, et al (2023) Scaling <span>Autoregressive</span> <span>Multi</span>-<span>Modal</span> <span>Models</span>: Pretraining and <span>Instruction</span> <span>Tuning</span>. arXiv abs/2309.02591</div>
</div>
<div id="ref-nvila" class="csl-entry">
<div class="csl-left-margin">19. </div><div class="csl-right-inline">Liu Z, Zhu L, Shi B, et al (2024) NVILA: Efficient <span>Frontier</span> <span>Visual</span> <span>Language</span> <span>Models</span>. arXiv</div>
</div>
<div id="ref-liu2024multistage" class="csl-entry">
<div class="csl-left-margin">20. </div><div class="csl-right-inline">Liu T, Shi L, Hong R, Hu Y, Yin Q, Zhang L (2024) Multi-<span>Stage</span> <span>Vision</span> <span>Token</span> <span>Dropping</span>: Towards <span>Efficient</span> <span>Multimodal</span> <span>Large</span> <span>Language</span> <span>Model</span>. arXiv</div>
</div>
<div id="ref-xing2024pyramiddrop" class="csl-entry">
<div class="csl-left-margin">21. </div><div class="csl-right-inline">Xing L, Huang Q, Dong X, et al (2024) PyramidDrop: Accelerating <span>Your</span> <span>Large</span> <span>Vision</span>-<span>Language</span> <span>Models</span> via <span>Pyramid</span> <span>Visual</span> <span>Redundancy</span> <span>Reduction</span>. arXiv</div>
</div>
<div id="ref-shi2025when" class="csl-entry">
<div class="csl-left-margin">22. </div><div class="csl-right-inline">Shi B, Wu Z, Mao M, Wang X, Darrell T (2025) When <span>Do</span> <span>We</span> <span>Not</span> <span>Need</span> <span>Larger</span> <span>Vision</span> <span>Models</span>? In: European <span>Conference</span> on <span>Computer</span> <span>Vision</span> (<span>ECCV</span>). Springer Nature Switzerland, pp 444–462</div>
</div>
<div id="ref-gu2024miniplm" class="csl-entry">
<div class="csl-left-margin">23. </div><div class="csl-right-inline">Gu Y, Zhou H, Meng F, Zhou J, Huang M (2024) MiniPLM: Knowledge <span>Distillation</span> for <span>Pre</span>-<span>Training</span> <span>Language</span> <span>Models</span>. arXiv</div>
</div>
</div></section><section id="footnotes" class="footnotes footnotes-end-of-document"><h2 class="anchored quarto-appendix-heading">Footnotes</h2>

<ol>
<li id="fn1"><p>See my <a href="../blogs/vlmdata.html">blog post</a> on training data for VLM.↩︎</p></li>
</ol>
</section></div> ]]></description>
  <category>vlm</category>
  <guid>https://quocviethere.github.io/blogs/vila.html</guid>
  <pubDate>Wed, 16 Oct 2024 15:00:00 GMT</pubDate>
</item>
</channel>
</rss>
