{
    "componentChunkName": "component---src-templates-post-tsx",
    "path": "/bert_diffusion/",
    "result": {"data":{"logo":null,"markdownRemark":{"html":"<h1>BERT는 사실 Diffusion 모델이였다?!</h1>\n<img src=\"https://nathan.rs/images/roberta-diffusion.gif\" width=\"500\">\n<p>최근 굉장히 흥미로운 글을 읽게되어 공유합니다.<br>\n원문 : <a href=\"https://nathan.rs/posts/roberta-diffusion/\">link</a></p>\n<h2>BERT와 Diffusion이 같은 방식이다?!</h2>\n<img width=\"500\" src=\"https://wikidocs.net/images/page/208933/bert.png\">\n<p>NLP 연구자들에게 BERT는 너무 익숙한 모델입니다. 2018년 등장 이후, 수많은 자연어처리의 분류, 검색, QA 태스크에 활용됐습니다. <code class=\"language-text\">[MASK]</code> 토큰으로 단어를 가리고 맞추는 Masked Language Modeling(MLM)은 너무나 단순하고 명확한 학습 방식인데 강력한 성능으로 당시 많은 연구자들을 좌절케하기도 했었습니다.</p>\n<p>Computer Vision(CV) 연구자들에게 Diffusion은 마찬가지로 익숙한 모델입니다. DALL-E, Stable Diffusion, Midjourney, … 등 이미지 생성의 표준이 된 이 기술은 노이즈를 점진적으로 추가했다 제거하는 방식으로 학습하여 이미지 생성 AI의 부흥을 이끌었습니다.</p>\n<p><em><strong>이 두 기술은 전혀 다른 분야, 전혀 다른 목적을 가진 다른 기술처럼 보였습니다.</strong></em></p>\n<p>그런데 문득 생각해보면, BERT의 MLM과 Diffusion의 노이즈를 추가했다가 제거하는 방식은 상당히 닮아있습니다.</p>\n<p>Diffusion 기술을 텍스트에 적용한다고 하면, BERT의 MLM과 굉장히 유사한 방식이라는 걸 알 수 있습니다.</p>\n<h3>BERT의 MLM</h3>\n<img src=\"https://raw.githubusercontent.com/UKPLab/sentence-transformers/master/docs/img/MLM.png\" width=\"500\">\n<ul>\n<li>입력 텍스트의 15%를 <code class=\"language-text\">[MASK]</code> 토큰으로 가림</li>\n<li>마스킹된 토큰 예측</li>\n</ul>\n<h3>Diffusion</h3>\n<ul>\n<li>입력 이미지에 노이즈(<code class=\"language-text\">[MASK]</code>)로 가리고, 원복하는 방식</li>\n<li>노이즈의 비율을 랜덤하게 적용한 방식으로 학습</li>\n</ul>\n<p>즉, BERT는 Diffusion 방식을 딱 입력의 15%로만 고정해놓고 학습시킨 케이스라고도 볼 수 있는거 아니냐는겁니다.</p>\n<h2>그렇다면 BERT로 텍스트 생성도 가능한걸까?</h2>\n<p>그렇다면, Diffusion 모델이 생성 모델인것처럼, BERT 같은 인코더 모델을 Diffusion처럼 <code class=\"language-text\">[MASK]</code>의 비율을 높여서 학습한다면, GPT처럼 텍스트 생성이 가능한걸까요?</p>\n<p>가능하다면, 굉장히 흥미로운 발견일겁니다. 최근 생성 AI는 GPT 같은 디코더 기반 모델이 주류를 이루고 있는데, 어쩌면 또다른 대안이 될테니까요.</p>\n<p>심지어 아키텍처 변경이나 새로운 학습 알고리즘도 필요없이, 학습시 마스킹 비율만 랜덤하게 해주면 됩니다!</p>\n<h2>RoBERTa로 텍스트 생성해보기</h2>\n<p>원문 글의 저자인 Nathan Barry는 BERT의 강화된 버전인 RoBERTa 모델로 텍스트 생성 모델로 바꿔보는 실험을 진행했습니다.</p>\n<p>핵심 아이디어는 위에서 설명한것처럼,학습할때 마스킹 비율을 랜덤하게 적용함으로써, 기존 BERT의 MLM을 발전시킨 방식으로 학습한다는 겁니다. (아래 코드는 Nathan이 적용한 diffusion_collator 예시입니다.)</p>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token keyword\">def</span> <span class=\"token function\">diffusion_collator</span><span class=\"token punctuation\">(</span>examples<span class=\"token punctuation\">)</span><span class=\"token punctuation\">:</span>\n    batch <span class=\"token operator\">=</span> tokenizer<span class=\"token punctuation\">.</span>pad<span class=\"token punctuation\">(</span>examples<span class=\"token punctuation\">,</span> return_tensors<span class=\"token operator\">=</span><span class=\"token string\">\"pt\"</span><span class=\"token punctuation\">)</span>\n    \n    <span class=\"token comment\"># 기존 BERT: mask_prob = 0.15 (고정)</span>\n    <span class=\"token comment\"># Diffusion BERT: 매 배치마다 랜덤 선택</span>\n    mask_prob <span class=\"token operator\">=</span> random<span class=\"token punctuation\">.</span>choice<span class=\"token punctuation\">(</span><span class=\"token punctuation\">[</span><span class=\"token number\">1.0</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.9</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.8</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.7</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.6</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.5</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.4</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.3</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.2</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.1</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span>\n    \n    <span class=\"token comment\"># 첫 16토큰은 프롬프트로 유지 (조건부 생성을 위해)</span>\n    maskable_positions <span class=\"token operator\">=</span> batch<span class=\"token punctuation\">.</span>input_ids<span class=\"token punctuation\">[</span><span class=\"token punctuation\">:</span><span class=\"token punctuation\">,</span> PREFIX_LEN<span class=\"token punctuation\">:</span><span class=\"token punctuation\">]</span>\n    mask <span class=\"token operator\">=</span> torch<span class=\"token punctuation\">.</span>rand<span class=\"token punctuation\">(</span>maskable_positions<span class=\"token punctuation\">.</span>shape<span class=\"token punctuation\">)</span> <span class=\"token operator\">&lt;</span> mask_prob\n    batch<span class=\"token punctuation\">.</span>input_ids<span class=\"token punctuation\">[</span><span class=\"token punctuation\">:</span><span class=\"token punctuation\">,</span> PREFIX_LEN<span class=\"token punctuation\">:</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">[</span>mask<span class=\"token punctuation\">]</span> <span class=\"token operator\">=</span> tokenizer<span class=\"token punctuation\">.</span>mask_token_id\n    \n    <span class=\"token keyword\">return</span> batch</code></pre></div>\n<p>이제 학습 후, 텍스트를 생성할때는 앞에 프롬프트를 고정한 상태에서, <code class=\"language-text\">[MASK]</code>를 점차 채워나가는 방식으로 진행됩니다.</p>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token comment\"># 초기 상태: [프롬프트] + 240개의 [MASK]</span>\nmask_schedule <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token number\">1.0</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.9</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.8</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.7</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.6</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.5</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.4</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.3</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.2</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.1</span><span class=\"token punctuation\">,</span> <span class=\"token number\">0.0</span><span class=\"token punctuation\">]</span>\n\n<span class=\"token keyword\">for</span> step<span class=\"token punctuation\">,</span> mask_prob <span class=\"token keyword\">in</span> <span class=\"token builtin\">enumerate</span><span class=\"token punctuation\">(</span>mask_schedule<span class=\"token punctuation\">)</span><span class=\"token punctuation\">:</span>\n    <span class=\"token comment\"># 현재 마스킹된 위치 예측</span>\n    outputs <span class=\"token operator\">=</span> model<span class=\"token punctuation\">(</span>input_ids<span class=\"token operator\">=</span>input_ids<span class=\"token punctuation\">)</span>\n    predictions <span class=\"token operator\">=</span> outputs<span class=\"token punctuation\">.</span>logits\n    \n    <span class=\"token comment\"># Top-k/top-p 샘플링으로 토큰 선택</span>\n    <span class=\"token keyword\">for</span> pos <span class=\"token keyword\">in</span> masked_positions<span class=\"token punctuation\">:</span>\n        sampled_token <span class=\"token operator\">=</span> sample_from_logits<span class=\"token punctuation\">(</span>predictions<span class=\"token punctuation\">[</span>pos<span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span>\n        input_ids<span class=\"token punctuation\">[</span>pos<span class=\"token punctuation\">]</span> <span class=\"token operator\">=</span> sampled_token\n    \n    <span class=\"token comment\"># 다음 단계를 위해 일부 다시 마스킹</span>\n    <span class=\"token keyword\">if</span> mask_prob <span class=\"token operator\">></span> <span class=\"token number\">0</span><span class=\"token punctuation\">:</span>\n        remask_randomly<span class=\"token punctuation\">(</span>input_ids<span class=\"token punctuation\">,</span> mask_prob<span class=\"token punctuation\">)</span></code></pre></div>\n<ul>\n<li>단계별 생성 과정:</li>\n</ul>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Step 0: [PROMPT] [MASK] [MASK] [MASK] [MASK] [MASK] ...     (100% masked)\nStep 1: [PROMPT] will [MASK] over [MASK] control ...        (90% masked)\nStep 2: [PROMPT] will begin [MASK] greater control ...      (80% masked)\nStep 5: [PROMPT] will begin to [MASK] greater control ...   (50% masked)\n...\nStep 10: [PROMPT] will begin to assert greater control ...  (0% masked - 완료)</code></pre></div>\n<p>이러한 컨셉을 가지고 Nathan이 직접 학습해본 결과, H200으로 30분만의 학습으로,</p>\n<h4>Input Prompt:</h4>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Following their victory in the French and Indian War, Britain began to assert greater...</code></pre></div>\n<h4>Generated Text:</h4>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">...dominion over Europe beginning about the early 19th. There conflict took \nplace on the island, between British and Irish Ireland. British officials \nadministered British Ireland, a Celtic empire under the control of the Irish \nnationalist authorities, defined as a dominion of Britain. As the newly Fortic \nstates acquired independent and powerful status, many former English colonies \nplayed their part in this new, British @-@ controlled colonial system...</code></pre></div>\n<p>와 같은 결과를 보이게 됐습니다..!</p>\n<p>놀랍게도 문법적으로 올바르면서도 그럴듯한 문장을 생성해냈습니다. 겨우 30분의 추가 학습만으로요.</p>\n<h3>이 개념의 시사점</h3>\n<ol>\n<li>NLP와 CV 커뮤니티가 서로 다르게 발전시켜온 기술이 사실 비슷한 방식이라는 점</li>\n<li>기존 BERT 계열의 모델들(BERT, RoBERTa, ELECTRA, DeBERTa, …)이 잠재적 생성 모델이였다는 것</li>\n<li>양방향성 : GPT는 태생적으로 단방향(left to right) 모델인데, BERT는 양방향 문맥을 고려하는 모델입니다. 이러한 태생적인 차이가 생성쪽에 어떻게 활용될 수 있을지도 고민해볼만한 포인트입니다</li>\n</ol>\n<p>물론 BERT 같은 인코더 모델이 상용에 적용될만한 모델이 되려면 기존 GPT처럼 여러 엔지니어링적인 고민들이 필요할것입니다. 하지만 AI 연구자들에게는 GPT 아키텍처만이 아닌 새로운 선택지가 생겼다는 것만으로도 굉장히 흥미로운 사실입니다 :)</p>\n<h4>Reference</h4>\n<ul>\n<li><a href=\"https://nathan.rs/posts/roberta-diffusion/\">Original Blog Post by Nathan Barry</a></li>\n<li><a href=\"https://github.com/nathan-barry/RoBERTaDiffusion\">Code on GitHub</a></li>\n</ul>","htmlAst":{"type":"root","children":[{"type":"element","tagName":"h1","properties":{},"children":[{"type":"text","value":"BERT는 사실 Diffusion 모델이였다?!"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"src":"https://nathan.rs/images/roberta-diffusion.gif","width":500},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"최근 굉장히 흥미로운 글을 읽게되어 공유합니다."},{"type":"element","tagName":"br","properties":{},"children":[]},{"type":"text","value":"\n원문 : "},{"type":"element","tagName":"a","properties":{"href":"https://nathan.rs/posts/roberta-diffusion/"},"children":[{"type":"text","value":"link"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{},"children":[{"type":"text","value":"BERT와 Diffusion이 같은 방식이다?!"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"width":500,"src":"https://wikidocs.net/images/page/208933/bert.png"},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"NLP 연구자들에게 BERT는 너무 익숙한 모델입니다. 2018년 등장 이후, 수많은 자연어처리의 분류, 검색, QA 태스크에 활용됐습니다. "},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"[MASK]"}]},{"type":"text","value":" 토큰으로 단어를 가리고 맞추는 Masked Language Modeling(MLM)은 너무나 단순하고 명확한 학습 방식인데 강력한 성능으로 당시 많은 연구자들을 좌절케하기도 했었습니다."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Computer Vision(CV) 연구자들에게 Diffusion은 마찬가지로 익숙한 모델입니다. DALL-E, Stable Diffusion, Midjourney, … 등 이미지 생성의 표준이 된 이 기술은 노이즈를 점진적으로 추가했다 제거하는 방식으로 학습하여 이미지 생성 AI의 부흥을 이끌었습니다."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"em","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"이 두 기술은 전혀 다른 분야, 전혀 다른 목적을 가진 다른 기술처럼 보였습니다."}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"그런데 문득 생각해보면, BERT의 MLM과 Diffusion의 노이즈를 추가했다가 제거하는 방식은 상당히 닮아있습니다."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Diffusion 기술을 텍스트에 적용한다고 하면, BERT의 MLM과 굉장히 유사한 방식이라는 걸 알 수 있습니다."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"BERT의 MLM"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"src":"https://raw.githubusercontent.com/UKPLab/sentence-transformers/master/docs/img/MLM.png","width":500},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"입력 텍스트의 15%를 "},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"[MASK]"}]},{"type":"text","value":" 토큰으로 가림"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"마스킹된 토큰 예측"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"Diffusion"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"입력 이미지에 노이즈("},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"[MASK]"}]},{"type":"text","value":")로 가리고, 원복하는 방식"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"노이즈의 비율을 랜덤하게 적용한 방식으로 학습"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"즉, BERT는 Diffusion 방식을 딱 입력의 15%로만 고정해놓고 학습시킨 케이스라고도 볼 수 있는거 아니냐는겁니다."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{},"children":[{"type":"text","value":"그렇다면 BERT로 텍스트 생성도 가능한걸까?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"그렇다면, Diffusion 모델이 생성 모델인것처럼, BERT 같은 인코더 모델을 Diffusion처럼 "},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"[MASK]"}]},{"type":"text","value":"의 비율을 높여서 학습한다면, GPT처럼 텍스트 생성이 가능한걸까요?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"가능하다면, 굉장히 흥미로운 발견일겁니다. 최근 생성 AI는 GPT 같은 디코더 기반 모델이 주류를 이루고 있는데, 어쩌면 또다른 대안이 될테니까요."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"심지어 아키텍처 변경이나 새로운 학습 알고리즘도 필요없이, 학습시 마스킹 비율만 랜덤하게 해주면 됩니다!"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{},"children":[{"type":"text","value":"RoBERTa로 텍스트 생성해보기"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"원문 글의 저자인 Nathan Barry는 BERT의 강화된 버전인 RoBERTa 모델로 텍스트 생성 모델로 바꿔보는 실험을 진행했습니다."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"핵심 아이디어는 위에서 설명한것처럼,학습할때 마스킹 비율을 랜덤하게 적용함으로써, 기존 BERT의 MLM을 발전시킨 방식으로 학습한다는 겁니다. (아래 코드는 Nathan이 적용한 diffusion_collator 예시입니다.)"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"python"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-python"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-python"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"def"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","function"]},"children":[{"type":"text","value":"diffusion_collator"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"examples"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"text","value":"\n    batch "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" tokenizer"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"pad"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"examples"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" return_tensors"},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"element","tagName":"span","properties":{"className":["token","string"]},"children":[{"type":"text","value":"\"pt\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":"\n    \n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"# 기존 BERT: mask_prob = 0.15 (고정)"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"# Diffusion BERT: 매 배치마다 랜덤 선택"}]},{"type":"text","value":"\n    mask_prob "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" random"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"choice"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"["}]},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"1.0"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.9"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.8"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.7"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.6"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.5"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.4"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.3"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.2"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.1"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"]"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":"\n    \n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"# 첫 16토큰은 프롬프트로 유지 (조건부 생성을 위해)"}]},{"type":"text","value":"\n    maskable_positions "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" batch"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"input_ids"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"["}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" PREFIX_LEN"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"]"}]},{"type":"text","value":"\n    mask "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" torch"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"rand"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"maskable_positions"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"shape"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"<"}]},{"type":"text","value":" mask_prob\n    batch"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"input_ids"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"["}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" PREFIX_LEN"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"]"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"["}]},{"type":"text","value":"mask"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"]"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" tokenizer"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"mask_token_id\n    \n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"return"}]},{"type":"text","value":" batch"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"이제 학습 후, 텍스트를 생성할때는 앞에 프롬프트를 고정한 상태에서, "},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"[MASK]"}]},{"type":"text","value":"를 점차 채워나가는 방식으로 진행됩니다."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"python"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-python"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-python"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"# 초기 상태: [프롬프트] + 240개의 [MASK]"}]},{"type":"text","value":"\nmask_schedule "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"["}]},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"1.0"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.9"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.8"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.7"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.6"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.5"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.4"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.3"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.2"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.1"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0.0"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"]"}]},{"type":"text","value":"\n\n"},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"for"}]},{"type":"text","value":" step"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" mask_prob "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"in"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","builtin"]},"children":[{"type":"text","value":"enumerate"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"mask_schedule"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"# 현재 마스킹된 위치 예측"}]},{"type":"text","value":"\n    outputs "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" model"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"input_ids"},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":"input_ids"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":"\n    predictions "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" outputs"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"logits\n    \n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"# Top-k/top-p 샘플링으로 토큰 선택"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"for"}]},{"type":"text","value":" pos "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"in"}]},{"type":"text","value":" masked_positions"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"text","value":"\n        sampled_token "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" sample_from_logits"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"predictions"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"["}]},{"type":"text","value":"pos"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"]"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":"\n        input_ids"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"["}]},{"type":"text","value":"pos"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"]"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" sampled_token\n    \n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"# 다음 단계를 위해 일부 다시 마스킹"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"if"}]},{"type":"text","value":" mask_prob "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":">"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"0"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":":"}]},{"type":"text","value":"\n        remask_randomly"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"input_ids"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" mask_prob"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"단계별 생성 과정:"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"text"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-text"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"Step 0: [PROMPT] [MASK] [MASK] [MASK] [MASK] [MASK] ...     (100% masked)\nStep 1: [PROMPT] will [MASK] over [MASK] control ...        (90% masked)\nStep 2: [PROMPT] will begin [MASK] greater control ...      (80% masked)\nStep 5: [PROMPT] will begin to [MASK] greater control ...   (50% masked)\n...\nStep 10: [PROMPT] will begin to assert greater control ...  (0% masked - 완료)"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"이러한 컨셉을 가지고 Nathan이 직접 학습해본 결과, H200으로 30분만의 학습으로,"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Input Prompt:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"text"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-text"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"Following their victory in the French and Indian War, Britain began to assert greater..."}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Generated Text:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"text"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-text"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"...dominion over Europe beginning about the early 19th. There conflict took \nplace on the island, between British and Irish Ireland. British officials \nadministered British Ireland, a Celtic empire under the control of the Irish \nnationalist authorities, defined as a dominion of Britain. As the newly Fortic \nstates acquired independent and powerful status, many former English colonies \nplayed their part in this new, British @-@ controlled colonial system..."}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"와 같은 결과를 보이게 됐습니다..!"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"놀랍게도 문법적으로 올바르면서도 그럴듯한 문장을 생성해냈습니다. 겨우 30분의 추가 학습만으로요."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"이 개념의 시사점"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ol","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"NLP와 CV 커뮤니티가 서로 다르게 발전시켜온 기술이 사실 비슷한 방식이라는 점"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"기존 BERT 계열의 모델들(BERT, RoBERTa, ELECTRA, DeBERTa, …)이 잠재적 생성 모델이였다는 것"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"양방향성 : GPT는 태생적으로 단방향(left to right) 모델인데, BERT는 양방향 문맥을 고려하는 모델입니다. 이러한 태생적인 차이가 생성쪽에 어떻게 활용될 수 있을지도 고민해볼만한 포인트입니다"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"물론 BERT 같은 인코더 모델이 상용에 적용될만한 모델이 되려면 기존 GPT처럼 여러 엔지니어링적인 고민들이 필요할것입니다. 하지만 AI 연구자들에게는 GPT 아키텍처만이 아닌 새로운 선택지가 생겼다는 것만으로도 굉장히 흥미로운 사실입니다 :)"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Reference"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://nathan.rs/posts/roberta-diffusion/"},"children":[{"type":"text","value":"Original Blog Post by Nathan Barry"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/nathan-barry/RoBERTaDiffusion"},"children":[{"type":"text","value":"Code on GitHub"}]}]},{"type":"text","value":"\n"}]}],"data":{"quirksMode":false}},"excerpt":"BERT는 사실 Diffusion 모델이였다?! 최근 굉장히 흥미로운 글을 읽게되어 공유합니다. 원문 : link BERT와 Diffusion이 같은 방식이다?! NLP 연구자들에게 BERT는 너무 익숙한 모델입니다. 201…","fields":{"readingTime":{"text":"8 min read"}},"frontmatter":{"title":"BERT는 사실 Diffusion 모델이였다?!","userDate":"21 October 2025","date":"2025-10-21T12:00:00.000Z","tags":["nlp","diffusion","bert","chatgpt"],"excerpt":null,"image":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#f88818","images":{"fallback":{"src":"/static/840f7d27d12750296becbcb573ee9f7f/b5658/bert-diffusion.png","srcSet":"/static/840f7d27d12750296becbcb573ee9f7f/f054e/bert-diffusion.png 750w,\n/static/840f7d27d12750296becbcb573ee9f7f/b5658/bert-diffusion.png 1024w","sizes":"100vw"},"sources":[{"srcSet":"/static/840f7d27d12750296becbcb573ee9f7f/4f03f/bert-diffusion.webp 750w,\n/static/840f7d27d12750296becbcb573ee9f7f/67ded/bert-diffusion.webp 1024w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":1}}},"author":[{"id":"Soohwan Kim","bio":"Co-founder/A.I. engineer at TUNiB.","avatar":{"children":[{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#282838","images":{"fallback":{"src":"/static/a9e6b445142b247ee4cfa66155398bb2/0d6f4/soohwan.png","srcSet":"/static/a9e6b445142b247ee4cfa66155398bb2/248f9/soohwan.png 40w,\n/static/a9e6b445142b247ee4cfa66155398bb2/fd435/soohwan.png 80w,\n/static/a9e6b445142b247ee4cfa66155398bb2/0d6f4/soohwan.png 120w","sizes":"100vw"},"sources":[{"srcSet":"/static/a9e6b445142b247ee4cfa66155398bb2/e7f45/soohwan.webp 40w,\n/static/a9e6b445142b247ee4cfa66155398bb2/589ec/soohwan.webp 80w,\n/static/a9e6b445142b247ee4cfa66155398bb2/71a38/soohwan.webp 120w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.6833333333333333}}]}}]}},"relatedPosts":{"totalCount":50,"edges":[{"node":{"id":"6529d72e-80e7-5d61-a672-d66276a3f641","excerpt":"MoE(Mixture of Experts) 기초부터 DeepSeek 혁신까지 작년 이맘때쯤 DeepSeek-V3가 저비용으로 엄청난 성능을 보이면서 화제가 되었습니다. 그 핵심 기술인 MoE(Mixture of Experts…","frontmatter":{"title":"MoE(Mixture of Experts) 기초부터 DeepSeek 혁신까지","date":"2026-01-15T01:11:55.000Z"},"fields":{"readingTime":{"text":"8 min read"},"slug":"/developed-moe/"}}},{"node":{"id":"8b49d3ef-4ce3-568c-9d71-240ff17fc3e0","excerpt":"BERT는 사실 Diffusion 모델이였다?! 최근 굉장히 흥미로운 글을 읽게되어 공유합니다. 원문 : link BERT와 Diffusion이 같은 방식이다?! NLP 연구자들에게 BERT는 너무 익숙한 모델입니다. 201…","frontmatter":{"title":"BERT는 사실 Diffusion 모델이였다?!","date":"2025-10-21T12:00:00.000Z"},"fields":{"readingTime":{"text":"8 min read"},"slug":"/bert_diffusion/"}}},{"node":{"id":"7c7e1676-ea84-58de-970c-ddec9aa10660","excerpt":"RLHF는 수다쟁이를 만든다?! (Does RLHF Breed Verbose Chatterboxes?!) RLHF(Reinforcement Learning from Human Feedback)는 OpenAI의 ChatGPT…","frontmatter":{"title":"RLHF는 수다쟁이를 만든다?! (Does RLHF Breed Verbose Chatterboxes?!)","date":"2024-03-13T01:11:55.000Z"},"fields":{"readingTime":{"text":"7 min read"},"slug":"/rlhf-vervosity/"}}},{"node":{"id":"2b9d3e22-1796-5fab-878d-5941d2e76e9d","excerpt":"LLM Paper Abstract - 2023.12 LLM…","frontmatter":{"title":"LLM Paper Abstract - 2023.12","date":"2024-01-05T10:00:00.000Z"},"fields":{"readingTime":{"text":"5 min read"},"slug":"/llm-abs-202312/"}}},{"node":{"id":"f43fa33b-917b-5c00-8462-937d99592ad7","excerpt":"What it MoE? (Mixture of Experts) 현존 최강 LLM인 GPT-4에서 “MoE (Mixture of Experts)” 방식을 채택하여 사용하고 있다고 알려졌는데요, 최근 AI계의 뜨거운 감자 Mistral AI…","frontmatter":{"title":"What is MoE? (Mixture of Experts)","date":"2023-12-22T01:11:55.000Z"},"fields":{"readingTime":{"text":"9 min read"},"slug":"/moe/"}}}]}},"pageContext":{"slug":"/bert_diffusion/","prev":{"excerpt":"LangGraph로 구현하는 Self-Correcting RAG 시스템 이번 실습에서는 LangGraph를 활용하여 스스로 품질을 검증하고 개선하는 고급 RAG…","frontmatter":{"title":"LangGraph로 구현하는 RAG 시스템 실습","tags":["langchain","langgraph","openai","rag"],"date":"2025-10-21T10:00:00.000Z","draft":null,"excerpt":null,"image":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","placeholder":{"fallback":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAACPklEQVQ4y+VUTWsTURTNLxDc+EUb6aIb46qoEZOiQy1tgi1KyMqNYIoLV4LQhSuV2kWLi2mbQmMhQgrJwoo0oxPTJqaNodgmYAgEajWTdjRNCQbbLJpkJkfe0KeTj3HlRrxweY8575175n48Hf6y6f49wlqt9muVictynatxutckrCOTZU0V0iHWilRTIbFC/juyW1+xvZPDdi4HIStiv1RqCv5HhVSZ87kHhltWnLVbYbjaD4PFAsNNK7quDeJNJFKnVJOQkm1uZaE3duOYwwQ924sTFy7i5HUT2u5expGeLlyy2VGuVLQV0lxQwo3MF7Sbu3H8vBEdbgva7jE41WeC/g6Do8w5GG/YcFAuN+WRrDp1BEJYrVaV/ZjLhXazGadtV9Bp78WZvn50DDLoZHowHwgoZ4hKep/+vqJwr1RCVZKa8lHc+4F8voCPqTS4cBifM1mUD5W1KiRpM4XQx3HKh0QqhbcrK3gVDOLd6iqi6+vglyPwcX684Hksr31ALJFAKBZDMBrFwtIS5nkeI1NTWEsmfyucnpvDRiajAANDQ5j2ePCIZTE2M4OHLIuns7OIxeO4PzoKr9+PkclJDDgccHm9uD08DNbtVjhIyhRComRhcRGvw2FwoRCyoohNQcCD8XE8cTqRTKfxMhBQguZ2d/E+Hscznw+PJyaUQIIo4pMgQJKk+qI0GiH4ls+3xCqVCgrFYus+VM8qqZbcMHoksnqWpQaMzn2NFoX2ktrVgRrPqB+PRkz3/z2wPwHHhr9F8qvtTQAAAABJRU5ErkJggg=="},"images":{"fallback":{"src":"/static/409cd6d6cbcf6367148c1be51de6774b/51df5/langgraph.png","srcSet":"/static/409cd6d6cbcf6367148c1be51de6774b/51df5/langgraph.png 670w","sizes":"100vw"},"sources":[{"srcSet":"/static/409cd6d6cbcf6367148c1be51de6774b/dd06b/langgraph.webp 670w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":1.0029850746268656}}},"author":[{"id":"Soohwan Kim","bio":"Co-founder/A.I. engineer at TUNiB.","avatar":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","placeholder":{"fallback":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAADjElEQVQ4y23Oy48TdQDA8TExEaTttvSBfdHddru7bWc6bWd+8+i0u23n0SdlBRQXZGHDgiiLDwgqXjCIJEaC8cLBmHgwUU9EYzRqQuLJi/4NJB6NF+8evgbOHr7XT76SM5ix7s4QnRHnnm9yZzvBTIswN8JcP5bC67ZoWi7CdtFsn5bloZo+dSNAMYbIIqCmD6mJIVXdR3J6I7r9IQ3T59pZlW+uxzndCbPdC/HZXoq3TikowsfqBOjOmFZ7SrM9p2kfRbXn1O0jKNbsSbJ5BMnu9Gl3+qiiz4OPSvz0QRLHFGwOZH6+neLHT5YRbRerM0J0JrTas/8FZXNKzZgg2es+ZtvDdbs8+iHJl+9lWVP7OG2br26k+PvXJCfmFqoYIpwhTXtMwxpTN0coxhjFmCKbE2rGmKoYPQY9qi2fyzsq//4e5sNXi5TlLqbd5t6lPH/9kuDTG2usqgGi7dO0hzSsIXUzQDaGKGKMLEZUxZCKCJB02+PUpMH9vQwP7ybYnSxyfNrjwumA3dEiD94v8cfnK7xzWsbpujQtH9X0qBs+iuEjC5+a7lPVPSqai9SyelyYFbjkh5hqC3TkKOutLON2nkYpgtuMcT6IszdPslo8SLlcpmUH1A0XRQyQhUtNuFQ1l4o2QFI1h3OTVXbcg+grIfSVBRqlEGopgrYSRi0e4KiIse1mScSeopA/iLADmoZL3Rgg631q+oCq1qeq95FOzhQefpzn7eMpBmqcoBVj04pzwkky0eNMRYIdL8F3twusLe2nslrE6g5pGX1U8/FhD1nvUW1tUJK7SH9+n+DR1zF2vQSvH0lz88wiV45V2J1WuHqsxLXNAnuzNJdfWmK5/BylUgFhb6DZAxR9g7rpIos+Wttja2uE9M9vYb69k+DqfJErWzLOuoVqdKlpDo4jODms4zlFckuHObx4iHwuRi6fYqmYY201x/LqMrnFDNl8gRvvukhNdT9394rcOlNFMxrUhYFmW9imTEsp0mhWKC2nWSokyWSiFA7HSKcXiEb34fayyLVniUQk8rmn2drKIqlqiNcuVrh2ymQS1Nh8sc/GoMEbl7u8eb5D1yqTzkRJJsOkkiGymQVShyLE4yHWKnEq1RjpTIhmI8r2y3mkyloI38uha1n6bpVXrkw5+4LD/S/2uHnrIopaJhZ9hmQqwqHkAXJP8BDhyD46ZoWdMxOGcx/PNfECk/8AbxXdRjRliPoAAAAASUVORK5CYII="},"images":{"fallback":{"src":"/static/a9e6b445142b247ee4cfa66155398bb2/7cf1f/soohwan.png","srcSet":"/static/a9e6b445142b247ee4cfa66155398bb2/34f77/soohwan.png 750w,\n/static/a9e6b445142b247ee4cfa66155398bb2/a94f6/soohwan.png 1080w,\n/static/a9e6b445142b247ee4cfa66155398bb2/7cf1f/soohwan.png 1148w","sizes":"100vw"},"sources":[{"srcSet":"/static/a9e6b445142b247ee4cfa66155398bb2/38420/soohwan.webp 750w,\n/static/a9e6b445142b247ee4cfa66155398bb2/7470d/soohwan.webp 1080w,\n/static/a9e6b445142b247ee4cfa66155398bb2/b5ef6/soohwan.webp 1148w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.6829268292682927}}}}]},"fields":{"readingTime":{"text":"21 min read"},"layout":"post","slug":"/langgraph/"}},"next":{"excerpt":"Throwback 2025 2020년 회고 글 2021년 회고 글 2023년 회고 글 2024년 회고 글 2025년 회고 글입니다! 202…","frontmatter":{"title":"Throwback 2025","tags":["record"],"date":"2026-01-01T10:00:00.000Z","draft":false,"excerpt":null,"image":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","placeholder":{"fallback":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAAsTAAALEwEAmpwYAAADJElEQVQozwEZA+b8AHKmrYe8v4XCxJ2zpau6qrvHt5HGwZvEu53GxY62toy6t8DEsLvFssHXxsXayMvjzsHayLa/rKS3rn+srgBkoKjU1cOjvKzGzLvIw66tr56LvLWfwLWjysZ/traTwLzt3cba1L7F1MHK3Mne2sDU1r3WwqS7rJtyp6oAbKKnxNfOl7675ObcvtDFXnFyKB8waoaGsuDUkbW1kbuy0NHE8/Hiucy6r8Kv3NvKu8eztsKwo7aseaemAGmjp3OqnlOJlpqVk561p3J9e1VHTXaKioCtqIOino23sZaZk5+em9DMuMvArNfMu7S3sq3Fu77KwnKfowBhmqF8nZRckJdydX15cHB5e3d/mZeBfXZ9Z1xyioV3fnJTTFphYG24qpq8w6+vpJSYgnmIk4yUo5ltlZkAU4mTl5OMe3hxMF5zZ2VmhZCMdrm/bnx7solvhYmCfXx0enl2qZyLzLmb1cCexKuKq5Fyr5iFnnxva3p5AHKXooent32XpnKXqHmbpnuisoutuoSVl5GDc5aJeot5a4uFe5WZk7q0pqmup5GXk6CgnLaxopKRj3WFigBlp8RywfF3ud6N2f95sc6VxdjC5e7D3+bO2NWvurhbZHBveYdZd5F7maB7q7plm7CHuqyRpaaJlp5mfIoAda/Aqt3tn7nBy/DygaWsiqmwq8jIs9ngt9jWg5qZdmZlmI+CnqCV2tvQqsamnL6hnb6RjqyNmpmPhoN9AIm0vMfV2X+CicfTwdDQv8LHvKjCwUqJj4xvaZRkWkA3QU5vcZWslurg1bq1oO3q17m1lKCHTmtwamVaVgBsk5SFlIRxamqEeHmAj5Gnk4O9rpuCtrmcq6p7iYkSQXZAWXg/XXY5YodpeHp9hpBseYNNQUlEWXpDUGsAT3iAfHtssqWLN0NXFGeVopOQgn98U5OhhbW/do6KCSNNK0BcOEdnFEB1RklaYlpnTkpXGzRZBCVYKThXAFl2foN8cpmWeldmZzlTcrGvr6mnoGp6dYCRln99gCgzUDVAVzJDYCxFZT1IWjJKbDNKaTFFYSIzVTxDWM9ywkFQtIcUAAAAAElFTkSuQmCC"},"images":{"fallback":{"src":"/static/f6779a574676afa1bc96d6af9d6c9005/6e90d/2025.png","srcSet":"/static/f6779a574676afa1bc96d6af9d6c9005/ea847/2025.png 750w,\n/static/f6779a574676afa1bc96d6af9d6c9005/4a806/2025.png 1080w,\n/static/f6779a574676afa1bc96d6af9d6c9005/e2aad/2025.png 1366w,\n/static/f6779a574676afa1bc96d6af9d6c9005/6e90d/2025.png 1536w","sizes":"100vw"},"sources":[{"srcSet":"/static/f6779a574676afa1bc96d6af9d6c9005/57584/2025.webp 750w,\n/static/f6779a574676afa1bc96d6af9d6c9005/984df/2025.webp 1080w,\n/static/f6779a574676afa1bc96d6af9d6c9005/4a276/2025.webp 1366w,\n/static/f6779a574676afa1bc96d6af9d6c9005/7db9c/2025.webp 1536w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.6666666666666666}}},"author":[{"id":"Soohwan Kim","bio":"Co-founder/A.I. engineer at TUNiB.","avatar":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","placeholder":{"fallback":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAADjElEQVQ4y23Oy48TdQDA8TExEaTttvSBfdHddru7bWc6bWd+8+i0u23n0SdlBRQXZGHDgiiLDwgqXjCIJEaC8cLBmHgwUU9EYzRqQuLJi/4NJB6NF+8evgbOHr7XT76SM5ix7s4QnRHnnm9yZzvBTIswN8JcP5bC67ZoWi7CdtFsn5bloZo+dSNAMYbIIqCmD6mJIVXdR3J6I7r9IQ3T59pZlW+uxzndCbPdC/HZXoq3TikowsfqBOjOmFZ7SrM9p2kfRbXn1O0jKNbsSbJ5BMnu9Gl3+qiiz4OPSvz0QRLHFGwOZH6+neLHT5YRbRerM0J0JrTas/8FZXNKzZgg2es+ZtvDdbs8+iHJl+9lWVP7OG2br26k+PvXJCfmFqoYIpwhTXtMwxpTN0coxhjFmCKbE2rGmKoYPQY9qi2fyzsq//4e5sNXi5TlLqbd5t6lPH/9kuDTG2usqgGi7dO0hzSsIXUzQDaGKGKMLEZUxZCKCJB02+PUpMH9vQwP7ybYnSxyfNrjwumA3dEiD94v8cfnK7xzWsbpujQtH9X0qBs+iuEjC5+a7lPVPSqai9SyelyYFbjkh5hqC3TkKOutLON2nkYpgtuMcT6IszdPslo8SLlcpmUH1A0XRQyQhUtNuFQ1l4o2QFI1h3OTVXbcg+grIfSVBRqlEGopgrYSRi0e4KiIse1mScSeopA/iLADmoZL3Rgg631q+oCq1qeq95FOzhQefpzn7eMpBmqcoBVj04pzwkky0eNMRYIdL8F3twusLe2nslrE6g5pGX1U8/FhD1nvUW1tUJK7SH9+n+DR1zF2vQSvH0lz88wiV45V2J1WuHqsxLXNAnuzNJdfWmK5/BylUgFhb6DZAxR9g7rpIos+Wttja2uE9M9vYb69k+DqfJErWzLOuoVqdKlpDo4jODms4zlFckuHObx4iHwuRi6fYqmYY201x/LqMrnFDNl8gRvvukhNdT9394rcOlNFMxrUhYFmW9imTEsp0mhWKC2nWSokyWSiFA7HSKcXiEb34fayyLVniUQk8rmn2drKIqlqiNcuVrh2ymQS1Nh8sc/GoMEbl7u8eb5D1yqTzkRJJsOkkiGymQVShyLE4yHWKnEq1RjpTIhmI8r2y3mkyloI38uha1n6bpVXrkw5+4LD/S/2uHnrIopaJhZ9hmQqwqHkAXJP8BDhyD46ZoWdMxOGcx/PNfECk/8AbxXdRjRliPoAAAAASUVORK5CYII="},"images":{"fallback":{"src":"/static/a9e6b445142b247ee4cfa66155398bb2/7cf1f/soohwan.png","srcSet":"/static/a9e6b445142b247ee4cfa66155398bb2/34f77/soohwan.png 750w,\n/static/a9e6b445142b247ee4cfa66155398bb2/a94f6/soohwan.png 1080w,\n/static/a9e6b445142b247ee4cfa66155398bb2/7cf1f/soohwan.png 1148w","sizes":"100vw"},"sources":[{"srcSet":"/static/a9e6b445142b247ee4cfa66155398bb2/38420/soohwan.webp 750w,\n/static/a9e6b445142b247ee4cfa66155398bb2/7470d/soohwan.webp 1080w,\n/static/a9e6b445142b247ee4cfa66155398bb2/b5ef6/soohwan.webp 1148w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.6829268292682927}}}}]},"fields":{"readingTime":{"text":"16 min read"},"layout":"","slug":"/2025/"}},"primaryTag":"nlp"}},
    "staticQueryHashes": ["3170763342","3229353822"]}