<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Brenner Cruvinel - ai safety</title>
    <subtitle>AI researcher and product designer building at the edge of computer science and mental health.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://brennercruvinel.blog/en/tags/ai-safety/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://brennercruvinel.blog"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-04-08T00:00:00+00:00</updated>
    <id>https://brennercruvinel.blog/en/tags/ai-safety/atom.xml</id>
    <entry xml:lang="en">
        <title>Extraction attacks against black-box models: a reading list</title>
        <published>2026-04-08T00:00:00+00:00</published>
        <updated>2026-04-08T00:00:00+00:00</updated>
        
        <author>
          <name>
            Brenner Cruvinel
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://brennercruvinel.blog/en/blog/model-extraction-attacks/"/>
        <id>https://brennercruvinel.blog/en/blog/model-extraction-attacks/</id>
        
        <content type="html" xml:base="https://brennercruvinel.blog/en/blog/model-extraction-attacks/">&lt;p&gt;I put this list together for a security and intelligence research project. The first version was a dump of search results: the same Tramèr paper showed up eight times under different links, and half the items had nothing to do with model extraction. I deduplicated it, checked every source and removed what was off topic. What remains is what I would read again.&lt;/p&gt;
&lt;p&gt;The question that ties it together: if I can only query a model through an API, without seeing the weights, how much of it can be rebuilt? And, going the other way, how much of the training data can be recovered from the model or from its gradients?&lt;/p&gt;
&lt;h2 id=&quot;stealing-the-model-through-the-api&quot;&gt;Stealing the model through the API&lt;/h2&gt;
&lt;p&gt;The starting point is &lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/1609.02943&quot;&gt;Stealing Machine Learning Models via Prediction APIs&lt;/a&gt;, by Tramèr and colleagues, presented at USENIX Security 2016. They showed that cloud machine learning services, by returning prediction confidence, let an attacker rebuild models such as logistic regression and decision trees with few queries. The code is at &lt;a rel=&quot;external&quot; href=&quot;https://github.com/ftramer/Steal-ML&quot;&gt;ftramer/Steal-ML&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/1602.02697&quot;&gt;Practical Black-Box Attacks against Machine Learning&lt;/a&gt;, by Papernot and colleagues, AsiaCCS 2017, is a close relative: it trains a substitute model by querying the target and uses that substitute to craft adversarial examples that transfer to the original.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/1812.02766&quot;&gt;Knockoff Nets&lt;/a&gt;, by Orekondy, Schiele and Fritz, CVPR 2019, steals the functionality of an image network by querying it with random natural images. &lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.1609/aaai.v34i01.5432&quot;&gt;ActiveThief&lt;/a&gt;, by Pal and colleagues, AAAI 2020, does the same while choosing queries by active learning over unlabelled public data. &lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.14722/ndss.2020.24178&quot;&gt;CloudLeak&lt;/a&gt;, by Yu and colleagues, NDSS 2020, uses adversarial examples to extract models from commercial services with fewer queries.&lt;/p&gt;
&lt;p&gt;More recent: &lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/2409.14122&quot;&gt;Efficient and Effective Model Extraction&lt;/a&gt;, by Zhu and colleagues, 2024, and &lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.1016/j.knosys.2024.112144&quot;&gt;A realistic model extraction attack against graph neural networks&lt;/a&gt;, by Guan and colleagues, in Knowledge-Based Systems 2024, which takes the problem to graph networks.&lt;/p&gt;
&lt;p&gt;The milestone for language models is &lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/2403.06634&quot;&gt;Stealing Part of a Production Language Model&lt;/a&gt;, by Carlini and colleagues, 2024. With API access alone, they recovered the final projection layer of production models and their hidden dimension.&lt;/p&gt;
&lt;p&gt;For the full map, the survey &lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.1145/3595292&quot;&gt;I Know What You Trained Last Summer&lt;/a&gt;, by Oliynyk, Mayer and Rauber, ACM Computing Surveys 2023, covers attacks and defences, and the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/kzhao5/ModelExtractionPapers&quot;&gt;kzhao5/ModelExtractionPapers&lt;/a&gt; repository keeps a list of papers in the area.&lt;/p&gt;
&lt;h2 id=&quot;inverting-the-model-and-leaking-through-gradients&quot;&gt;Inverting the model and leaking through gradients&lt;/h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/1906.08935&quot;&gt;Deep Leakage from Gradients&lt;/a&gt;, by Zhu, Liu and Han, NeurIPS 2019, is the paper that changed the conversation about federated learning: from the shared gradients, they rebuilt training images and text almost pixel by pixel.&lt;/p&gt;
&lt;p&gt;The ones that followed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/2309.13016&quot;&gt;Understanding Deep Gradient Leakage via Inversion Influence Functions&lt;/a&gt;, by Zhang and colleagues, NeurIPS 2023, gives a way to analyse leakage without running the attack&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://pmc.ncbi.nlm.nih.gov/articles/PMC10217429/&quot;&gt;Wasserstein Distance-Based Deep Leakage from Gradients&lt;/a&gt;, from 2023, changes the distance used in the reconstruction&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.1186/s42400-024-00227-7&quot;&gt;Iterative and mixed-spaces image gradient inversion attack in federated learning&lt;/a&gt;, by Fang and colleagues, Cybersecurity 2024&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.1145/3658644.3690292&quot;&gt;Uncovering Gradient Inversion Risks in Practical Language Model Training&lt;/a&gt;, by Feng and colleagues, CCS 2024, takes the attack to language model training&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/2410.21453&quot;&gt;Inverting Gradient Attacks Makes Powerful Data Poisoning&lt;/a&gt;, by Bouaziz and colleagues, 2024, uses inversion to poison training&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.1007/978-3-031-30648-8_1&quot;&gt;A Survey of the Implementations of Model Inversion Attacks&lt;/a&gt;, by Song and Namiot, 2023&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;weights-as-an-attack-surface&quot;&gt;Weights as an attack surface&lt;/h2&gt;
&lt;p&gt;If the attacker gets the weights file, extraction ends there. Two sides of that interest me.&lt;/p&gt;
&lt;p&gt;The first is the format. &lt;a rel=&quot;external&quot; href=&quot;https://github.com/safetensors/safetensors&quot;&gt;safetensors&lt;/a&gt; exists because PyTorch&#39;s pickle format can execute code on load; safetensors stores only tensors. The &lt;a rel=&quot;external&quot; href=&quot;https://huggingface.co/blog/ngxson/common-ai-model-formats&quot;&gt;Hugging Face post on common formats&lt;/a&gt; compares safetensors, GGUF and others, and &lt;a rel=&quot;external&quot; href=&quot;https://github.com/justinchuby/onnx-safetensors&quot;&gt;onnx-safetensors&lt;/a&gt; connects ONNX to safetensors.&lt;/p&gt;
&lt;p&gt;The second is protecting the weights of frontier models. RAND&#39;s report &lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.7249/RRA2849-1&quot;&gt;Securing AI Model Weights&lt;/a&gt;, from 2024, organizes the attack vectors and the security levels needed against each kind of attacker.&lt;/p&gt;
&lt;h2 id=&quot;what-was-left-out&quot;&gt;What was left out&lt;/h2&gt;
&lt;p&gt;The items from the original list on distributed training and sharding (FSDP), checkpoints, serving in general and neural networks applied to detecting vulnerabilities were removed. They are good, but they are not about model extraction. Also removed: B3, which is about backdoors, a 2025 adversarial attack unrelated to extraction, and the link to Carlini&#39;s talk at Virginia Tech, which now returns 404.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Semantic drift in LLMs: metric, detection and mitigation</title>
        <published>2024-10-15T00:00:00+00:00</published>
        <updated>2024-10-15T00:00:00+00:00</updated>
        
        <author>
          <name>
            Brenner Cruvinel
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://brennercruvinel.blog/en/blog/drift-semantico-llm/"/>
        <id>https://brennercruvinel.blog/en/blog/drift-semantico-llm/</id>
        
        <content type="html" xml:base="https://brennercruvinel.blog/en/blog/drift-semantico-llm/">&lt;p&gt;I put this together as technical grounding for the &lt;a href=&quot;https://brennercruvinel.blog/en/blog/roteiro-consciencia-llm/&quot;&gt;screenplay about consciousness in an LLM&lt;/a&gt;, which uses semantic drift as its mechanism. The first version was a research dump with ten topics, from integrated information theory to communication between models, and it had errors precisely in the part that gave the post its name: the formula and the code did not match the paper, and several numbers were not in it. I redid everything from the source and kept only what is about drift.&lt;/p&gt;
&lt;h2 id=&quot;what-it-is&quot;&gt;What it is&lt;/h2&gt;
&lt;p&gt;The term comes from &lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/2404.05411&quot;&gt;Know When To Stop: A Study of Semantic Drift in Text Generation&lt;/a&gt;, by Ava Spataru, Eric Hambro, Elena Voita and Nicola Cancedda, published at &lt;a rel=&quot;external&quot; href=&quot;https://doi.org/10.18653/v1/2024.naacl-long.202&quot;&gt;NAACL 2024&lt;/a&gt;. Three authors are from FAIR, at Meta, and one is listed with an Anthropic affiliation. The first version of this post called it a &quot;joint Meta and Anthropic study&quot;, which overstates it.&lt;/p&gt;
&lt;p&gt;The observation is simple: when a model generates a long text, such as a Wikipedia-style biography, it tends to write the correct facts first and then &quot;drift&quot; into incorrect ones. This had been noticed before but never measured. The paper measures it.&lt;/p&gt;
&lt;h2 id=&quot;the-metric&quot;&gt;The metric&lt;/h2&gt;
&lt;p&gt;Each text is broken into atomic facts, and each fact gets a label $s_i$: 1 if it is supported by the source, 0 if not. With $N$ facts, the drift score tries every cut position $k$ and keeps the best average of two proportions: correct facts before the cut and incorrect facts after it.&lt;/p&gt;
&lt;p&gt;$$\text{SD}_m(P) = \max_k \tfrac{1}{2}, \text{SD}_m(P, k)$$&lt;/p&gt;
&lt;p&gt;$$\text{SD}&lt;em&gt;m(P, k) = \frac{\sum&lt;/em&gt;{i=0}^{k-1} s_i}{k} + \frac{\sum_{i=k}^{N-1} (1 - s_i)}{N - k}$$&lt;/p&gt;
&lt;p&gt;The value is zero when $k &amp;lt; m$, $N - k &amp;lt; m$ or $N &amp;lt; 2m$. The hyperparameter $m$ is the minimum number of facts on each side of the cut, and the position that gives the maximum is the drift point. A high score means a text that is almost all right before that point and almost all wrong after it.&lt;/p&gt;
&lt;p&gt;The first version of this post weighted each side by $k/N$ and $(N-k)/N$ and called the minimum $\alpha$, as a fraction. That is not the paper&#39;s formula. The corrected code:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot; &gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; semantic_drift_score&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;labels&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; m&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;labels: list of 0s and 1s, in the order the facts appear.&lt;/span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; len&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;labels&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    best&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; drift_point&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 0.0&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span style=&quot;color: light-dark(#B58900, #B58900);&quot;&gt; None&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    if&lt;/span&gt;&lt;span&gt; n&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; *&lt;/span&gt;&lt;span&gt; m&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;        return&lt;/span&gt;&lt;span&gt; best&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; drift_point&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    for&lt;/span&gt;&lt;span&gt; k&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; range&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;m&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; n&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; -&lt;/span&gt;&lt;span&gt; m&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 1&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        left&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; sum&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;labels&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;k&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; /&lt;/span&gt;&lt;span&gt; k&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        right&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; sum&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; -&lt;/span&gt;&lt;span&gt; s&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; for&lt;/span&gt;&lt;span&gt; s&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;/span&gt;&lt;span&gt; labels&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;k&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; /&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;n&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; -&lt;/span&gt;&lt;span&gt; k&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        score&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;left&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; +&lt;/span&gt;&lt;span&gt; right&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; /&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;        if&lt;/span&gt;&lt;span&gt; score&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span&gt; best&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            best&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; drift_point&lt;/span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;/span&gt;&lt;span&gt; score&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; k&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    return&lt;/span&gt;&lt;span&gt; best&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; drift_point&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the paper&#39;s figure 1 example, the best cut leaves 88% correct facts on the left and 78% incorrect ones on the right, and the score is the average, 0.83.&lt;/p&gt;
&lt;h2 id=&quot;what-they-measured&quot;&gt;What they measured&lt;/h2&gt;
&lt;p&gt;Generated biographies, with facts checked by a variant of FActScore the authors call FActScore*. Both numbers are percentages:&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Model&lt;/th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Drift (SD)&lt;/th&gt;&lt;th style=&quot;text-align: right&quot;&gt;FActScore*&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Llama 2 70B chat&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;77.06&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;41.72&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Falcon 7B&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;76.81&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;24.64&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Falcon 40B&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;77.38&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25.88&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;text-davinci-003&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;77.21&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;38.09&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPT-3.5&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;79.49&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;45.96&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPT-4&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;78.12&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53.54&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Drift shows up in all of them, with little difference between models, while accuracy varies a lot. Being more accurate does not protect against the right-first, wrong-later pattern.&lt;/p&gt;
&lt;p&gt;Other numbers from the paper: in 37% of paragraphs, the drift point is in the first 10% of facts. In more than 40% of paragraphs, the score is statistically high in a permutation test. Only 34 paragraphs, under 7%, have at least 10 correct facts before the first error. The first version said &quot;75% of paragraphs show drift in the first 25% of facts&quot;, which is not in the paper.&lt;/p&gt;
&lt;h2 id=&quot;detection&quot;&gt;Detection&lt;/h2&gt;
&lt;p&gt;To stop generation at the right point, you need to know, while generating, when the model started to go wrong. Of the confidence measures tested, the one that correlated best with accuracy was SelfCheck with BERTScore, which samples several generations and measures how much they agree, with a Pearson correlation of −0.41.&lt;/p&gt;
&lt;h2 id=&quot;mitigation&quot;&gt;Mitigation&lt;/h2&gt;
&lt;p&gt;With Llama 2 70B, the paper&#39;s table 4 compares strategies:&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Strategy&lt;/th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Facts per text&lt;/th&gt;&lt;th style=&quot;text-align: right&quot;&gt;FActScore*&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;No stopping, up to the token limit&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;43.89&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;44.56&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Stop at the drift point (oracle)&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;81.68&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Stop when end-of-text is among the top 5 tokens&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;14.47&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;57.96&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Same, among the top 10&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5.39&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;70.29&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Stop when SelfCheck goes above 0.5&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13.39&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;67.63&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sample several times and rerank by similarity&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;40.21&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53.27&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Rerank and stop by SelfCheck&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;17.12&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;67.18&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Call an external question-answering API&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;42.26&lt;/td&gt;&lt;td style=&quot;text-align: right&quot;&gt;43.93&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The oracle is the ceiling: knowing the exact point, accuracy goes from 44% to 82%, but at the cost of cutting correct facts along with it, 58% of them, according to the limitations section. Real strategies land in between, trading amount of information for accuracy. Reranking by similarity raises accuracy without cutting the text. And trying to pull the model back with an external API did not work. The first version said &quot;Resample-Then-Rerank from 53.27% to 63.72%&quot;, and the second number does not exist in the paper.&lt;/p&gt;
&lt;h2 id=&quot;what-was-cut&quot;&gt;What was cut&lt;/h2&gt;
&lt;p&gt;The first version had two more drift metrics and eight other topics. Out went:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &quot;Composite Drift Metrics&quot;, attributed to ResearchGate with no link or author&lt;/li&gt;
&lt;li&gt;&quot;Contextual Flux&quot; (&lt;a rel=&quot;external&quot; href=&quot;https://arxiv.org/abs/2502.10942&quot;&gt;arXiv 2502.10942&lt;/a&gt;), from 2025, whose authors include a &quot;Zachary Mountebank&quot;; a mountebank is a charlatan, and the paper looks like the batches of auto-generated papers that showed up on arXiv. It also postdated this post&lt;/li&gt;
&lt;li&gt;The &quot;Trajectory Volatility Score&quot; and &quot;Semantic Divergence Metrics&quot;, with no source&lt;/li&gt;
&lt;li&gt;The Claude timeline, which cited 2025 versions in a 2024 post&lt;/li&gt;
&lt;li&gt;Consciousness, integrated information theory and global workspace: that belongs to the &lt;a href=&quot;https://brennercruvinel.blog/en/blog/roteiro-consciencia-llm/&quot;&gt;screenplay&lt;/a&gt; and to the &lt;a href=&quot;https://brennercruvinel.blog/en/blog/ontologia-poetica/&quot;&gt;poetic ontology&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Model extraction and jailbreaks, which are checked in the &lt;a href=&quot;https://brennercruvinel.blog/en/blog/model-extraction-attacks/&quot;&gt;reading list on extraction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Distillation, Mamba, mixture of experts, computational neuroscience, famous chatbot failures and communication between models, which were research summaries unrelated to drift&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A note on the name: in linguistics, &quot;semantic change&quot; or &quot;semantic drift&quot; is a word&#39;s meaning shifting over time, and tools like &lt;a rel=&quot;external&quot; href=&quot;https://github.com/Garrafao/LSCDetection&quot;&gt;LSCDetection&lt;/a&gt; measure that. It is a different phenomenon. The drift in this post is a text that starts right and ends wrong within a single generation.&lt;/p&gt;
</content>
        
    </entry>
</feed>
