Share
Embed
最先端NLP論文紹介:A Watermark for Large Language Models
tatsuki kuribayashi
August 27, 2023
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
11 slides
-
A Watermark for Large Language Models John Kirchenbauer, Jonas Geiping,
Yuxin Wen, Jonathan Katz, Ian Miers, Tom Goldstein (ICML2023) հऀɿ ܀ྛथੜ (MBZUAI) 2023/8/27 ࠷ઌNLP2023 -
͋Δจষ͕ݴޠϞσϧʹΑͬͯੜ͞Εͨͷ͔ ݕͰ͖ΔੈքͳΒخ͍͠ ͳͥʁ l ࣗಈੜ͞ΕͨςΩετͷѱ༻ʢྫɿϑΣΠΫχϡʔε࡞ʣݕ - ʮ͋ͳͨͷͱ͜ΖͷݴޠϞσϧ͕໎Λ͔͚͍ͯ·͢ʯͱ͍͏บʹର͢ΔӴ l ৽ͨͳݴޠϞσϧΛ܇࿅͢Δࡍͷ܇࿅σʔλϑΟϧλϦϯά l
จষͷ৴པੑʢਓؒʹΑͬͯॻ͔Ε͔ͨʣΛஅ͢ΔҰͭͷࢦඪ 2023/8/27 ࠷ઌNLP2023 ਪ͠ *$.- PVUTUBOEJOHQBQFS ײ֒ -
Δ͜ͱɾΒͳ͍͜ͱ ݴޠϞσϧ͔ΒςΩετΛੜ͢Δࡍʹʮಁ͔͠ʯΛೖΕΔ ---proactive-imprinting 2023/8/27 ࠷ઌNLP2023 ͋Δ伴Λͬͯ σίʔυ ݴޠϞσϧ 伴Λ͍ͬͯΔਓɼจষʹ
ಁ͔͕͠ೖ͍ͬͯΔ͔Λ֬ೝͰ͖Δ จষੜ Generated by LM ʲΔ͜ͱʳ ʲΒͳ͍͜ͱʳ • ݴޠϞσϧਓؒͷͲͪΒʹΑͬͯॻ͔Ε͔ͨจষԽΛྨ͢ΔϞσϧ࡞ʢ(15;FSPͳͲʣ ---post-hoc detection • ҙͷςΩετʹޙ͔Βಁ͔͠ΛೖΕΔ ʢݹ͔͘ΒͷΓํɼࠓճϑΥʔΧε֎ʣ ---post-hoc imprinting • "1*ఏڙऀ͕ϞσϧͷੜཤྺΛอଘ͠ɼর߹ͯ͠ݕ͢Δ ʢϓϥΠόγʔ͋Γʣ ---retrieval-based detection -
ݴޠϞσϧ͔Β୯ޠΛαϯϓϦϯά͢ΔࡍʹಛघͳόΠΞεΛ͔͚Δ ఏҊ๏ͷํ 2023/8/27 ࠷ઌNLP2023 … a to the you
it 𝑝(𝑤!) … 𝑝(𝑤!"#) … 𝑝(𝑤!"$) ఏҊΞΠσΟΞͷࡶͳΠϝʔδ ୯ޠͷબͼํʹ ಛผͳใΛ ຒΊࠐΉ -
ݴޠϞσϧ͔Β୯ޠΛαϯϓϦϯά͢ΔࡍʹಛघͳόΠΞεΛ͔͚Δ ҎԼΛͳΔ͘ຬ͍ͨͨ͠ɿ l จষͷ࣭ΛѱԽͤ͞ͳ͍ l ಁ͔͠Λফͮ͠Β͍ l ಁ͔͠ͷݕग़͕ίετ - cf.
ݕग़ʹେنݴޠϞσϧ͕ඞཁ l ݕग़ྗ͕ߴ͍ʢୈೋछͷաޡ͕ੜ͡ʹ͍͘ʀϞσϧͷੜΛݕ͜͠΅͞ͳ͍ʣ - গͳ͍τʔΫϯͰݕग़Ͱ͖Δ ఏҊ๏ͷํ 2023/8/27 ࠷ઌNLP2023 👎 ੜ͞Εͨจষ͓ͦΒ͘ۃΊͯಡΈͮΒ͍ɽ 👎 ͍୯ޠΛ͏ํ͕ਪଌͰ͖Εɼ͍୯ޠʹஔ͖͍͑ͯ͘͜ͱͰಁ͔͠ΛফͤΔɽ ྑ͘ͳ͍ྫɿͳΔ͘จࣈ͕ଟ͍୯ޠ͕ΘΕΔΑ͏ʹ୯ޠΛαϯϓϦϯά͢Δʢಁ͔͠ΛೖΕΔʣɽ ୯ޠͷฏۉΛଌΔ͜ͱͰಁ͔͕͠ೖ͍ͬͯΔ͔Λஅ͢Δɽ … a to the you it 𝑝(𝑤!) … 𝑝(𝑤!"#) … 𝑝(𝑤!"$) ୯ޠͷબͼํʹ ಛผͳใΛ ຒΊࠐΉ ఏҊΞΠσΟΞͷࡶͳΠϝʔδ -
ఏҊ๏ʢϋʔυ੍൛ʣ 2023/8/27 ࠷ઌNLP2023 “I want” … 𝑤!"# = 𝑤𝑎𝑛𝑡
(લํจ຺) ᶄཚΛ༻͍ͯ ޠኮू߹𝒱Λ ੍ݶޠኮ𝑅ͱ ީิޠኮ𝐺ʹׂ ʢ 𝐺 = 𝛾 𝒱 ; 0 < 𝛾 < 1 ʣ a to the you it ᶅީิޠኮ𝐺͔Β୯ޠΛαϯϓϧ 𝑤! =you ʲಁ͔͠ͷೖΕํʳ ֤୯ޠΛੜ͢Δࡍͷީิޠኮ𝐺Λ લ୯ޠɾϋογϡؔɾཚੜث͔ΒఆΊΔ ᶃલͷ୯ޠΛͱʹཚੜ • The watermark cannot be removed without modifying a significant fraction of the generated tokens. • We can compute a rigorous statistical measure of con- fidence that the watermark has been detected. 1.1. Notation & Language model basics Language models have a “vocabulary” V containing words or word fragments known as “tokens.” Typical vocab- ularies contain |V| = 50, 000 tokens or more (Radford et al., 2019; Liu et al., 2019). Consider a sequence of T tokens {s(t)} 2 VT . Entries with negative indices, s( Np) , · · · , s( 1), represent a “prompt” of length Np and s(0) , · · · , s(T ) are tokens generated by an AI system in re- sponse to the prompt. A language model (LM) for next word prediction, is a func- tion f, often parameterized by a neural network, that accepts as input a sequence of known tokens s( Np) , · · · , s(t 1), which contains a prompt and the first t 1 tokens already produced by the language model, and then outputs a vector of |V | logits, one for each word in the vocabulary. These logits are then passed through a softmax operator to convert them into a discrete probability distribution over the vocab- ulary. The next token at position t is then sampled from this distribution using either standard multinomial sampling, or greedy sampling (greedy decoding) of the single most likely next token. Additionally, a procedure such as beam search can be employed to consider multiple possible sequences before selecting the one with the overall highest score. We start out by describing a simple “hard” red list watermark in Algorithm 1 that is easy to analyze, easy to detect and hard to remove. The simplicity of this approach comes at the cost of poor generation quality on low entropy sequences. We will discuss more sophisticated strategies later. Algorithm 1 Text Generation with Hard Red List Input: prompt, s( Np) · · · s( 1) for t = 0, 1, · · · do 1. Apply the language model to prior tokens s( Np) · · · s(t 1) to get a probability vector p(t) over the vocabulary. 2. Compute a hash of token s(t 1) , and use it to seed a random number generator. 3. Using this seed, randomly partition the vocab- ulary into a “green list” G and a “red list” R of equal size. 4. Sample s(t) from G , never generating any token in the red list. end for The method works by generating a pseudo-random red list of tokens that are barred from appearing as s(t) . The red list generator is seeded with the prior token s(t 1), enabling the red list to be reproduced later without access to the entire generated sequence. ※ଓฤ[Kirchenbauer+23]Ͱɼલ୯ޠҎ֎͔ΒཚΛܾΊΔ͜ͱݕ౼ɽ֓Ͷ্ड़ͷγϯϓϧͳํ๏Ͱྑ͍ 𝑝(𝑤!|𝑤$!) 𝒱 -
ఏҊ๏ʢϋʔυ੍൛ʣ 2023/8/27 ࠷ઌNLP2023 ʲಁ͔͠ͷೖΕํʳ ֤୯ޠΛੜ͢Δࡍͷީิޠኮ𝐺Λ લ୯ޠɾϋογϡؔɾཚੜث͔ΒఆΊΔ ʲݕํ๏ʳ 𝑤!"# 𝑤!
֤ (𝑤!"# , 𝑤! ) ʹ͍ͭͯɼ𝑤! ͕𝐺ʹؚ·ΕΔ͔Λ֬ೝɽ 𝐺ʹؚ·ΕΔࣄ͕༗ҙʹසൃ͍ͯ͠Δ͔ೋ߲ݕఆʢ𝜋$ = 𝛾ʣ ϋογϡؔͱϥϯμϜ ू߹ׂث͕͋ΕΑ͍ ʢ👍 ݩͷݴޠϞσϧෆཁʣ ※ϋʔυ൛ͷ߹ɼ Ұ৭ʹͳΔ ※࠷Ͱશମͷ 1/4τʔΫϯΛ ॻ͖͑ͳ͍ͱ ৭τʔΫϯΛ1/2 ·ͰݮΒͤͳ͍ “I want” … 𝑤!"# = 𝑤𝑎𝑛𝑡 (લํจ຺) ᶄཚΛ༻͍ͯ ޠኮू߹𝒱Λ ੍ݶޠኮ𝑅ͱ ީิޠኮ𝐺ʹׂ ʢ 𝐺 = 𝛾 𝒱 ; 0 < 𝛾 < 1 ʣ a to the you it ᶅީิޠኮ𝐺͔Β୯ޠΛαϯϓϧ 𝑤! =you ᶃલͷ୯ޠΛͱʹཚੜ 𝑝(𝑤!|𝑤$!) 𝒱 A Watermark for Large Language Models John Kirchenbauer * 1 Jonas Geiping * 1 Yuxin Wen 1 Jonathan Katz 1 Ian Miers 1 Tom Goldstein 1 Abstract Potential harms of large language models can be mitigated by watermarking model output, i.e., em- bedding signals into generated text that are invisi- ble to humans but algorithmically detectable from a short span of tokens. We propose a watermark- ing framework for proprietary language models. The watermark can be embedded with negligible impact on text quality, and can be detected using an efficient open-source algorithm without access to the language model API or parameters. The watermark works by selecting a randomized set of “green” tokens before a word is generated, and then softly promoting use of green tokens during sampling. We propose a statistical test for de- tecting the watermark with interpretable p-values, and derive an information-theoretic framework for analyzing the sensitivity of the watermark. We test the watermark using a multi-billion parameter model from the Open Pretrained Transformer …The watermark detection algorithm can be made public, enabling third parties (e.g., social media platforms) to run it themselves, or it can be kept private and run behind an API. We seek a watermark with the following properties: Prompt No watermark With watermark - minimal marginal probability for a detection attempt. - Good speech frequency and energy rate reduction. - messages indiscernible to humans. - easy for humans to verify. Extremely efficient on average term lengths and word frequencies on synthetic, microamount text (as little as 25 words) Very small and low-resource key/hash (e.g., 140 bits per key is sufficient for 99.999999999% of the Synthetic Internet p-value Z-score Num tokens 56 36 .31 7.4 .38 6e-14 -
ݶք l Τϯτϩϐʔͷ͍෦ʹಁ͔͠ΛೖΕΔͱจষͷ࣭͕ѱԽ͢Δ 2023/8/27 ࠷ઌNLP2023 ͚͋·ͯ͠ … (લํจ຺) ͓ΊͰͱ͏
ީิޠኮ𝐺͔Β୯ޠΛαϯϓϧ 𝑤% = ɺ ɺ ʔ ʂ ʮ͜Ε͔͠ͳ͍ʯͱ͍͏࣍୯ޠީิ͕ ۮવ੍ݶޠኮʹೖΓɺจষͷ࣭͕མͪΔ Մೳੑ͕͋Δ ޠኮͷׂ A Watermark for Large Language Models c, enabling third parties (e.g., social media o run it themselves, or it can be kept private hind an API. We seek a watermark with the properties: ermark can be algorithmically detected with- knowledge of the model parameters or access for(i=0;i<n;i++) sum+=array[i] Were they produced by a human or by a language model? Determining this is fundamentally hard because these se quences have low entropy; the first few tokens strongly determine the following tokens. Low entropy text creates two problems for watermarking ಛʹϓϩάϥϜิͳͲͷ໘Ͱɺ ࣍୯ޠ͕Ұҙʹఆ·Δ͜ͱى͖ಘΔ -
ఏҊ๏ʢιϑτ੍൛ʣ l ੍ݶޠኮΛഉআ͢ΔͷͰͳ͘ɼީิޠኮͷϩδοτʹԼବ𝛿Λཤ͔ͤΔɽ Τϯτϩϐʔͷߴ͍ՕॴͰಁ͔͕͠ೖΓɼจষͷ࣭ͷѱԽΛ͛ͦ͏ɽ 2023/8/27 ࠷ઌNLP2023 ͚͋·ͯ͠ … (લํจ຺)
͓ΊͰͱ͏ 𝑤% = ͓ΊͰͱ͏ ɺ Ͷ ʂ ୯ޠ֬ͷεύΠΫΤϯτϩϐʔ𝑆ͱ͍͏ ͷΛಋೖ͠ʢؾ࣋ͪγϟϊϯΤϯτϩϐʔʹ͍ۙʣɼ ͞𝑇ͷจষʹೖΔਪޠኮͷ|𝑠|𝐺 ͷظͷ ԼքΛઆ໌ +𝛿 +𝛿 𝔼|𝑠|& ≥ 𝛾𝑇𝑒' 1 + (𝑒' − 1)𝛾 𝑆 Τϯτϩϐʔͷߴ͍จষ΄Ͳɼͨ͘͞Μಁ͔͠Λ ೖΕΒΕΔʢୈҰछͷաޡ͕ݮΔʣ ޠኮͷׂ ※ଓฤ[Kirchenbauer+23]Ͱɼલ୯ޠҎ֎͔ΒཚΛܾΊΔ͜ͱݕ౼ɽ֓Ͷ্ड़ͷγϯϓϧͳํ๏Ͱྑ͍ -
࣮ݧɾੳʢൈਮʣ l ಁ͔͠ͷʮڧ͞ʯʢ੍ݶޠኮׂ߹𝛾ɼީิޠኮͷԼବ𝛿ʣ ͱPPLτϨʔυΦϑ - ಁ͔͠Λڧ͘ೖΕͯɼਓؒͷධՁʢಁ͔͋͠Γɾͳ͠ ͲͬͪͷςΩετΛΉ͔ʣʹେ͖ͳӨڹ༩͑ͳ͍ [ଓฤAppendix 9.1] l
จষ͕͍΄Ͳಁ͔͠ೖΓจষͷz-scoreߴ - 128token͋Εܦݧ্98.4%ͷಁ͔͠ ςΩετݕग़Ͱ͖ͨʢOPTʣ l ಁ͔͠ೖΓจষΛGPT3.5 ਓؒͰॻ͖͚͑ͨͩͰɼ ಁ͔͕͠શʹফ͑ͳ͍ [ଓฤ] - ಁ͔͠ೖΓςΩετΛίϐʔͯ͠ಁ͔͠ͳ͠ ςΩετͷҰ෦ʹࠞͥࠐ·ΕΔঢ়گ͕ରॲ͠ʹ͍͘ 2023/8/27 ࠷ઌNLP2023 3 4 5 6 7 8 9 10 11 12 13 Oracle Model PPL (better →) 0 5 10 15 20 25 30 35 40 z-score (better →) = 10.0 = 5.0 = 2.0 = 1.0 = 0.0 0.9 0.75 0.5 0.25 0.1 Figure 2. The tradeoff between average z-score and language mod (right) Greedy and beam search with 4 and 8 beams for = .5. Be with smaller impact to model quality (perplexity, PPL). length of tokens from the end and treat them as a “baseline” completion. The remaining tokens are a prompt. A larger oracle language model (OPT-2.7B) is used to compute per- plexity (PPL) for the generated completions and for the human baseline. Watermark Strength vs Text Quality. One can achieve a very strong watermark for short sequences by choosing a small green list size and a large green list bias . How- ever, creating a stronger watermark may distort generated text. Figure 2 (left) shows the tradeoff between watermark strength (z-score) and text quality (perplexity) for various combinations of watermarking parameters. We compute PPL ಁ͔͠ೖΓ ςΩετͷ z-score จষ ݕग़ޭ ͍͢͠ ߈ܸͷ छྨ ॻ͖ ͑ ίϐʔ షΓ ͚ ʲؤ݈ੑʳ ʲੑ࣭ͷ֬ೝʢڻ͖ͳ͍ʣʳ -
ײ l A Watermark for Large Language Models ͱݴ͍ͬͯΔ͕ɼ Έ্ҙͷ୯ํσίʔμʹదԠՄೳɼ࣮؆୯
l ࣾձ࣮͢Δ߹ɼӡ༻ํ๏ʹ͍ͭͯߋʹ͕ٞඞཁͦ͏ - ಁ͔͠ೖΓϞσϧAPIͱಉ࣌ʹಁ͔͠ݕग़ثAPIͰެ։͢Δͱ͍͏ӡ༻͕҆ṛʁ - 伴͕όϨͣʹɼҰൠϢʔβಁ͔͠ΛݕՄೳ - ϞσϧΛύϥϝʔλ͝ͱެ։͢Δ߹ɺϢʔβʹಁ͔͠ΛೖΕͯ͏ඞཁ͕͋Δ - Ϣʔβ͕Θ͟Θ͟ಁ͔͠ΛೖΕΔΠϯηϯςΟϒʁ - ֤ʑͷ伴ʢϋογϡؔɾཚੜثʣ͕ཚཱ͢͠ΔͱɼݕఆΛ܁Γฦ͢ඞཁ͕ग़ͯ͠·͏ʢ୭͕ཧʁʣ l ଓฤɿ On the Reliability of Watermarks for Large Language Models (Kirchenbauer+,23; arXiv) νΣοΫ - ఏҊख๏ͷѥछɼݕఆํ๏ͷվળɼଞख๏ͱͷൺֱͳͲ 2023/8/27 ࠷ઌNLP2023