Spaces:
Running
Running
Point links to the renamed GitHub repo
Browse files- index.html +11 -11
index.html
CHANGED
|
@@ -56,11 +56,11 @@
|
|
| 56 |
<p class="hook">Some AI models search documents by looking at the pages, like we do. They need hundreds of vectors per page. <strong>How many does a page really need?</strong></p>
|
| 57 |
|
| 58 |
<figure>
|
| 59 |
-
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/
|
| 60 |
<figcaption>Quality kept vs memory per page, for every method.</figcaption>
|
| 61 |
</figure>
|
| 62 |
|
| 63 |
-
<p class="meta">Code, results and full details: <a href="https://github.com/ALI-AL-MARJANI/
|
| 64 |
|
| 65 |
<h2>Built on</h2>
|
| 66 |
<div class="card">
|
|
@@ -93,7 +93,7 @@
|
|
| 93 |
<p>A company has millions of PDF pages. Someone asks: <em>"How much did we spend on stock buybacks in 2024?"</em> The answer is one number, in one table, on one page.</p>
|
| 94 |
<p>The old way is to turn the pages into text (OCR) and search the text. It often breaks on tables, charts and scans. Models like ColPali skip that step: they look at the page image directly.</p>
|
| 95 |
<figure>
|
| 96 |
-
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/
|
| 97 |
<figcaption>How ColPali-style models search a page.</figcaption>
|
| 98 |
</figure>
|
| 99 |
<p>The catch: a page becomes hundreds of vectors, not one. With ColQwen2, that is 757 vectors of 128 numbers per page, so <strong>1 million pages take 194 GB of fast memory</strong>. The smaller model, ColSmol, is even worse (264 GB), because it cuts pages into more pieces.</p>
|
|
@@ -102,7 +102,7 @@
|
|
| 102 |
<h2>Four ways to make it smaller</h2>
|
| 103 |
<p><strong>Token pooling</strong> (<a href="https://arxiv.org/abs/2409.14683">Clavié et al.</a>). Group similar vectors and keep their average. To check that the grouping matters, it is compared with a dumb baseline: throw away the same number of vectors at random.</p>
|
| 104 |
<figure>
|
| 105 |
-
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/
|
| 106 |
<figcaption>Which patches get merged on a real page.</figcaption>
|
| 107 |
</figure>
|
| 108 |
<p><strong>Binarization.</strong> Keep only the sign of each number: 1 bit instead of 16. Each vector becomes 16× smaller.</p>
|
|
@@ -128,24 +128,24 @@
|
|
| 128 |
</div>
|
| 129 |
<p class="meta">Every number comes from <code>results/</code> in the GitHub repo. The full table is in <code>results/table.md</code>.</p>
|
| 130 |
<figure>
|
| 131 |
-
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/
|
| 132 |
<figcaption>Smart merging vs random dropping.</figcaption>
|
| 133 |
</figure>
|
| 134 |
<p>Two things stand out. <strong>Smart merging beats random dropping by a wide margin</strong>, so which vectors get merged really matters. And <strong>the bigger model handles compression better</strong> at every setting.</p>
|
| 135 |
<figure>
|
| 136 |
-
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/
|
| 137 |
<figcaption>One vector as a fast first filter, then an exact check of the top 100.</figcaption>
|
| 138 |
</figure>
|
| 139 |
|
| 140 |
<h2>Where it hurts</h2>
|
| 141 |
<p>The type of page that suffers most depends on the model. ColQwen2 loses most on dense finance pages (92% kept at 16×). ColSmol loses most on slides (88%). Science figures are the safest for both.</p>
|
| 142 |
<figure>
|
| 143 |
-
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/
|
| 144 |
<figcaption>Quality kept per page type.</figcaption>
|
| 145 |
</figure>
|
| 146 |
<p>Below, each query word picks its best patch, and that patch lights up. With the full vectors, a few exact spots win. After heavy merging, a "winner" is the average of a whole group of patches, so the signal gets spread out and the wrong pages start to win.</p>
|
| 147 |
<figure>
|
| 148 |
-
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/
|
| 149 |
<figcaption>What the model looks at, before and after pooling.</figcaption>
|
| 150 |
</figure>
|
| 151 |
|
|
@@ -166,8 +166,8 @@
|
|
| 166 |
</ul>
|
| 167 |
|
| 168 |
<h2>Run it</h2>
|
| 169 |
-
<pre><code>git clone https://github.com/ALI-AL-MARJANI/
|
| 170 |
-
cd
|
| 171 |
uv sync --extra encode --extra dev
|
| 172 |
uv run pytest
|
| 173 |
uv run python -m p2p.encode --model colqwen2 --dataset economics_v2
|
|
@@ -175,7 +175,7 @@ uv run python -m p2p.run_experiments
|
|
| 175 |
uv run python -m p2p.plots</code></pre>
|
| 176 |
|
| 177 |
<footer>
|
| 178 |
-
Ali Al Marjani · <a href="https://github.com/ALI-AL-MARJANI/
|
| 179 |
</footer>
|
| 180 |
|
| 181 |
</main>
|
|
|
|
| 56 |
<p class="hook">Some AI models search documents by looking at the pages, like we do. They need hundreds of vectors per page. <strong>How many does a page really need?</strong></p>
|
| 57 |
|
| 58 |
<figure>
|
| 59 |
+
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/Pixels-To-Points/main/assets/pareto.png" alt="Quality kept vs memory per page">
|
| 60 |
<figcaption>Quality kept vs memory per page, for every method.</figcaption>
|
| 61 |
</figure>
|
| 62 |
|
| 63 |
+
<p class="meta">Code, results and full details: <a href="https://github.com/ALI-AL-MARJANI/Pixels-To-Points">github.com/ALI-AL-MARJANI/Pixels-To-Points</a></p>
|
| 64 |
|
| 65 |
<h2>Built on</h2>
|
| 66 |
<div class="card">
|
|
|
|
| 93 |
<p>A company has millions of PDF pages. Someone asks: <em>"How much did we spend on stock buybacks in 2024?"</em> The answer is one number, in one table, on one page.</p>
|
| 94 |
<p>The old way is to turn the pages into text (OCR) and search the text. It often breaks on tables, charts and scans. Models like ColPali skip that step: they look at the page image directly.</p>
|
| 95 |
<figure>
|
| 96 |
+
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/Pixels-To-Points/main/assets/architecture.png" alt="How ColPali-style models search a page">
|
| 97 |
<figcaption>How ColPali-style models search a page.</figcaption>
|
| 98 |
</figure>
|
| 99 |
<p>The catch: a page becomes hundreds of vectors, not one. With ColQwen2, that is 757 vectors of 128 numbers per page, so <strong>1 million pages take 194 GB of fast memory</strong>. The smaller model, ColSmol, is even worse (264 GB), because it cuts pages into more pieces.</p>
|
|
|
|
| 102 |
<h2>Four ways to make it smaller</h2>
|
| 103 |
<p><strong>Token pooling</strong> (<a href="https://arxiv.org/abs/2409.14683">Clavié et al.</a>). Group similar vectors and keep their average. To check that the grouping matters, it is compared with a dumb baseline: throw away the same number of vectors at random.</p>
|
| 104 |
<figure>
|
| 105 |
+
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/Pixels-To-Points/main/assets/pooling_clusters.png" alt="Which patches get merged on a real page">
|
| 106 |
<figcaption>Which patches get merged on a real page.</figcaption>
|
| 107 |
</figure>
|
| 108 |
<p><strong>Binarization.</strong> Keep only the sign of each number: 1 bit instead of 16. Each vector becomes 16× smaller.</p>
|
|
|
|
| 128 |
</div>
|
| 129 |
<p class="meta">Every number comes from <code>results/</code> in the GitHub repo. The full table is in <code>results/table.md</code>.</p>
|
| 130 |
<figure>
|
| 131 |
+
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/Pixels-To-Points/main/assets/pool_vs_random.png" alt="Pooling vs random dropping">
|
| 132 |
<figcaption>Smart merging vs random dropping.</figcaption>
|
| 133 |
</figure>
|
| 134 |
<p>Two things stand out. <strong>Smart merging beats random dropping by a wide margin</strong>, so which vectors get merged really matters. And <strong>the bigger model handles compression better</strong> at every setting.</p>
|
| 135 |
<figure>
|
| 136 |
+
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/Pixels-To-Points/main/assets/two_step.png" alt="Two-step search">
|
| 137 |
<figcaption>One vector as a fast first filter, then an exact check of the top 100.</figcaption>
|
| 138 |
</figure>
|
| 139 |
|
| 140 |
<h2>Where it hurts</h2>
|
| 141 |
<p>The type of page that suffers most depends on the model. ColQwen2 loses most on dense finance pages (92% kept at 16×). ColSmol loses most on slides (88%). Science figures are the safest for both.</p>
|
| 142 |
<figure>
|
| 143 |
+
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/Pixels-To-Points/main/assets/by_page_type.png" alt="Quality kept per page type">
|
| 144 |
<figcaption>Quality kept per page type.</figcaption>
|
| 145 |
</figure>
|
| 146 |
<p>Below, each query word picks its best patch, and that patch lights up. With the full vectors, a few exact spots win. After heavy merging, a "winner" is the average of a whole group of patches, so the signal gets spread out and the wrong pages start to win.</p>
|
| 147 |
<figure>
|
| 148 |
+
<img src="https://raw.githubusercontent.com/ALI-AL-MARJANI/Pixels-To-Points/main/assets/heatmaps_worst_cases.png" alt="What the model looks at, before and after pooling">
|
| 149 |
<figcaption>What the model looks at, before and after pooling.</figcaption>
|
| 150 |
</figure>
|
| 151 |
|
|
|
|
| 166 |
</ul>
|
| 167 |
|
| 168 |
<h2>Run it</h2>
|
| 169 |
+
<pre><code>git clone https://github.com/ALI-AL-MARJANI/Pixels-To-Points
|
| 170 |
+
cd Pixels-To-Points
|
| 171 |
uv sync --extra encode --extra dev
|
| 172 |
uv run pytest
|
| 173 |
uv run python -m p2p.encode --model colqwen2 --dataset economics_v2
|
|
|
|
| 175 |
uv run python -m p2p.plots</code></pre>
|
| 176 |
|
| 177 |
<footer>
|
| 178 |
+
Ali Al Marjani · <a href="https://github.com/ALI-AL-MARJANI/Pixels-To-Points">Code on GitHub</a> · <a href="https://github.com/ALI-AL-MARJANI">GitHub profile</a>
|
| 179 |
</footer>
|
| 180 |
|
| 181 |
</main>
|