Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Jan 24, 2024
1 parent d10a671 commit c7991b0
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3389a51e
0de228ad
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

<div class="quarto-listing quarto-listing-container-grid" id="listing-listing">
<div class="list grid quarto-listing-cols-3">
<div class="g-col-1" data-index="0" data-listing-date-sort="1705968000000" data-listing-file-modified-sort="1706114882598" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="4">
<div class="g-col-1" data-index="0" data-listing-date-sort="1705968000000" data-listing-file-modified-sort="1706115221300" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="4">
<a href="./posts/dreamy.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<p class="card-img-top"><img src="posts/dream_wow.png" style="height: 150px;" class="thumbnail-image card-img"/></p>
Expand All @@ -166,7 +166,7 @@ <h5 class="no-anchor card-title listing-title">
</div>
</a>
</div>
<div class="g-col-1" data-index="1" data-listing-date-sort="1705104000000" data-listing-file-modified-sort="1706114882566" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="25">
<div class="g-col-1" data-index="1" data-listing-date-sort="1705104000000" data-listing-file-modified-sort="1706115221272" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="25">
<a href="./posts/TDC2023.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<p class="card-img-top"><img src="posts/TDC2023-sample-instances.png" style="height: 150px;" class="thumbnail-image card-img"/></p>
Expand All @@ -189,7 +189,7 @@ <h5 class="no-anchor card-title listing-title">
</div>
</a>
</div>
<div class="g-col-1" data-index="2" data-listing-date-sort="1701302400000" data-listing-file-modified-sort="1706114882598" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="7">
<div class="g-col-1" data-index="2" data-listing-date-sort="1701302400000" data-listing-file-modified-sort="1706115221300" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="7">
<a href="./posts/fight_the_illusion.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="listing-item-img-placeholder card-img-top" style="height: 150px;">&nbsp;</div>
Expand All @@ -212,7 +212,7 @@ <h5 class="no-anchor card-title listing-title">
</div>
</a>
</div>
<div class="g-col-1" data-index="3" data-listing-date-sort="1687651200000" data-listing-file-modified-sort="1706114882586" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="7">
<div class="g-col-1" data-index="3" data-listing-date-sort="1687651200000" data-listing-file-modified-sort="1706115221292" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="7">
<a href="./posts/catalog.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<p class="card-img-top"><img src="posts/catalog_files/figure-html/cell-9-output-1.png" style="height: 150px;" class="thumbnail-image card-img"/></p>
Expand Down
2 changes: 1 addition & 1 deletion posts/TDC2023.html
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ <h4 class="anchored" data-anchor-id="trojan-recovery">Trojan recovery:</h4>
});
</script>
</div> <!-- /content -->
<script>var lightboxQuarto = GLightbox({"descPosition":"bottom","selector":".lightbox","openEffect":"zoom","closeEffect":"zoom","loop":true});</script>
<script>var lightboxQuarto = GLightbox({"selector":".lightbox","closeEffect":"zoom","loop":true,"descPosition":"bottom","openEffect":"zoom"});</script>



Expand Down
2 changes: 1 addition & 1 deletion posts/catalog.html
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ <h2 class="anchored" data-anchor-id="github">GitHub</h2>
});
</script>
</div> <!-- /content -->
<script>var lightboxQuarto = GLightbox({"selector":".lightbox","closeEffect":"zoom","loop":true,"descPosition":"bottom","openEffect":"zoom"});</script>
<script>var lightboxQuarto = GLightbox({"descPosition":"bottom","openEffect":"zoom","selector":".lightbox","closeEffect":"zoom","loop":true});</script>



Expand Down
10 changes: 5 additions & 5 deletions posts/catalog.out.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"Pythia-12B is miscalibrated on 20% of the bigrams and 45% of the\n",
"trigrams when we ask for prediction of $p \\geq 0.45$."
],
"id": "512e3ec4-e0f8-44c4-9f5d-436c8e3bac3d"
"id": "06c9d831-1c49-4989-a26e-4a8e9af18173"
},
{
"cell_type": "code",
Expand All @@ -313,7 +313,7 @@
}
],
"source": [],
"id": "db43a0e6-1b41-4fe1-994e-a7af1aae7a34"
"id": "21157758-0f9e-4e85-b726-edfffbffd00b"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -377,7 +377,7 @@
"The dataset is available on Huggingface:\n",
"[pile_scan_4](https://huggingface.co/datasets/Confirm-Labs/pile_scan_4)"
],
"id": "b5bd2598-bfa6-4373-a25d-2f1434ce4cb3"
"id": "8a452dff-613c-4c99-9047-d6a42dbf494a"
},
{
"cell_type": "code",
Expand All @@ -391,7 +391,7 @@
}
],
"source": [],
"id": "1b39cf33-0f3e-4d04-9c75-5a7e6ad679df"
"id": "554bfd30-557d-45d0-81ff-1011fd3506b1"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -423,7 +423,7 @@
"Computational Linguistics, May 2022, pp. 95–136. doi:\n",
"[10.18653/v1/2022.bigscience-1.9](https://doi.org/10.18653/v1/2022.bigscience-1.9).</span>"
],
"id": "06602fea-6654-4858-8914-d23032b89619"
"id": "c8f430e1-ffd8-4dfe-8a28-b842a4f61b98"
}
],
"nbformat": 4,
Expand Down
22 changes: 11 additions & 11 deletions posts/dreamy.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ <h1 class="title">Fluent dreaming for language models</h1>
</div>
</div>
<div class="callout-body-container callout-body">
<div class="cell" data-execution_count="19">
<div class="cell" data-execution_count="1">
<div class="cell-output cell-output-display">

<div style="
Expand Down Expand Up @@ -690,14 +690,14 @@ <h2 class="anchored" data-anchor-id="installation-and-setup">Installation and se
<div id="callout-2" class="callout-2-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<p>First, we install necessary dependencies and install the <code>dreamy</code> library:</p>
<div class="cell" data-execution_count="1">
<div class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="op">!</span>pip install <span class="st">"poetry==1.7.1"</span> <span class="st">"torch==2.1.2"</span> <span class="st">"numpy==1.26.3"</span> <span class="st">"transformers==4.37.0"</span> <span class="st">"accelerate==0.26.1"</span> pandas pyarrow matplotlib ipywidgets</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="op">!</span>[ <span class="op">-</span>e dreamy_clone ] <span class="op">&amp;&amp;</span> rm <span class="op">-</span>rf dreamy_clone</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="op">!</span>git clone https:<span class="op">//</span>github.com<span class="op">/</span>Confirm<span class="op">-</span>Solutions<span class="op">/</span>dreamy dreamy_clone</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="op">!</span>cd dreamy_clone<span class="op">;</span> poetry install</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>Next, we import the <code>dreamy</code> library and load Phi-2:</p>
<div class="cell" data-execution_count="2">
<div class="cell" data-execution_count="3">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> pandas <span class="im">as</span> pd</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> numpy <span class="im">as</span> np</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> matplotlib.pyplot <span class="im">as</span> plt</span>
Expand All @@ -718,7 +718,7 @@ <h2 class="anchored" data-anchor-id="installation-and-setup">Installation and se
</div>
</div>
<p>We load up the Phi-2 model:</p>
<div class="cell" data-execution_count="3">
<div class="cell" data-execution_count="4">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>model_name <span class="op">=</span> <span class="st">"microsoft/phi-2"</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>model <span class="op">=</span> transformers.AutoModelForCausalLM.from_pretrained(</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> model_name,</span>
Expand All @@ -743,7 +743,7 @@ <h2 class="anchored" data-anchor-id="running-epo">Running EPO</h2>
</ul></li>
</ul>
<p>Here, we are going to define an objective that maximizes the activation of a chosen neuron in Phi-2. We use a hook on the MLP layer to capture the activations of the chosen neuron. We maximize the activation only on the last token of the sequence.</p>
<div class="cell" data-execution_count="4">
<div class="cell" data-execution_count="5">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> neuron_runner(layer, neuron):</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="kw">def</span> f(<span class="op">*</span>model_args, <span class="op">**</span>model_kwargs):</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> out <span class="op">=</span> {}</span>
Expand All @@ -761,7 +761,7 @@ <h2 class="anchored" data-anchor-id="running-epo">Running EPO</h2>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> f</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-execution_count="5">
<div class="cell" data-execution_count="6">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>runner <span class="op">=</span> neuron_runner(layer<span class="op">=</span><span class="dv">8</span>, neuron<span class="op">=</span><span class="dv">1</span>)</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a>history <span class="op">=</span> epo(runner, model, tokenizer)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
Expand All @@ -775,7 +775,7 @@ <h2 class="anchored" data-anchor-id="running-epo">Running EPO</h2>
<section id="the-pareto-frontier" class="level2">
<h2 class="anchored" data-anchor-id="the-pareto-frontier">The Pareto frontier</h2>
<p>To visualize the results of this EPO run, we first plot the Pareto frontier of cross-entropy against activation.</p>
<div class="cell" data-execution_count="6">
<div class="cell" data-execution_count="7">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>pareto <span class="op">=</span> build_pareto_frontier(tokenizer, history)</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a>ordering <span class="op">=</span> np.argsort(pareto.xentropy)</span>
Expand All @@ -796,7 +796,7 @@ <h2 class="anchored" data-anchor-id="the-pareto-frontier">The Pareto frontier</h
</div>
</div>
<p>We also plot the evolution of the Pareto frontier over the course of the optimization run.</p>
<div class="cell" data-execution_count="20">
<div class="cell" data-execution_count="8">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>linestyles <span class="op">=</span> [<span class="st">'k--o'</span>, <span class="st">'k:o'</span>, <span class="st">'k--*'</span>, <span class="st">'k:*'</span>]</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> i, n <span class="kw">in</span> <span class="bu">enumerate</span>([<span class="dv">20</span>, <span class="dv">40</span>, <span class="dv">100</span>, <span class="dv">300</span>]):</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> pareto <span class="op">=</span> build_pareto_frontier(tokenizer, history.subset(<span class="bu">slice</span>(<span class="dv">0</span>, n)))</span>
Expand All @@ -820,7 +820,7 @@ <h2 class="anchored" data-anchor-id="the-pareto-frontier">The Pareto frontier</h
<section id="thresholding-cross-entropy" class="level2">
<h2 class="anchored" data-anchor-id="thresholding-cross-entropy">Thresholding cross-entropy</h2>
<p>An alternative way of visualizing the results of an EPO run is to consider only the subset of prompts with cross-entropy below some fixed threshold. Below, we plot the maximum activation across the 300 iterations of EPO for six different thresholds. The title of each plot shows the maximum activating prompt under the cross-entropy threshold across all iterations. The sharp drops every 50 iterations are from restarts. Sometimes there’s a plateau before the restart and other times progress is continuing. This suggests that a more adaptive restarting algorithm would perform better.</p>
<div class="cell" data-execution_count="8">
<div class="cell" data-execution_count="9">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>plt.figure(figsize<span class="op">=</span>(<span class="dv">8</span>, <span class="dv">12</span>), constrained_layout<span class="op">=</span><span class="va">True</span>)</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> i, thresh <span class="kw">in</span> <span class="bu">enumerate</span>([<span class="dv">5</span>, <span class="dv">6</span>, <span class="dv">7</span>, <span class="dv">8</span>, <span class="dv">9</span>, <span class="dv">15</span>]):</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> plt.subplot(<span class="dv">3</span>, <span class="dv">2</span>, i <span class="op">+</span> <span class="dv">1</span>)</span>
Expand Down Expand Up @@ -860,7 +860,7 @@ <h2 class="anchored" data-anchor-id="causal-token-attribution">Causal token attr
</ul>
<p>The visualizations are interactive. Hover over each token to see a tooltip with the top-3 highest activation alternative tokens and the single lowest alternative token.</p>
<p>We show attribution visualizations for each prompt on the Pareto frontier. For all the prompts, swapping the last token can reduce the neuron activation to zero. Swapping other token can reduces the activation much less. The comma in the second-to-last position is also important and often has no viable substitute which is indicated by its tall bar.</p>
<div class="cell" data-execution_count="17">
<div class="cell" data-execution_count="10">
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> i <span class="kw">in</span> <span class="bu">range</span>(<span class="bu">len</span>(ordering)):</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> _, viz_html <span class="op">=</span> resample_viz(</span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a> model,</span>
Expand Down Expand Up @@ -5211,7 +5211,7 @@ <h2 class="anchored" data-anchor-id="causal-token-attribution">Causal token attr
});
</script>
</div> <!-- /content -->
<script>var lightboxQuarto = GLightbox({"closeEffect":"zoom","descPosition":"bottom","selector":".lightbox","openEffect":"zoom","loop":true});</script>
<script>var lightboxQuarto = GLightbox({"descPosition":"bottom","openEffect":"zoom","loop":true,"selector":".lightbox","closeEffect":"zoom"});</script>



Expand Down
42 changes: 21 additions & 21 deletions posts/dreamy.out.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://confirmlabs.org/posts/catalog.html</loc>
<lastmod>2024-01-24T16:48:21.134Z</lastmod>
<lastmod>2024-01-24T16:53:58.704Z</lastmod>
</url>
<url>
<loc>https://confirmlabs.org/posts/dreamy.html</loc>
<lastmod>2024-01-24T16:48:17.946Z</lastmod>
<lastmod>2024-01-24T16:53:55.428Z</lastmod>
</url>
<url>
<loc>https://confirmlabs.org/index.html</loc>
<lastmod>2024-01-24T16:48:15.070Z</lastmod>
<lastmod>2024-01-24T16:53:52.504Z</lastmod>
</url>
<url>
<loc>https://confirmlabs.org/posts/TDC2023.html</loc>
<lastmod>2024-01-24T16:48:16.510Z</lastmod>
<lastmod>2024-01-24T16:53:53.968Z</lastmod>
</url>
<url>
<loc>https://confirmlabs.org/posts/fight_the_illusion.html</loc>
<lastmod>2024-01-24T16:48:18.650Z</lastmod>
<lastmod>2024-01-24T16:53:56.140Z</lastmod>
</url>
</urlset>

0 comments on commit c7991b0

Please sign in to comment.