<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>예비 대학원생의 논문 리뷰 뽀개기</title>
    <link>https://allaboutdeeplearning.tistory.com/</link>
    <description>서울대 경제학과 22학번 이지원의 블로그 입니다.</description>
    <language>ko</language>
    <pubDate>Wed, 15 Apr 2026 08:38:20 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>서울대 경제학부 22학번 이지원</managingEditor>
    <image>
      <title>예비 대학원생의 논문 리뷰 뽀개기</title>
      <url>https://tistory1.daumcdn.net/tistory/8323550/attach/d8c8389bdb914557bb8ce1a495a479c0</url>
      <link>https://allaboutdeeplearning.tistory.com</link>
    </image>
    <item>
      <title>[REVIEW] STABLE VIDEO INFINITY: INFINITE-LENGTH VIDEO GENERATION WITH ERROR RECYCLING</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/REVIEW-STABLE-VIDEO-INFINITY-INFINITE-LENGTH-VIDEO-GENERATION-WITH-ERROR-RECYCLING</link>
      <description>ICLR 2026 oral
&lt;h1 id=&quot;해결하려는-문제&quot;&gt;1) 해결하려는 문제&lt;/h1&gt;
&lt;p&gt;핵심 문제는 &lt;strong&gt;long video generation에서의 error accumulation(드리프트)&lt;/strong&gt;이다.&lt;/p&gt;
&lt;p&gt;기존 diffusion 기반 video 생성은 autoregressive 구조를 사용하며, 이전 프레임을 조건으로 다음 프레임을 생성한다. 이 과정에서:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;작은 예측 오차가 누적됨&lt;/li&gt;
&lt;li&gt;시간이 지날수록 영상 품질, motion consistency, semantic control이 붕괴됨&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;또한 더 근본적인 문제는 다음과 같다:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;training–test hypothesis gap&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;training: clean data 기반&lt;/li&gt;
&lt;li&gt;inference: self-generated noisy output 기반&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;이 불일치가 error accumulation을 가속한다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;선행연구&quot;&gt;2) 선행연구&lt;/h1&gt;
&lt;p&gt;기존 접근의 주요 흐름은 다음과 같다:&lt;/p&gt;
&lt;h3 id=&quot;noise-scheduler-수정&quot;&gt;(1) noise / scheduler 수정&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;noise schedule 조정&lt;/li&gt;
&lt;li&gt;이전 프레임 의존도 감소&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;frame-anchoring&quot;&gt;(2) frame anchoring&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;clean reference frame을 anchor로 사용&lt;/li&gt;
&lt;li&gt;drift 억제&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;sampling-architecture-개선&quot;&gt;(3) sampling / architecture 개선&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;masked-noise guidance&lt;/li&gt;
&lt;li&gt;anti-drifting sampling&lt;/li&gt;
&lt;li&gt;bidirectional distillation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;공통 한계는 다음과 같다:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;error를 완화하는 수준&lt;/li&gt;
&lt;li&gt;근본적인 correction 없음&lt;/li&gt;
&lt;li&gt;길이 제한 존재 (수십 초 수준)&lt;/li&gt;
&lt;li&gt;single prompt 기반 반복적·동질적 영상 생성&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;이-논문의-핵심-기여&quot;&gt;3) 이 논문의 핵심 기여&lt;/h1&gt;
&lt;p&gt;핵심 아이디어는 다음과 같다:&lt;/p&gt;
&lt;h3 id=&quot;error-recycling-fine-tuning-erft&quot;&gt;Error-Recycling Fine-Tuning (ERFT)&lt;/h3&gt;
&lt;p&gt;모델이 생성한 error를 다시 학습 신호로 사용하여 &lt;strong&gt;자기 오류를 스스로 수정하도록 학습&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;구체적 기여는 다음과 같다:&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;infinite-length video generation 가능&lt;/li&gt;
&lt;li&gt;training–test gap을 명시적으로 분석하고 정식화&lt;/li&gt;
&lt;li&gt;self-generated error를 supervisory signal로 사용&lt;/li&gt;
&lt;li&gt;error를 저장하고 재사용하는 memory 구조 도입&lt;/li&gt;
&lt;li&gt;다양한 조건 (text, audio, skeleton)과 호환&lt;/li&gt;
&lt;/ol&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;연구-방법&quot;&gt;4) 연구 방법&lt;/h1&gt;
&lt;h2 id=&quot;핵심-개념-두-종류의-에러&quot;&gt;4.1 핵심 개념: 두 종류의 에러&lt;/h2&gt;
&lt;h3 id=&quot;predictive-error&quot;&gt;(1) Predictive Error&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;autoregressive sampling에서 발생&lt;/li&gt;
&lt;li&gt;step-by-step integration 과정에서 누적&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conditional-error&quot;&gt;(2) Conditional Error&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;이전 생성 결과가 다음 입력으로 들어가면서 발생&lt;/li&gt;
&lt;li&gt;training distribution 밖 데이터 발생&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;두 에러는 상호 증폭 구조를 형성한다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;전체-방법-개요&quot;&gt;4.2 전체 방법 개요&lt;/h2&gt;
&lt;p&gt;SVI는 다음 3단계 구조로 구성된다:&lt;/p&gt;
&lt;h3 id=&quot;a-error-injection&quot;&gt;(A) Error Injection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;clean input에 과거 error를 인위적으로 주입&lt;/li&gt;
&lt;li&gt;inference 상황을 training에 시뮬레이션&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\tilde{X} = X + E\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;video latent, noise, image 각각에 error 주입&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;b-error-calculation-bidirectional&quot;&gt;(B) Error Calculation (Bidirectional)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;one-step integration으로 예측값 근사&lt;/li&gt;
&lt;li&gt;forward / backward integration 사용&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(E_{vid} = \hat{X}_{vid} - X_{vid}\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;residual 기반 error 계산&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;c-error-replay-memory&quot;&gt;(C) Error Replay Memory&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;timestep별 error 저장&lt;/li&gt;
&lt;li&gt;training 시 재샘플링&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;구조:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\((B_{vid}, B_{noi})\)&lt;/span&gt;: error bank&lt;/li&gt;
&lt;li&gt;timestep alignment 기반 indexing&lt;/li&gt;
&lt;li&gt;diversity 유지 위해 L2 distance 기반 교체&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;학습-목표&quot;&gt;4.3 학습 목표&lt;/h2&gt;
&lt;p&gt;모델은 다음을 예측:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V^{rcy}_t = X_{vid} - \tilde{X}_{noi}\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;의미:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;error가 포함된 입력에서도&lt;/li&gt;
&lt;li&gt;항상 clean latent 방향으로 이동하도록 학습&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;loss:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathcal{L}_{SVI} = \| u(\tilde{X}_t) - V^{rcy}_t \|^2\)&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;핵심-설계-포인트&quot;&gt;4.4 핵심 설계 포인트&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;error를 external noise가 아닌 self-generated signal로 사용&lt;/li&gt;
&lt;li&gt;closed-loop 구조&lt;/li&gt;
&lt;li&gt;inference cost 증가 없음&lt;/li&gt;
&lt;li&gt;LoRA 기반 경량 fine-tuning&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;실험-결과&quot;&gt;5) 실험 결과&lt;/h1&gt;
&lt;h2 id=&quot;주요-결과&quot;&gt;5.1 주요 결과&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;기존 방법 대비 consistency, quality 모두 개선&lt;/li&gt;
&lt;li&gt;ultra-long (250초 이상)에서도 성능 유지&lt;/li&gt;
&lt;li&gt;scene transition 포함한 creative setting에서도 안정적&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;표 (page 7):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SVI는 대부분 metric에서 최고 성능&lt;/li&gt;
&lt;li&gt;기존 방법은 길이 증가 시 급격한 성능 저하&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;추가-결과&quot;&gt;5.2 추가 결과&lt;/h2&gt;
&lt;h3 id=&quot;multimodal-generation&quot;&gt;(1) multimodal generation&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;audio-conditioned talking&lt;/li&gt;
&lt;li&gt;skeleton-conditioned dancing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;→ 모두 SOTA 성능&lt;/p&gt;
&lt;h3 id=&quot;ablation&quot;&gt;(2) ablation&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Eimg (reference image error)가 가장 중요한 요소&lt;/li&gt;
&lt;li&gt;error bank 크기 증가 시 성능 향상 후 포화&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;stability&quot;&gt;(3) stability&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;영상 길이에 따른 성능 감소 거의 없음&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;한계&quot;&gt;6) 한계&lt;/h1&gt;
&lt;p&gt;논문에서 명시한 한계는 다음과 같다:&lt;/p&gt;
&lt;h3 id=&quot;스타일-mismatch&quot;&gt;(1) 스타일 mismatch&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;training distribution과 다른 스타일에서 color shift 발생&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;real-time-생성-어려움&quot;&gt;(2) real-time 생성 어려움&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;현재 구조는 streaming 아님&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;identity-consistency&quot;&gt;(3) identity consistency&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;장면 전환 시 인물 identity drift 가능&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;데이터-규모-제한&quot;&gt;(4) 데이터 규모 제한&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;소규모 데이터로 학습&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;핵심-요약&quot;&gt;핵심 요약&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;문제: long video에서 error accumulation과 training-test mismatch&lt;/li&gt;
&lt;li&gt;방법: self-generated error를 학습에 재사용하는 error recycling&lt;/li&gt;
&lt;li&gt;결과: infinite-length video generation 가능, drift 억제&lt;/li&gt;
&lt;li&gt;핵심 insight: 모델이 만든 오류를 학습 데이터로 사용하는 closed-loop 학습&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>딥러닝 논문/VLM(비전 랭귀지 모델) 딥러닝 논문</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/62</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/REVIEW-STABLE-VIDEO-INFINITY-INFINITE-LENGTH-VIDEO-GENERATION-WITH-ERROR-RECYCLING#entry62comment</comments>
      <pubDate>Mon, 6 Apr 2026 21:01:08 +0900</pubDate>
    </item>
    <item>
      <title>[REVIEW] FLASHVID: EFFICIENT VIDEO LARGE LANGUAGE MODELS VIA TRAINING-FREE TREE-BASED SPATIOTEMPORAL TOKEN MERGING</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/REVIEW-FLASHVID-EFFICIENT-VIDEO-LARGE-LANGUAGE-MODELS-VIA-TRAINING-FREE-TREE-BASED-SPATIOTEMPORAL-TOKEN-MERGING</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;ICLR 2026 Oral&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 &lt;b&gt;Video Large Language Model(VLLM)&lt;/b&gt; 에서 비디오 토큰 수가 너무 많아 생기는 &lt;b&gt;추론 비효율&lt;/b&gt; 문제를 다룬다. 핵심은 &lt;b&gt;학습 없이(training-free)&lt;/b&gt;, 그리고 &lt;b&gt;plug-and-play&lt;/b&gt; 방식으로 비디오 토큰을 줄이되 중요한 시공간 정보를 최대한 유지하는 것이다. 논문은 이를 위해 &lt;b&gt;FlashVID&lt;/b&gt;라는 방법을 제안한다.&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1032&quot; data-origin-height=&quot;708&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sgI3j/dJMcaibO4AU/Z0nuikOnF9JnHUPbyiKkp0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sgI3j/dJMcaibO4AU/Z0nuikOnF9JnHUPbyiKkp0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sgI3j/dJMcaibO4AU/Z0nuikOnF9JnHUPbyiKkp0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FsgI3j%2FdJMcaibO4AU%2FZ0nuikOnF9JnHUPbyiKkp0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1032&quot; height=&quot;708&quot; data-origin-width=&quot;1032&quot; data-origin-height=&quot;708&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 id=&quot;어떤-문제를-해결하고-싶은가&quot; data-ke-size=&quot;size23&quot;&gt;1) 어떤 문제를 해결하고 싶은가&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;VLLM은 비디오를 이해할 때 프레임마다 매우 많은 visual token을 처리한다. 토큰 수가 많아지면 attention cost가 시퀀스 길이에 대해 크게 증가하고, 메모리와 연산량 부담도 커진다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;직관적으로 보면, 비디오는 같은 정보가 여러 프레임에 반복해서 등장한다. 한 프레임 안에서도 비슷한 패치가 많고, 프레임 사이에도 유사한 내용이 이어진다. 그래서 &amp;ldquo;중복된 토큰을 잘 압축하면&amp;rdquo; 계산량을 줄일 수 있다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;문제는 &lt;b&gt;비디오의 redundancy가 단순하지 않다&lt;/b&gt;는 점이다. 어떤 객체는 시간이 지나면서 위치가 바뀌고, 크기가 달라지고, 방향도 달라진다. 그래서 같은 의미를 가진 정보가 항상 같은 spatial 위치에 머무르지 않는다. 논문은 기존 방식이 이 동적인 특성을 충분히 반영하지 못한다고 본다.&lt;/p&gt;
&lt;h3 id=&quot;선행연구는-어땠는가&quot; data-ke-size=&quot;size23&quot;&gt;2) 선행연구는 어땠는가&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;논문은 기존 효율화 방법을 크게 세 가지로 정리한다. &lt;b&gt;Before-LLM compression&lt;/b&gt;, &lt;b&gt;Inner-LLM pruning&lt;/b&gt;, &lt;b&gt;Hybrid compression&lt;/b&gt;이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;기존 연구의 주요 흐름은 다음과 같다.&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;이미지 VLM/LMM 쪽에서는 token pruning, token merging, attention 기반 중요 토큰 선택 같은 방법이 활발했다.&lt;/li&gt;
&lt;li&gt;비디오 쪽에서는 frame partition, salient token selection, temporal/spatial compression을 조합한 방법들이 제안되었다.&lt;/li&gt;
&lt;li&gt;다만 논문은 많은 방법이 &lt;b&gt;spatial redundancy&lt;/b&gt; 와 &lt;b&gt;temporal redundancy&lt;/b&gt; 를 따로 처리한다고 설명한다. temporal redundancy도 종종 &amp;ldquo;인접 프레임의 같은 spatial 위치&amp;rdquo;를 중심으로 정의한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;직관적으로 말하면, 기존 방식은 &amp;ldquo;같은 자리에 계속 있는 정보&amp;rdquo;를 줄이는 데는 잘 맞을 수 있다. 하지만 비디오는 객체가 움직인다. 따라서 실제로는 &lt;b&gt;의미상 같은 것&lt;/b&gt;이 프레임마다 다른 위치에 나타난다. 이 부분이 논문이 겨냥한 핵심 한계다.&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;933&quot; data-origin-height=&quot;513&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/OlnWV/dJMcabcEph9/8DkbKcM0BX2JPsSwAzp6EK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/OlnWV/dJMcabcEph9/8DkbKcM0BX2JPsSwAzp6EK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/OlnWV/dJMcabcEph9/8DkbKcM0BX2JPsSwAzp6EK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FOlnWV%2FdJMcabcEph9%2F8DkbKcM0BX2JPsSwAzp6EK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;933&quot; height=&quot;513&quot; data-origin-width=&quot;933&quot; data-origin-height=&quot;513&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 id=&quot;이-논문에서-하는-새로운-기여는-무엇인가&quot; data-ke-size=&quot;size23&quot;&gt;3) 이 논문에서 하는 새로운 기여는 무엇인가&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;논문이 제시하는 핵심 기여는 세 가지다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;첫째, 기존 token compression이 &lt;b&gt;비디오의 동적이고 evolving한 특성&lt;/b&gt;을 충분히 모델링하지 못한다는 문제를 명시적으로 짚는다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;둘째, &lt;b&gt;FlashVID&lt;/b&gt;를 제안한다. FlashVID는 두 모듈로 구성된다.&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;ADTS (Attention and Diversity-based Token Selection)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TSTM (Tree-based Spatiotemporal Token Merging)&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 둘을 결합해 시공간 redundancy를 줄인다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;셋째, 학습 없이도 여러 VLLM과 여러 benchmark에서 잘 작동하고, 긴 비디오를 더 많이 넣을 수 있게 해 준다는 실험 결과를 제시한다. 특히 &lt;b&gt;LLaVA-OneVision에서 visual token의 10%만 남겨도 원본 성능의 99.1%를 유지&lt;/b&gt;했고, &lt;b&gt;Qwen2.5-VL에서는 같은 계산 예산 안에서 10배 많은 frame을 처리해 상대 성능 8.6% 향상&lt;/b&gt;을 보고했다.&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;936&quot; data-origin-height=&quot;590&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/0JZLP/dJMcadIhNih/MOZWvMG25hWYsMVMFvOG81/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/0JZLP/dJMcadIhNih/MOZWvMG25hWYsMVMFvOG81/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/0JZLP/dJMcadIhNih/MOZWvMG25hWYsMVMFvOG81/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F0JZLP%2FdJMcadIhNih%2FMOZWvMG25hWYsMVMFvOG81%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;936&quot; height=&quot;590&quot; data-origin-width=&quot;936&quot; data-origin-height=&quot;590&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 id=&quot;연구-방법은-무엇인가&quot; data-ke-size=&quot;size23&quot;&gt;4) 연구 방법은 무엇인가&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;논문의 방법은 &lt;b&gt;2-stage compression&lt;/b&gt; 으로 이해하면 된다.&lt;/p&gt;
&lt;h4 id=&quot;전체-아이디어&quot; data-ke-size=&quot;size20&quot;&gt;4-1. 전체 아이디어&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;FlashVID는 먼저 &lt;b&gt;대표성이 높고 다양한 토큰&lt;/b&gt;을 골라낸다. 그 다음 남은 redundancy를 &lt;b&gt;시공간적으로 함께 묶어서 병합&lt;/b&gt;한다. 이 흐름은 다음과 같다.&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;&lt;b&gt;ADTS&lt;/b&gt;가 informative token을 고른다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TSTM&lt;/b&gt;이 남은 토큰들을 tree 구조로 묶어 merge한다.&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;직관적으로 보면, ADTS는 &amp;ldquo;이 장면을 이해하는 데 꼭 필요한 토큰을 먼저 남기는 단계&amp;rdquo;이고, TSTM은 &amp;ldquo;비슷한 것끼리 엮어서 덩치를 줄이는 단계&amp;rdquo;다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;926&quot; data-origin-height=&quot;496&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/6LKyT/dJMcai3SFOj/RGKNHVMAh7iIP3KqXxW2Ek/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/6LKyT/dJMcai3SFOj/RGKNHVMAh7iIP3KqXxW2Ek/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/6LKyT/dJMcai3SFOj/RGKNHVMAh7iIP3KqXxW2Ek/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6LKyT%2FdJMcai3SFOj%2FRGKNHVMAh7iIP3KqXxW2Ek%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;926&quot; height=&quot;496&quot; data-origin-width=&quot;926&quot; data-origin-height=&quot;496&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h4 id=&quot;tstm-tree-based-spatiotemporal-token-merging&quot; data-ke-size=&quot;size20&quot;&gt;4-2. TSTM: Tree-based Spatiotemporal Token Merging&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문의 가장 핵심적인 아이디어다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;기본 입력은 비디오 feature &lt;span class=&quot;math inline&quot;&gt;\(E_v \in \mathbb{R}^{F \times N_v \times d}\)&lt;/span&gt; 이다. 각 프레임의 각 토큰에 대해 &lt;b&gt;인접 프레임 간 cosine similarity matrix&lt;/b&gt; 를 계산한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;논문 식은 다음 형태다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(S^{(f)} = \cos(E_v^{(f)}, E_v^{(f+1)}) \in \mathbb{R}^{N_v \times N_v}\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;여기서 &lt;span class=&quot;math inline&quot;&gt;\(S^{(f)}(j,k)\)&lt;/span&gt; 는 frame &lt;span class=&quot;math inline&quot;&gt;\(f\)&lt;/span&gt; 의 &lt;span class=&quot;math inline&quot;&gt;\(j\)&lt;/span&gt;번째 토큰과 frame &lt;span class=&quot;math inline&quot;&gt;\(f+1\)&lt;/span&gt; 의 &lt;span class=&quot;math inline&quot;&gt;\(k\)&lt;/span&gt;번째 토큰 사이 유사도다. 각 토큰은 이전 프레임에서 &lt;b&gt;가장 유사한 토큰&lt;/b&gt;과 연결되고, 유사도가 threshold &lt;span class=&quot;math inline&quot;&gt;\(T_\tau\)&lt;/span&gt; 이상일 때만 merge 후보가 된다. 이렇게 해서 &lt;b&gt;spatiotemporal redundancy tree&lt;/b&gt; 가 만들어진다. 이후 각 tree 안의 토큰들을 aggregation 하여 compact representation을 만든다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;직관적으로 보면 이 tree는 &amp;ldquo;시간을 따라 같은 의미를 가진 조각들을 이어 붙인 묶음&amp;rdquo;이다. 기존 방식처럼 고정된 위치만 대응시키는 게 아니다. 그래서 객체가 움직여도 같은 semantic content를 따라갈 수 있다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h4 id=&quot;adts-attention-and-diversity-based-token-selection&quot; data-ke-size=&quot;size20&quot;&gt;4-3. ADTS: Attention and Diversity-based Token Selection&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;TSTM만 바로 적용하면 noisy한 토큰이나 덜 중요한 토큰까지 많이 섞일 수 있다. 그래서 논문은 먼저 &lt;b&gt;어떤 토큰을 남길지 선택&lt;/b&gt;하는 ADTS를 둔다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;ADTS는 frame-wise token selection을 &lt;b&gt;Max-Min Diversity Problem(MMDP)&lt;/b&gt; 로 본다. 기본적으로는 같은 프레임 내 토큰들 사이의 cosine distance를 사용한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(D^{(f)} = 1 - \cos(E_v^{(f)}, E_v^{(f)})\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 formulation은 &lt;b&gt;서로 다른 특징을 가진 토큰들&lt;/b&gt;을 고르도록 유도한다. 하지만 diversity만으로는 정말 중요한 토큰을 놓칠 수 있다. 그래서 논문은 두 가지 calibration term을 추가한다.&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;[CLS] attention calibration&lt;/b&gt; vision encoder의 attention을 활용해 frame 안에서 informative한 토큰을 강조한다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;event relevance calibration&lt;/b&gt; 토큰이 현재 비디오 이벤트와 얼마나 관련 있는지 반영한다. frame embedding을 global average pooling으로 만들고, 토큰-이벤트 유사도를 계산한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;결과적으로 ADTS는 &amp;ldquo;중요하고도 서로 겹치지 않는 토큰 집합&amp;rdquo;을 선택한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;직관적으로는, 장면을 요약할 때 같은 종류의 패치만 잔뜩 남기는 걸 피하고, 의미 있는 부분을 넓게 덮도록 만드는 장치다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h4 id=&quot;hybrid-compression과-token-budget-alignment&quot; data-ke-size=&quot;size20&quot;&gt;4-4. Hybrid compression과 token budget alignment&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;논문은 pure before-LLM compression만 쓰지 않고, &lt;b&gt;Hybrid compression&lt;/b&gt; 구조를 사용한다. 일부 토큰은 LLM 앞에서 줄이고, 이후 LLM 안에서도 pruning을 한다. 이렇게 하면 중요한 visual information을 더 많이 보존하면서 전체 계산 예산을 맞출 수 있다고 설명한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;구현상 pruning layer는 &lt;span class=&quot;math inline&quot;&gt;\(K=20\)&lt;/span&gt;, expansion factor는 &lt;span class=&quot;math inline&quot;&gt;\(f_e=1.25\)&lt;/span&gt; 를 사용한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;또 비교의 공정성을 위해 average token budget per transformer layer를 맞추는 &lt;b&gt;token budget alignment&lt;/b&gt; 도 설계했다. 이 부분은 실험 비교가 같은 연산 조건에서 이루어지게 하는 장치다.&lt;/p&gt;
&lt;h3 id=&quot;실험-결과는-무엇을-보여주는가&quot; data-ke-size=&quot;size23&quot;&gt;5) 실험 결과는 무엇을 보여주는가&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;실험은 &lt;b&gt;VideoMME, EgoSchema, LongVideoBench, MVBench, MLVU&lt;/b&gt; 의 5개 benchmark와, &lt;b&gt;LLaVA-OneVision, LLaVA-Video, Qwen2.5-VL&lt;/b&gt; 의 3개 대표 모델에서 수행되었다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;핵심 결과는 다음과 같다.&lt;/p&gt;
&lt;h4 id=&quot;llava-onevision&quot; data-ke-size=&quot;size20&quot;&gt;LLaVA-OneVision&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;FlashVID는 여러 retention ratio에서 가장 높은 평균 점수를 기록했다. 특히 &lt;b&gt;10% retention에서 relative accuracy 99.1%&lt;/b&gt; 를 유지했다. 일부 구간에서는 full token input보다 평균 점수가 더 높게 나오는 현상도 보고한다.&lt;/p&gt;
&lt;h4 id=&quot;llava-video&quot; data-ke-size=&quot;size20&quot;&gt;LLaVA-Video&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;retention ratio 변화에 따라 안정적인 성능을 보였다.&lt;/p&gt;
&lt;h4 id=&quot;qwen2.5-vl&quot; data-ke-size=&quot;size20&quot;&gt;Qwen2.5-VL&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;20%, 10% retention 모두에서 가장 높은 평균 score를 기록했다.&lt;/p&gt;
&lt;h4 id=&quot;fixed-token-budget에서-더-긴-비디오-처리&quot; data-ke-size=&quot;size20&quot;&gt;Fixed token budget에서 더 긴 비디오 처리&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;기본 Qwen2.5-VL은 16 frame을 처리한다. FlashVID를 쓰면 같은 memory/compute budget 안에서 &lt;b&gt;160 frame&lt;/b&gt;, 즉 &lt;b&gt;10배 frame&lt;/b&gt; 을 처리할 수 있고, 평균 성능이 &lt;b&gt;52.6 &amp;rarr; 57.1&lt;/b&gt;, relative accuracy 기준 &lt;b&gt;108.6%&lt;/b&gt; 까지 올라간다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;직관적으로 보면, FlashVID는 &amp;ldquo;같은 연산 예산으로 더 긴 시간을 본다&amp;rdquo;는 효과를 만든다. 비디오 이해에서는 짧은 clip만 보는 것보다 긴 temporal context를 보는 것이 중요한 경우가 많다.&lt;/p&gt;
&lt;h4 id=&quot;효율성&quot; data-ke-size=&quot;size20&quot;&gt;효율성&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;prefilling: 최대 6.3&amp;times; speedup&lt;/li&gt;
&lt;li&gt;TTFT: 약 2&amp;times; speedup&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;ablation은-무엇을-말해주는가&quot; data-ke-size=&quot;size23&quot;&gt;6) Ablation은 무엇을 말해주는가&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;ADTS는 attention-only, diversity-only보다 성능이 높다.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\alpha=0.7\)&lt;/span&gt; 에서 최고 성능&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(T_\tau = 0.8\)&lt;/span&gt; 이 좋은 설정&lt;/li&gt;
&lt;li&gt;tree depth/breadth constraint는 성능 영향 거의 없음&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;한계는-무엇인가&quot; data-ke-size=&quot;size23&quot;&gt;7) 한계는 무엇인가&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;semantic confusion: 서로 다른 entity가 merge될 가능성 존재&lt;/li&gt;
&lt;li&gt;hyperparameter 민감성: threshold, pruning 설정 영향&lt;/li&gt;
&lt;li&gt;training-free 구조: task-specific adaptation 없음&lt;/li&gt;
&lt;li&gt;평가 범위:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;video understanding 중심&lt;/li&gt;
&lt;li&gt;다른 multimodal task 검증 부&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>딥러닝 논문/VLM(비전 랭귀지 모델) 딥러닝 논문</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/61</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/REVIEW-FLASHVID-EFFICIENT-VIDEO-LARGE-LANGUAGE-MODELS-VIA-TRAINING-FREE-TREE-BASED-SPATIOTEMPORAL-TOKEN-MERGING#entry61comment</comments>
      <pubDate>Mon, 6 Apr 2026 16:39:20 +0900</pubDate>
    </item>
    <item>
      <title>강화학습 내용 정리 (Lecture 6~7)</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/%EA%B0%95%ED%99%94%ED%95%99%EC%8A%B5-%EB%82%B4%EC%9A%A9-%EC%A0%95%EB%A6%AC-Lecture-67</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1 id=&quot;lecture-6&quot;&gt;&lt;mark style=&quot;background: #FF9B9B;&quot;&gt;LECTURE 6&lt;/mark&gt;&lt;/h1&gt;
&lt;h2 id=&quot;monte-carlo-methods&quot; data-ke-size=&quot;size26&quot;&gt;Monte Carlo Methods&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;Monte Carlo, MC&lt;/b&gt;는 환경의 &lt;b&gt;complete model&lt;/b&gt;을 모를 때도 &lt;b&gt;sample experience&lt;/b&gt;만으로 value를 학습하는 방법이다.&lt;/li&gt;
&lt;li&gt;여기서 경험은 episode에서 얻은 sample sequence, 즉 &lt;span class=&quot;math inline&quot;&gt;\((s,a,r,s')\)&lt;/span&gt;의 연속이다.&lt;/li&gt;
&lt;li&gt;이 방법은 &lt;b&gt;episodic&lt;/b&gt;, &lt;b&gt;undiscounted&lt;/b&gt; setting에서 소개되며, update는 &lt;b&gt;episode-by-episode&lt;/b&gt;로 일어난다.&lt;/li&gt;
&lt;li&gt;핵심 아이디어는 각 &lt;b&gt;state&lt;/b&gt; 또는 &lt;b&gt;state-action pair&lt;/b&gt;에 대해 관측된 &lt;b&gt;return&lt;/b&gt;들을 모아서 평균내는 것이다.&lt;/li&gt;
&lt;li&gt;관점상으로는 week 1의 &lt;b&gt;bandit methods&lt;/b&gt;와 비슷하게, sample을 모아 평균으로 value를 추정한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;dynamic-programming과의-차이&quot; data-ke-size=&quot;size26&quot;&gt;Dynamic Programming과의 차이&lt;/h2&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;&lt;colgroup&gt; &lt;col style=&quot;width: 15%;&quot; /&gt; &lt;col style=&quot;width: 44%;&quot; /&gt; &lt;col style=&quot;width: 39%;&quot; /&gt; &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;구분&lt;/th&gt;
&lt;th&gt;Dynamic Programming (DP)&lt;/th&gt;
&lt;th&gt;Monte Carlo (MC)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Model 가정&lt;/td&gt;
&lt;td&gt;MDP dynamics &lt;span class=&quot;math inline&quot;&gt;\(p(s',r, \|s,a)\)&lt;/span&gt;를 알고 있다고 가정한다&lt;/td&gt;
&lt;td&gt;환경의 full model이 필요 없다&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;학습 방식&lt;/td&gt;
&lt;td&gt;model이 있으므로 실제 경험 없이도 update할 수 있다&lt;/td&gt;
&lt;td&gt;실제 경험 또는 simulated experience로 학습한다&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;데이터 필요 여부&lt;/td&gt;
&lt;td&gt;environment interaction 없이 계산 가능&lt;/td&gt;
&lt;td&gt;반드시 episode 경험이 필요하다&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;계산 구조&lt;/td&gt;
&lt;td&gt;state transition model을 이용한 Bellman backup 수행&lt;/td&gt;
&lt;td&gt;episode에서 얻은 return을 평균내어 value 추정&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;계산 비용 특성&lt;/td&gt;
&lt;td&gt;state space 전체 sweep이 필요하다&lt;/td&gt;
&lt;td&gt;state 개수에 직접적으로 묶이지 않는다&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bootstrapping 여부&lt;/td&gt;
&lt;td&gt;bootstrapping 사용 (다음 state의 현재 추정값 사용)&lt;/td&gt;
&lt;td&gt;bootstrapping을 사용하지 않는다&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Value 업데이트&lt;/td&gt;
&lt;td&gt;다음 state의 추정값 &lt;span class=&quot;math inline&quot;&gt;\(V(s')\)&lt;/span&gt;을 이용해 update&lt;/td&gt;
&lt;td&gt;episode 종료 후 실제 return &lt;span class=&quot;math inline&quot;&gt;\(G_t\)&lt;/span&gt;를 이용해 update&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&quot;bootstrap과-roll-out&quot; data-ke-size=&quot;size23&quot;&gt;Bootstrap과 Roll-out&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;DP의 Bellman backup은 현재 추정값을 다시 이용하는 &lt;b&gt;bootstrap&lt;/b&gt; 방식이다.&lt;/li&gt;
&lt;li&gt;MC는 terminal까지 실제 trajectory를 따라가서 return을 계산하는 &lt;b&gt;roll-out&lt;/b&gt; 방식이다.&lt;/li&gt;
&lt;li&gt;슬라이드의 그림은 왼쪽에 DP의 one-step backup, 오른쪽에 MC의 full roll-out을 대비시킨다. 그림은 DP가 중간 추정치를 이용하는 구조이고, MC는 끝까지 진행한 뒤 전체 return을 쓰는 구조를 시각적으로 보여준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;645&quot; data-origin-height=&quot;410&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/oZUfB/dJMcaflIy6h/sbEbH89DdobFkI21OyeVB1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/oZUfB/dJMcaflIy6h/sbEbH89DdobFkI21OyeVB1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/oZUfB/dJMcaflIy6h/sbEbH89DdobFkI21OyeVB1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FoZUfB%2FdJMcaflIy6h%2FsbEbH89DdobFkI21OyeVB1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;645&quot; height=&quot;410&quot; data-origin-width=&quot;645&quot; data-origin-height=&quot;410&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;monte-carlo-prediction&quot; data-ke-size=&quot;size26&quot;&gt;Monte Carlo Prediction&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;목표는 주어진 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;에 대한 &lt;b&gt;state-value function&lt;/b&gt; &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;를 추정하는 것이다.&lt;/li&gt;
&lt;li&gt;즉 &lt;b&gt;policy evaluation&lt;/b&gt; 문제다.&lt;/li&gt;
&lt;li&gt;방법은 간단하다. 어떤 state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;를 방문한 뒤 얻은 return들을 모아 평균내서 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;를 추정한다.&lt;/li&gt;
&lt;li&gt;return은 보통 &lt;span class=&quot;math inline&quot;&gt;\(G_t = R_{t+1} + R_{t+2} + \cdots + R_T\)&lt;/span&gt; 처럼 episode 종료까지의 누적 보상이다.&lt;/li&gt;
&lt;li&gt;MC prediction은 Bellman equation을 직접 푸는 것이 아니라, 실제로 관측된 &lt;span class=&quot;math inline&quot;&gt;\(G_t\)&lt;/span&gt;를 평균내어 value를 추정한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;first-visit-mc&quot; data-ke-size=&quot;size23&quot;&gt;First-visit MC&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;first-visit MC&lt;/b&gt;는 한 episode 안에서 state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;가 여러 번 나타나더라도, &lt;b&gt;처음 방문한 시점의 return&lt;/b&gt;만 사용한다.&lt;/li&gt;
&lt;li&gt;따라서 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;는 &amp;ldquo;각 episode의 first visit 이후 관측된 return들의 평균&amp;rdquo;으로 추정된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;744&quot; data-origin-height=&quot;341&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bKatqB/dJMcagx8jmp/xl1Fhjwx9qV9Dae6a8uzw0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bKatqB/dJMcagx8jmp/xl1Fhjwx9qV9Dae6a8uzw0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bKatqB/dJMcagx8jmp/xl1Fhjwx9qV9Dae6a8uzw0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbKatqB%2FdJMcagx8jmp%2Fxl1Fhjwx9qV9Dae6a8uzw0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;744&quot; height=&quot;341&quot; data-origin-width=&quot;744&quot; data-origin-height=&quot;341&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;입력: 평가하려는 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;초기화:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;각 &lt;span class=&quot;math inline&quot;&gt;\(s \in \mathcal{S}\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(V(s)\)&lt;/span&gt;를 임의로 초기화&lt;/li&gt;
&lt;li&gt;각 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에 대해 &lt;code&gt;Returns(s)&lt;/code&gt;를 빈 리스트로 초기화&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;각 episode마다:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 따라 하나의 episode를 생성한다 &lt;span class=&quot;math inline&quot;&gt;\(S_0, A_0, R_1, S_1, A_1, R_2, \dots, S_{T-1}, A_{T-1}, R_T\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;뒤에서부터 return을 계산한다 &lt;span class=&quot;math inline&quot;&gt;\(G \leftarrow 0\)&lt;/span&gt;에서 시작해서 &lt;span class=&quot;math inline&quot;&gt;\(G \leftarrow \gamma G + R_{t+1}\)&lt;/span&gt; 또는 이 강의가 undiscounted episodic 설정이면 사실상 terminal까지의 누적합을 만든다&lt;/li&gt;
&lt;li&gt;만약 &lt;span class=&quot;math inline&quot;&gt;\(S_t\)&lt;/span&gt;가 이 episode에서 처음 등장한 방문이라면:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(G\)&lt;/span&gt;를 &lt;code&gt;Returns(S_t)&lt;/code&gt;에 append&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(S_t) \leftarrow \text{average}(\text{Returns}(S_t))\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;first-visit-mc와-every-visit-mc&quot; data-ke-size=&quot;size23&quot;&gt;First-visit MC와 Every-visit MC&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;first-visit MC는 각 episode에서 어떤 state를 처음 방문했을 때의 return만 쓰고, every-visit MC는 그 episode에서 그 state를 방문한 모든 시점의 return을 전부 쓴다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;every-visit MC&lt;/b&gt;는 first visit만 쓰지 않고, 어떤 episode 안에서 state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;가 나타난 &lt;b&gt;모든 방문&lt;/b&gt; 이후의 return을 평균낸다.&lt;/li&gt;
&lt;li&gt;두 방법 모두 방문 횟수가 무한히 커지면 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;로 수렴한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;예시) &lt;span class=&quot;math inline&quot;&gt;\(A \rightarrow B \rightarrow A \rightarrow T\)&lt;/span&gt; 각 step의 reward가 순서대로 &lt;span class=&quot;math inline&quot;&gt;\(1, 2, 3\)&lt;/span&gt;이고, terminal state는 &lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;라고 하자. 그러면 각 시점의 return은 다음과 같다.&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;첫 번째 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;에서의 return: &lt;span class=&quot;math inline&quot;&gt;\(1+2+3=6\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(B\)&lt;/span&gt;에서의 return: &lt;span class=&quot;math inline&quot;&gt;\(2+3=5\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;두 번째 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;에서의 return: &lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이때 상태 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;의 value를 업데이트할 때&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;first-visit MC는 &lt;b&gt;처음 방문한 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;의 return 6만 사용&lt;/b&gt;한다.&lt;/li&gt;
&lt;li&gt;every-visit MC는 &lt;b&gt;처음 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;의 return 6과 두 번째 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;의 return 3을 둘 다 사용&lt;/b&gt;한다.&lt;/li&gt;
&lt;li&gt;first-visit MC는 각 return이 finite variance를 갖는 &lt;b&gt;i.i.d. estimate&lt;/b&gt;로 볼 수 있어서 &lt;b&gt;law of large numbers&lt;/b&gt;로 수렴 설명이 비교적 직접적이다.&lt;/li&gt;
&lt;li&gt;every-visit MC는 설명이 덜 직접적이지만, 이후 &lt;b&gt;function approximation&lt;/b&gt;이나 &lt;b&gt;eligibility traces&lt;/b&gt;로 더 자연스럽게 이어진다고 정리된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;action-value-prediction이-필요한-이유&quot; data-ke-size=&quot;size26&quot;&gt;Action Value Prediction이 필요한 이유&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;model이 알려진 경우에는 state-value &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;만 있어도 one-step lookahead로 policy를 정할 수 있다.&lt;/li&gt;
&lt;li&gt;하지만 model이 없으면 다음 state distribution과 immediate reward를 이용한 lookahead를 직접 할 수 없다.&lt;/li&gt;
&lt;li&gt;따라서 policy 개선에 value를 쓰려면 &lt;b&gt;각 action의 가치&lt;/b&gt;를 직접 추정해야 한다.&lt;/li&gt;
&lt;li&gt;그래서 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;가 아니라 &lt;b&gt;action-value&lt;/b&gt; &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt;를 추정해야 한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;mc-prediction-of-action-values&quot; data-ke-size=&quot;size23&quot;&gt;MC Prediction of Action Values&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt;는 다음을 의미한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 시작하고&lt;/li&gt;
&lt;li&gt;action &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;를 먼저 취한 뒤&lt;/li&gt;
&lt;li&gt;이후 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 따를 때의 기대 return&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MC에서는 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;를 방문한 뒤 실제로 관측된 return들을 평균내어 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt;를 추정한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;왜-exploration이-필요한가&quot; data-ke-size=&quot;size26&quot;&gt;왜 Exploration이 필요한가&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;MC로 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt;를 추정하려면 많은 &lt;b&gt;state-action pair&lt;/b&gt;가 실제로 방문되어야 한다.&lt;/li&gt;
&lt;li&gt;그런데 어떤 pair는 아예 방문되지 않을 수 있다.&lt;/li&gt;
&lt;li&gt;그러면 어떤 state에서 여러 action 중 무엇이 좋은지 비교할 수 없다.&lt;/li&gt;
&lt;li&gt;따라서 &lt;b&gt;exploration&lt;/b&gt;이 필요하다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;exploring-starts&quot; data-ke-size=&quot;size23&quot;&gt;Exploring Starts&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;한 가지 방법은 &lt;b&gt;exploring starts&lt;/b&gt;다.&lt;/li&gt;
&lt;li&gt;아이디어는 각 episode의 시작 state-action pair가 모든 pair에 대해 &lt;b&gt;nonzero probability&lt;/b&gt;를 갖도록 하는 것이다.&lt;/li&gt;
&lt;li&gt;이렇게 하면 충분히 많은 episode 후에는 모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;가 결국 샘플링될 수 있다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;stochastic-policy&quot; data-ke-size=&quot;size23&quot;&gt;Stochastic Policy&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;다른 방법은 policy 자체를 deterministic하게 두지 않고, 각 state에서 모든 action을 &lt;b&gt;nonzero probability&lt;/b&gt;로 선택하는 &lt;b&gt;stochastic policy&lt;/b&gt;를 사용하는 것이다.&lt;/li&gt;
&lt;li&gt;이 접근이 뒤에서 &lt;b&gt;soft policy&lt;/b&gt;, &lt;b&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy&lt;/b&gt;, &lt;b&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft policy&lt;/b&gt;로 이어진다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;monte-carlo-control&quot; data-ke-size=&quot;size26&quot;&gt;Monte Carlo Control&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;MC control은 구조적으로 &lt;b&gt;GPI, Generalized Policy Iteration&lt;/b&gt; 패턴을 따른다.&lt;/li&gt;
&lt;li&gt;즉
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;현재 policy를 평가해서 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt;를 추정하고&lt;/li&gt;
&lt;li&gt;그 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt;에 대해 policy를 개선한다&lt;/li&gt;
&lt;li&gt;이를 반복한다&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;흐름은 다음처럼 적을 수 있다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi_0 \xrightarrow{E} q_{\pi_0} \xrightarrow{I} \pi_1 \xrightarrow{E} q_{\pi_1} \xrightarrow{I} \pi_2 \xrightarrow{E} \cdots \xrightarrow{I} \pi^* \xrightarrow{E} q_{\pi^*}\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;여기서
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(E\)&lt;/span&gt;: policy evaluation&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(I\)&lt;/span&gt;: policy improvement&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;&lt;colgroup&gt; &lt;col style=&quot;width: 6%;&quot; /&gt; &lt;col style=&quot;width: 13%;&quot; /&gt; &lt;col style=&quot;width: 16%;&quot; /&gt; &lt;col style=&quot;width: 62%;&quot; /&gt; &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;항목&lt;/th&gt;
&lt;th&gt;DP 기반 control&lt;/th&gt;
&lt;th&gt;MC control&lt;/th&gt;
&lt;th&gt;왜 그런가&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Evaluation 방식&lt;/td&gt;
&lt;td&gt;&lt;b&gt;iterative update&lt;/b&gt;로 value를 반복적으로 갱신한다&lt;/td&gt;
&lt;td&gt;&lt;b&gt;episodic update&lt;/b&gt;로 episode가 끝난 뒤 return을 이용해 갱신한다&lt;/td&gt;
&lt;td&gt;DP는 model &lt;span class=&quot;math inline&quot;&gt;\(p(s',r\mid s,a)\)&lt;/span&gt;를 알고 있어서 Bellman equation을 바로 반복 적용할 수 있다. MC는 model 없이 sample episode만 쓰므로 terminal까지 진행한 뒤 관측된 return으로 value를 추정한다.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Evaluation에 쓰는 value&lt;/td&gt;
&lt;td&gt;보통 &lt;b&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;&lt;/b&gt;를 써도 된다&lt;/td&gt;
&lt;td&gt;&lt;b&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt;&lt;/b&gt;를 써야 한다&lt;/td&gt;
&lt;td&gt;DP는 model이 있으므로 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;만 알아도 one-step lookahead로 각 action의 가치를 계산할 수 있다. MC는 model이 없어서 &lt;span class=&quot;math inline&quot;&gt;\(\sum_{s',r}p(s',r\mid s,a)[r+\gamma v_\pi(s')]\)&lt;/span&gt; 같은 계산을 할 수 없으므로, 각 action의 가치를 직접 추정한 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt;가 필요하다.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Policy improvement 방식&lt;/td&gt;
&lt;td&gt;model과 value를 이용해 greedy improvement를 수행한다&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(s):=\arg\max_a q(s,a)\)&lt;/span&gt;로 greedy improvement를 수행한다&lt;/td&gt;
&lt;td&gt;MC에서는 action별 quality를 이미 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt; 형태로 추정하므로, 각 상태에서 가장 큰 &lt;span class=&quot;math inline&quot;&gt;\(q\)&lt;/span&gt;를 주는 action을 고르면 된다. model이 없기 때문에 DP처럼 transition model을 이용한 별도의 lookahead를 할 필요가 없다.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;정리&quot; data-ke-size=&quot;size26&quot;&gt;정리&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;MC control은 &lt;b&gt;episode가 끝난 뒤 return으로 평가&lt;/b&gt;한다.&lt;/li&gt;
&lt;li&gt;MC control은 &lt;b&gt;state-value &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;가 아니라 action-value &lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt;를 중심으로 돌아간다&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;MC control의 policy improvement는 &lt;b&gt;각 상태에서 &lt;span class=&quot;math inline&quot;&gt;\(q\)&lt;/span&gt;가 가장 큰 action을 고르는 방식&lt;/b&gt;으로 수행된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 MC control은 &lt;b&gt;model 없이 sample episode만으로 control을 해야 하므로&lt;/b&gt;, DP처럼 Bellman backup과 one-step lookahead를 쓰지 못하고, 대신 &lt;b&gt;episodic evaluation + &lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt; 기반 greedy improvement&lt;/b&gt; 구조를 사용한다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;policy-improvement-guarantee&quot; data-ke-size=&quot;size26&quot;&gt;Policy Improvement Guarantee&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;policy improvement는 현재 value function에 대해 greedy하게 policy를 바꾸는 것이다.&lt;/li&gt;
&lt;li&gt;즉 &lt;span class=&quot;math inline&quot;&gt;\(\pi_{k+1}(s) := \arg\max_a q_{\pi_k}(s,a)\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;그러면 policy improvement theorem을 적용할 수 있다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_{\pi_k}(s,\pi_{k+1}(s)) = q_{\pi_k}(s,\arg\max_a q_{\pi_k}(s,a)) = \max_a q_{\pi_k}(s,a) \ge q_{\pi_k}(s,\pi_k(s)) \ge v_{\pi_k}(s)\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;따라서 각 &lt;span class=&quot;math inline&quot;&gt;\(\pi_{k+1}\)&lt;/span&gt;은 &lt;span class=&quot;math inline&quot;&gt;\(\pi_k\)&lt;/span&gt;보다 더 좋거나 최소한 같아진다.&lt;/li&gt;
&lt;li&gt;결론적으로 MC는 environment dynamics를 모르고 episode samples만 있어도 optimal policy를 찾을 수 있다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;monte-carlo-with-exploring-starts&quot; data-ke-size=&quot;size26&quot;&gt;Monte Carlo with Exploring Starts&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;MC ES, Monte Carlo with Exploring Starts&lt;/b&gt;는 exploring starts 가정을 두고 optimal policy를 추정하는 알고리즘이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;883&quot; data-origin-height=&quot;503&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/wBYhv/dJMcacP3GeF/k9Y4TGtHCS2tjXWFOUfAnk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/wBYhv/dJMcacP3GeF/k9Y4TGtHCS2tjXWFOUfAnk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/wBYhv/dJMcacP3GeF/k9Y4TGtHCS2tjXWFOUfAnk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FwBYhv%2FdJMcacP3GeF%2Fk9Y4TGtHCS2tjXWFOUfAnk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;883&quot; height=&quot;503&quot; data-origin-width=&quot;883&quot; data-origin-height=&quot;503&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 id=&quot;초기화&quot; data-ke-size=&quot;size23&quot;&gt;초기화&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;모든 state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에 대해 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi(s)\)&lt;/span&gt;를 임의로 초기화&lt;/li&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(Q(s,a)\)&lt;/span&gt;를 임의로 초기화&lt;/li&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;에 대해 &lt;code&gt;Returns(s,a)&lt;/code&gt;를 빈 리스트로 초기화&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;반복&quot; data-ke-size=&quot;size23&quot;&gt;반복&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;각 episode마다 시작 pair &lt;span class=&quot;math inline&quot;&gt;\((S_0,A_0)\)&lt;/span&gt;를 모든 pair가 양의 확률을 갖도록 랜덤하게 선택한다&lt;/li&gt;
&lt;li&gt;이후 현재 policy를 따라 episode를 생성한다: &lt;span class=&quot;math inline&quot;&gt;\(S_0, A_0, R_1, \dots, S_{T-1}, A_{T-1}, R_T\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;뒤에서부터 return &lt;span class=&quot;math inline&quot;&gt;\(G\)&lt;/span&gt;를 계산한다&lt;/li&gt;
&lt;li&gt;만약 &lt;span class=&quot;math inline&quot;&gt;\((S_t,A_t)\)&lt;/span&gt;가 그 episode에서 처음 등장한 pair라면:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;code&gt;Returns(S_t,A_t)&lt;/code&gt;에 &lt;span class=&quot;math inline&quot;&gt;\(G\)&lt;/span&gt;를 append&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(Q(S_t,A_t) \leftarrow \text{average}(\text{Returns}(S_t,A_t))\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(S_t) \leftarrow \arg\max_a Q(S_t,a)\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;의미&quot; data-ke-size=&quot;size23&quot;&gt;의미&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;evaluation과 improvement가 episode 단위로 계속 섞여 돌아간다&lt;/li&gt;
&lt;li&gt;충분한 exploration이 보장되면 모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;의 value가 점차 정확해지고, greedy policy도 점차 좋아진다&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;exploring-starts-없이-하는-mc-control&quot; data-ke-size=&quot;size26&quot;&gt;Exploring Starts 없이 하는 MC Control&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;exploring starts는 실제로 구현하기 어렵거나 비현실적일 수 있다.&lt;/li&gt;
&lt;li&gt;그래서 이를 대신해 &lt;b&gt;soft policy&lt;/b&gt;를 사용한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;soft-policy&quot; data-ke-size=&quot;size23&quot;&gt;Soft Policy&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;soft policy는 모든 state와 모든 action에 대해 &lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s) &amp;gt; 0\)&lt;/span&gt;를 만족하는 policy다.&lt;/li&gt;
&lt;li&gt;즉 어떤 action도 확률 0으로 완전히 버리지 않는다.&lt;/li&gt;
&lt;li&gt;이렇게 해야 exploration이 유지된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;varepsilon-greedy-policy&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy Policy&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;대표적인 soft policy가 &lt;b&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy&lt;/b&gt;다.&lt;/li&gt;
&lt;li&gt;각 state에서:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;greedy action은 높은 확률로 선택하고&lt;/li&gt;
&lt;li&gt;나머지 action들도 작은 확률로 선택한다&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;슬라이드의 정의는 다음과 같다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;non-greedy action은 확률 &lt;span class=&quot;math inline&quot;&gt;\(\frac{\varepsilon}{|A(s)|}\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;greedy action은 확률 &lt;span class=&quot;math inline&quot;&gt;\(1-\varepsilon+\frac{\varepsilon}{|A(s)|}\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;따라서 exploration을 유지하면서도 점점 greedy policy에 가까운 행동을 하게 된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;monte-carlo-control-and-gpi&quot; data-ke-size=&quot;size26&quot;&gt;Monte Carlo Control and GPI&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;on-policy MC control도 여전히 &lt;b&gt;GPI&lt;/b&gt;다.&lt;/li&gt;
&lt;li&gt;핵심은 policy를 한 번에 완전히 greedy하게 만들 필요가 없다는 점이다.&lt;/li&gt;
&lt;li&gt;GPI는 policy를 greedy policy 쪽으로 &lt;b&gt;조금씩 이동&lt;/b&gt;시키기만 해도 된다.&lt;/li&gt;
&lt;li&gt;그래서 완전 deterministic greedy policy가 아니라 &lt;b&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft policy&lt;/b&gt;를 유지하면서 control을 진행할 수 있다.&lt;/li&gt;
&lt;li&gt;임의의 &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt;에 대한 임의의 &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy policy는 기존 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;보다 더 좋거나 최소한 같다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;on-policy-first-visit-mc-control-for-varepsilon-soft-policies&quot; data-ke-size=&quot;size26&quot;&gt;On-policy First-visit MC Control for &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft Policies&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;pseudocode는 &lt;b&gt;on-policy first-visit MC control&lt;/b&gt;을 제시한다.&lt;/li&gt;
&lt;li&gt;이 알고리즘은 policy를 &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft하게 유지하면서 first-visit MC로 &lt;span class=&quot;math inline&quot;&gt;\(Q\)&lt;/span&gt;를 추정하고, 그 &lt;span class=&quot;math inline&quot;&gt;\(Q\)&lt;/span&gt;에 맞추어 policy를 다시 &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy로 갱신한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;765&quot; data-origin-height=&quot;494&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/PU4hD/dJMcabwPADP/McnEFDIz3NuyLj0KCcEpsk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/PU4hD/dJMcabwPADP/McnEFDIz3NuyLj0KCcEpsk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/PU4hD/dJMcabwPADP/McnEFDIz3NuyLj0KCcEpsk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FPU4hD%2FdJMcabwPADP%2FMcnEFDIz3NuyLj0KCcEpsk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;765&quot; height=&quot;494&quot; data-origin-width=&quot;765&quot; data-origin-height=&quot;494&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 id=&quot;초기화-1&quot; data-ke-size=&quot;size23&quot;&gt;초기화&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;small &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon &amp;gt; 0\)&lt;/span&gt;를 정한다&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 임의의 &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft policy로 초기화한다&lt;/li&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(Q(s,a)\)&lt;/span&gt;를 임의로 초기화한다&lt;/li&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;에 대해 &lt;code&gt;Returns(s,a)&lt;/code&gt;를 빈 리스트로 초기화한다&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;각-episode마다&quot; data-ke-size=&quot;size23&quot;&gt;각 episode마다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;현재 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 따라 하나의 episode를 생성한다&lt;/li&gt;
&lt;li&gt;뒤에서부터 return &lt;span class=&quot;math inline&quot;&gt;\(G\)&lt;/span&gt;를 계산한다&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\((S_t,A_t)\)&lt;/span&gt;가 그 episode에서 처음 등장한 pair이면:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;code&gt;Returns(S_t,A_t)&lt;/code&gt;에 &lt;span class=&quot;math inline&quot;&gt;\(G\)&lt;/span&gt;를 append&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(Q(S_t,A_t) \leftarrow \text{average}(\text{Returns}(S_t,A_t))\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(A^* \leftarrow \arg\max_a Q(S_t,a)\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\(a \in A(S_t)\)&lt;/span&gt;에 대해 policy를 다음처럼 갱신한다&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(a|S_t) \leftarrow \begin{cases} 1-\varepsilon+\frac{\varepsilon}{|A(S_t)|} &amp;amp; \text{if } a=A^* \\ \frac{\varepsilon}{|A(S_t)|} &amp;amp; \text{if } a\ne A^*\end{cases}\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;의미-1&quot; data-ke-size=&quot;size23&quot;&gt;의미&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;이 알고리즘은 &lt;b&gt;on-policy&lt;/b&gt;다. 즉 episode를 생성하는 policy와 학습 중인 policy가 같은 policy다.&lt;/li&gt;
&lt;li&gt;동시에 &lt;b&gt;first-visit MC prediction&lt;/b&gt;과 &lt;b&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy improvement&lt;/b&gt;를 섞은 control 알고리즘이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;정리해야-할-핵심-개념들&quot; data-ke-size=&quot;size26&quot;&gt;정리해야 할 핵심 개념들&lt;/h2&gt;
&lt;h3 id=&quot;mc는-model-free-sample-based-method다&quot; data-ke-size=&quot;size23&quot;&gt;1. MC는 model-free sample-based method다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;DP처럼 model을 전제로 하지 않는다.&lt;/li&gt;
&lt;li&gt;Bellman equation을 직접 푸는 대신, episode return을 샘플링해서 평균낸다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;mc는-bootstrapping을-하지-않는다&quot; data-ke-size=&quot;size23&quot;&gt;2. MC는 bootstrapping을 하지 않는다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;추정값으로 추정값을 업데이트하지 않는다.&lt;/li&gt;
&lt;li&gt;실제 episode 종료 후의 full return을 쓴다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;prediction과-control이-구분된다&quot; data-ke-size=&quot;size23&quot;&gt;3. Prediction과 Control이 구분된다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;prediction&lt;/b&gt;: 주어진 policy의 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt; 또는 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt;를 추정&lt;/li&gt;
&lt;li&gt;&lt;b&gt;control&lt;/b&gt;: 그 추정치를 이용해 더 좋은 policy를 만든다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;model이-없으면-v_pi만으로는-부족하다&quot; data-ke-size=&quot;size23&quot;&gt;4. model이 없으면 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;만으로는 부족하다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;one-step lookahead를 못 하므로 action별 비교를 위해 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt;가 필요하다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;control에는-exploration이-필수다&quot; data-ke-size=&quot;size23&quot;&gt;5. control에는 exploration이 필수다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;를 보지 못하면 greedy improvement가 불가능하다.&lt;/li&gt;
&lt;li&gt;exploring starts 또는 soft policy가 필요하다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;practical한-방법은-varepsilon-soft-varepsilon-greedy다&quot; data-ke-size=&quot;size23&quot;&gt;6. practical한 방법은 &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft, &lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;exploring starts는 비현실적일 수 있다.&lt;/li&gt;
&lt;li&gt;그래서 모든 action에 양의 확률을 남기는 soft policy를 사용한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;on-policy-mc-control은-gpi의-한-형태다&quot; data-ke-size=&quot;size23&quot;&gt;7. on-policy MC control은 GPI의 한 형태다&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;episode로 evaluation을 수행하고&lt;/li&gt;
&lt;li&gt;그 결과에 따라 policy를 greedy 방향으로 조금씩 옮긴다&lt;/li&gt;
&lt;li&gt;이 상호작용이 반복되며 policy가 개선된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;수식-중심-요약&quot; data-ke-size=&quot;size26&quot;&gt;수식 중심 요약&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;state-value prediction의 목표: &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt; 추정&lt;/li&gt;
&lt;li&gt;action-value prediction의 목표: &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt; 추정&lt;/li&gt;
&lt;li&gt;greedy improvement: &lt;span class=&quot;math inline&quot;&gt;\(\pi(s) := \arg\max_a q(s,a)\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;MC control의 반복: &lt;span class=&quot;math inline&quot;&gt;\(\pi_0 \to q_{\pi_0} \to \pi_1 \to q_{\pi_1} \to \cdots \to \pi^*\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy policy:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;greedy action: &lt;span class=&quot;math inline&quot;&gt;\(1-\varepsilon+\frac{\varepsilon}{|A(s)|}\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;나머지 action: &lt;span class=&quot;math inline&quot;&gt;\(\frac{\varepsilon}{|A(s)|}\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;lecture-7&quot;&gt;&lt;mark style=&quot;background: #FF9B9B;&quot;&gt;LECTURE 7&lt;/mark&gt;&lt;/h1&gt;
&lt;h2 id=&quot;off-policy-monte-carlo&quot; data-ke-size=&quot;size26&quot;&gt;Off-policy Monte Carlo&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Off-policy Monte Carlo는 &lt;b&gt;behavior policy로 생성된 데이터를 사용하여 다른 policy의 value를 학습하는 방법&lt;/b&gt;이다.&lt;/li&gt;
&lt;li&gt;실제로 environment와 상호작용하여 데이터를 생성하는 policy는 &lt;b&gt;behavior policy &lt;span class=&quot;math inline&quot;&gt;\(b\)&lt;/span&gt;&lt;/b&gt;이고, 학습하고 싶은 policy는 &lt;b&gt;target policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;&lt;/b&gt;이다.&lt;/li&gt;
&lt;li&gt;episode 데이터는 behavior policy에 의해 생성되며 trajectory는 다음과 같은 형태를 가진다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\((S_0,A_0,R_1,S_1,A_1,R_2,\dots,S_T)\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;이 trajectory는 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;가 아니라 behavior policy &lt;span class=&quot;math inline&quot;&gt;\(b\)&lt;/span&gt;에 의해 생성된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;varepsilon-soft-policy와-policy-improvement&quot; data-ke-size=&quot;size26&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-soft Policy와 Policy Improvement&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\varepsilon\)&lt;/span&gt;-greedy policy는 다음과 같이 행동을 선택한다.&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;greedy action 선택 확률은 &lt;span class=&quot;math inline&quot;&gt;\(1-\varepsilon+\frac{\varepsilon}{|A(s)|}\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;다른 action 선택 확률은 &lt;span class=&quot;math inline&quot;&gt;\(\frac{\varepsilon}{|A(s)|}\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 greedy action을 높은 확률로 선택하면서도 exploration을 위해 다른 action도 선택한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이때 policy improvement theorem을 이용하면 다음이 성립한다: &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,\pi'(s))\ge v_\pi(s)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[\begin{aligned} q_\pi(s, \pi'(s)) &amp;amp;= \sum_a \pi'(a|s) q_\pi(s,a) \\ &amp;amp;= \frac{\epsilon}{|A(s)|}\sum_a q_\pi(s,a) + (1-\epsilon)\max_a q_\pi(s,a) \\ &amp;amp;\ge \frac{\epsilon}{|A(s)|}\sum_a q_\pi(s,a) + (1-\epsilon)\sum_a \pi(a|s)\frac{1-\epsilon}{\epsilon/|A(s)|} q_\pi(s,a) \\ &amp;amp;= \frac{\epsilon}{|A(s)|}\sum_a q_\pi(s,a) - \frac{\epsilon}{|A(s)|}\sum_a q_\pi(s,a) + \sum_a \pi(a|s) q_\pi(s,a) \\ &amp;amp;= \sum_a \pi(a|s) q_\pi(s,a) \\ &amp;amp;= v_\pi(s), \quad \forall s \in S \end{aligned} \]&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;on-policy와-off-policy&quot; data-ke-size=&quot;size26&quot;&gt;On-policy와 Off-policy&lt;/h2&gt;
&lt;h3 id=&quot;on-policy&quot; data-ke-size=&quot;size23&quot;&gt;On-policy&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;데이터를 생성하는 policy와 학습하는 policy가 동일하다.&lt;/li&gt;
&lt;li&gt;즉 behavior policy와 target policy가 같다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s)=b(a|s)\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;policy evaluation과 policy improvement가 동일한 policy를 기준으로 이루어진다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;off-policy&quot; data-ke-size=&quot;size23&quot;&gt;Off-policy&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;데이터를 생성하는 policy와 학습하는 policy가 서로 다르다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;target policy &lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s)\)&lt;/span&gt;&lt;/b&gt;: 학습하려는 policy&lt;/li&gt;
&lt;li&gt;&lt;b&gt;behavior policy &lt;span class=&quot;math inline&quot;&gt;\(b(a|s)\)&lt;/span&gt;&lt;/b&gt;: environment와 실제로 상호작용하는 policy&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;episode 데이터는 behavior policy에서 생성된다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\((S_0,A_0,R_1,S_1,A_1,R_2,\dots,S_T)\sim b\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;off-policy-learning&quot; data-ke-size=&quot;size26&quot;&gt;Off-policy Learning&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Off-policy learning은 behavior policy로 생성된 데이터를 사용하여 target policy의 value function을 학습하는 문제이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 목표는 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;을 추정하는 것이다&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Off-policy learning이 필요한 이유는 다음과 같다.&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;다른 agent나 사람의 행동 데이터를 사용하여 학습할 수 있다&lt;/li&gt;
&lt;li&gt;이전 policy로 생성된 데이터를 재사용할 수 있다&lt;/li&gt;
&lt;li&gt;exploration policy를 따르면서 optimal policy를 학습할 수 있다&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;off-policy-prediction&quot; data-ke-size=&quot;size26&quot;&gt;Off-policy Prediction&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;behavior policy &lt;span class=&quot;math inline&quot;&gt;\(b\)&lt;/span&gt;로 생성된 데이터를 이용해 target policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;의 value function을 학습한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 목표는 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;를 추정하는 것이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이때 모든 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;와 action &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s)&amp;gt;0\)&lt;/span&gt;이면 &lt;span class=&quot;math inline&quot;&gt;\(b(a|s)&amp;gt;0\)&lt;/span&gt;이어야 한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 target policy가 선택할 수 있는 action은 behavior policy도 반드시 선택할 수 있어야 한다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;importance-sampling&quot; data-ke-size=&quot;size26&quot;&gt;Importance Sampling&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;off-policy setting에서는 target policy에서 직접 sample을 생성할 수 없다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서 behavior policy로 sample을 생성한 뒤 weight를 사용하여 target policy 분포에 맞게 보정한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 방법을 &lt;b&gt;importance sampling&lt;/b&gt;이라고 한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;behavior distribution에서 sample을 얻는다고 하자. &lt;span class=&quot;math inline&quot;&gt;\(X\sim b\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(E_\pi[X]=\sum_x\pi(x)x = \sum_x\frac{\pi(x)}{b(x)}b(x)x = E_b[\rho(X)X] = \frac{1}{n}\sum_{i=1}^n\rho(x_i)x_i\)&lt;/span&gt; (b(x)가 확률이라고 생각하면 됨)&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;여기서 importance weight는 &lt;span class=&quot;math inline&quot;&gt;\(\rho(x_i)=\frac{\pi(x_i)}{b(x_i)}\)&lt;/span&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;off-policy-value-estimation&quot; data-ke-size=&quot;size26&quot;&gt;Off-policy Value Estimation&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;trajectory 전체에 대한 importance weight &lt;span class=&quot;math inline&quot;&gt;\(\rho_{t:T-1}=\prod_{k=t}^{T-1}\frac{\pi(A_k|S_k)}{b(A_k|S_k)}\)&lt;/span&gt;: trajectory에서 각 step마다의 probability ratio를 모두 곱한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;importance weight를 이용하면 value function을 다음과 같이 추정할 수 있다.&lt;/p&gt;
&lt;h3 id=&quot;ordinary-importance-sampling&quot; data-ke-size=&quot;size23&quot;&gt;Ordinary Importance Sampling&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s)=\frac{\sum_{t\in T(s)}\rho_{t:T-1}G_t}{|T(s)|}\)&lt;/span&gt;: 여기서 &lt;span class=&quot;math inline&quot;&gt;\(T(s)\)&lt;/span&gt;는 state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;가 등장한 time step 집합이다.&lt;/p&gt;
&lt;h3 id=&quot;weighted-importance-sampling&quot; data-ke-size=&quot;size23&quot;&gt;Weighted Importance Sampling&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s)=\frac{\sum_{t\in T(s)}\rho_{t:T-1}G_t}{\sum_{t\in T(s)}\rho_{t:T-1}}\)&lt;/span&gt;: weighted estimator는 ordinary estimator보다 분산이 더 안정적인 특징을 가진다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;off-policy-monte-carlo-prediction-algorithm&quot; data-ke-size=&quot;size26&quot;&gt;Off-policy Monte Carlo Prediction Algorithm&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;741&quot; data-origin-height=&quot;397&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/9GO1f/dJMcaiCIz4L/Kv7VB4EuIx0QmvEZGGoLKk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/9GO1f/dJMcaiCIz4L/Kv7VB4EuIx0QmvEZGGoLKk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/9GO1f/dJMcaiCIz4L/Kv7VB4EuIx0QmvEZGGoLKk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F9GO1f%2FdJMcaiCIz4L%2FKv7VB4EuIx0QmvEZGGoLKk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;741&quot; height=&quot;397&quot; data-origin-width=&quot;741&quot; data-origin-height=&quot;397&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;입력은 target policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;초기화&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(Q(s,a)\)&lt;/span&gt;를 임의로 초기화한다.&lt;/li&gt;
&lt;li&gt;누적 weight를 저장하기 위해 &lt;span class=&quot;math inline&quot;&gt;\(C(s,a)=0\)&lt;/span&gt;으로 초기화한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;각 episode마다 behavior policy &lt;span class=&quot;math inline&quot;&gt;\(b\)&lt;/span&gt;를 사용하여 trajectory를 생성한다. &lt;span class=&quot;math inline&quot;&gt;\((S_0,A_0,R_1,S_1,\dots,S_T)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;초기값은 &lt;span class=&quot;math inline&quot;&gt;\(G=0\)&lt;/span&gt;, &lt;span class=&quot;math inline&quot;&gt;\(W=1\)&lt;/span&gt;이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;episode를 뒤에서부터 순회하면서 다음을 수행한다.&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;return 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(G\leftarrow G+\gamma R_{t+1}\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;누적 weight 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(C(S_t,A_t)\leftarrow C(S_t,A_t)+W\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Q 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(Q(S_t,A_t)\leftarrow Q(S_t,A_t)+\frac{W}{C(S_t,A_t)}(G-Q(S_t,A_t))\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;importance weight 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(W\leftarrow W\frac{\pi(A_t|S_t)}{b(A_t|S_t)}\)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;off-policy-monte-carlo-control&quot; data-ke-size=&quot;size26&quot;&gt;Off-policy Monte Carlo Control&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;738&quot; data-origin-height=&quot;443&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dADjkD/dJMcaaEJeAN/4CZG0EujjSz1k0JmvacNbK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dADjkD/dJMcaaEJeAN/4CZG0EujjSz1k0JmvacNbK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dADjkD/dJMcaaEJeAN/4CZG0EujjSz1k0JmvacNbK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdADjkD%2FdJMcaaEJeAN%2F4CZG0EujjSz1k0JmvacNbK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;738&quot; height=&quot;443&quot; data-origin-width=&quot;738&quot; data-origin-height=&quot;443&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;목표는 optimal policy &lt;span class=&quot;math inline&quot;&gt;\(\pi^*\)&lt;/span&gt;를 찾는 것이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;초기화&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;모든 &lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(Q(s,a)\)&lt;/span&gt;를 임의로 초기화한다.&lt;/li&gt;
&lt;li&gt;누적 weight &lt;span class=&quot;math inline&quot;&gt;\(C(s,a)=0\)&lt;/span&gt;으로 초기화한다.&lt;/li&gt;
&lt;li&gt;policy는 &lt;span class=&quot;math inline&quot;&gt;\(\pi(s)=\arg\max_a Q(s,a)\)&lt;/span&gt;로 초기화한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;각 episode마다 behavior policy &lt;span class=&quot;math inline&quot;&gt;\(b\)&lt;/span&gt;를 이용해 trajectory를 생성한다. &lt;span class=&quot;math inline&quot;&gt;\((S_0,A_0,R_1,\dots,S_T)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;초기값은 &lt;span class=&quot;math inline&quot;&gt;\(G=0\)&lt;/span&gt;, &lt;span class=&quot;math inline&quot;&gt;\(W=1\)&lt;/span&gt;이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;episode를 뒤에서부터 순회하면서 다음을 수행한다.&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;return 계산: &lt;span class=&quot;math inline&quot;&gt;\(G\leftarrow G+\gamma R_{t+1}\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;누적 weight 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(C(S_t,A_t)\leftarrow C(S_t,A_t)+W\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Q 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(Q(S_t,A_t)\leftarrow Q(S_t,A_t)+\frac{W}{C(S_t,A_t)}(G-Q(S_t,A_t))\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;policy 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(\pi(S_t)\leftarrow\arg\max_a Q(S_t,a)\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;만약 &lt;span class=&quot;math inline&quot;&gt;\(A_t\ne\pi(S_t)\)&lt;/span&gt;이면 내부 반복을 종료한다.&lt;/li&gt;
&lt;li&gt;importance weight 업데이트: &lt;span class=&quot;math inline&quot;&gt;\(W\leftarrow W\frac{1}{b(A_t|S_t)}\)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 과정을 반복하면 policy는 점점 optimal policy로 수렴한다.&lt;/p&gt;</description>
      <category>딥러닝 논문/강화학습</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/60</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/%EA%B0%95%ED%99%94%ED%95%99%EC%8A%B5-%EB%82%B4%EC%9A%A9-%EC%A0%95%EB%A6%AC-Lecture-67#entry60comment</comments>
      <pubDate>Thu, 26 Mar 2026 23:42:14 +0900</pubDate>
    </item>
    <item>
      <title>강화학습 내용 정리 (Lecture 4~5)</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/%EA%B0%95%ED%99%94%ED%95%99%EC%8A%B5-%EB%82%B4%EC%9A%A9-%EC%A0%95%EB%A6%AC-Lecture-45</link>
      <description>&lt;h1 id=&quot;lecture-4&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;LECTURE 4&lt;/mark&gt;&lt;/h1&gt;
&lt;h1 id=&quot;dynamic-programming&quot;&gt;Dynamic Programming&lt;/h1&gt;
&lt;p&gt;Dynamic Programming(DP)은 reinforcement learning 알고리즘을 이해하는 데 핵심적인 이론적 기반이다. 대부분의 현대 RL 알고리즘은 &lt;strong&gt;DP가 수행하는 효과를 환경 모델 없이, 더 적은 계산으로 근사하려는 방법&lt;/strong&gt;이라고 볼 수 있다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;policies와-value-functions&quot;&gt;1. Policies와 Value Functions&lt;/h1&gt;
&lt;p&gt;정책(policy) &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;와 &lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;\)&lt;/span&gt;가 있을 때 다음이 성립하면 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s) \ge v_{\pi&amp;#39;}(s) \quad \forall s \in S\)&lt;/span&gt; 정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;가 &lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;\)&lt;/span&gt;보다 좋다. Optimal policy는 &lt;strong&gt;모든 정책보다 같거나 더 좋은 정책&lt;/strong&gt;이다.&lt;/p&gt;
&lt;p&gt;그런데 과연 그런 정책이 존재할까?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;어떤 state에서는 policy A가 B보다 더 나은데, 나머지 state에서는 B가 A보다 나을 수도 있지 않은가?&lt;/li&gt;
&lt;li&gt;모든 state에서 나머지 policies보다 나은 optimal policy가 늘 존재할까?&lt;/li&gt;
&lt;li&gt;YES!&lt;/li&gt;
&lt;li&gt;그런 policy를 찾는 방법을 이제 알아볼것이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;dynamic-programming의-핵심-아이디어&quot;&gt;2. Dynamic Programming의 핵심 아이디어&lt;/h1&gt;
&lt;p&gt;DP는 &lt;strong&gt;환경 모델을 알고 있다는 가정&lt;/strong&gt; 아래 다음 두 문제를 해결한다.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Policy Evaluation&lt;/strong&gt; 주어진 정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;의 value function &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;를 계산한다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;현재 state에서 취할 수 있는 action들의 가치 측정.&lt;/li&gt;
&lt;li&gt;그래서 q가 아니라 v를 이용. q는 액션까지 주어져있을 때의 상황을 가정&lt;/li&gt;
&lt;li&gt;a.k.a prediction problem&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Policy Improvement&lt;/strong&gt; value function을 이용해 더 좋은 정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;\)&lt;/span&gt;를 찾는다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a.k.a Control problem&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;DP 기반 알고리즘은 &lt;strong&gt;policy evaluation과 policy improvement를 반복하는 구조&lt;/strong&gt;를 가진다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;policy-evaluation&quot;&gt;3. Policy Evaluation&lt;/h1&gt;
&lt;p&gt;Policy evaluation은 주어진 정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;에 대해 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;를 계산하는 과정이다.&lt;/p&gt;
&lt;p&gt;Bellman equation을 이용하면 다음을 얻는다. &lt;span class=&quot;math display&quot;&gt;\[
v_\pi(s) =
\sum_a \pi(a|s)
\sum_{s&amp;#39;,r}
p(s&amp;#39;,r|s,a)
\left[
r + \gamma v_\pi(s&amp;#39;)
\right]
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;DP에서는 이 식을 &lt;strong&gt;반복적으로 적용하여 value function을 근사한다.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;이를 위해 value 함수의 sequence&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math display&quot;&gt;\[
v_0, v_1, v_2, ...
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;를 정의하고 다음 업데이트를 사용한다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math display&quot;&gt;\[
v_{k+1}(s) \leftarrow
\sum_a \pi(a|s)
\sum_{s&amp;#39;,r}
p(s&amp;#39;,r|s,a)
\left[
r + \gamma v_k(s&amp;#39;)
\right]
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;이 과정을 반복하면 &lt;span class=&quot;math inline&quot;&gt;\(v_k\)&lt;/span&gt;가 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;로 수렴한다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;bellman-backup&quot;&gt;4. Bellman Backup&lt;/h1&gt;
&lt;p&gt;위 업데이트는 &lt;strong&gt;Bellman backup&lt;/strong&gt;이라 불린다.&lt;/p&gt;
&lt;p&gt;핵심 아이디어는 다음과 같다.&lt;/p&gt;
&lt;p&gt;다음 상태의 value &lt;span class=&quot;math inline&quot;&gt;\(v_k(s&amp;#39;)\)&lt;/span&gt;를 사용하여 현재 상태의 value &lt;span class=&quot;math inline&quot;&gt;\(v_{k+1}(s)\)&lt;/span&gt;를 계산한다.&lt;/p&gt;
&lt;p&gt;즉 value 정보가 &lt;strong&gt;미래 상태에서 현재 상태로 전파된다.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;슬라이드의 그림에서는 state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 action을 통해 여러 &lt;span class=&quot;math inline&quot;&gt;\(s&amp;#39;\)&lt;/span&gt;로 이동하고, 그 leaf state의 value가 다시 상위 state 계산에 사용되는 구조가 나타난다. (page 10 diagram)&lt;/p&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;value-function-update-방식&quot;&gt;5. Value Function Update 방식&lt;/h1&gt;
&lt;p&gt;value function 업데이트는 두 가지 방식으로 구현된다.&lt;/p&gt;
&lt;h3 id=&quot;two-array-update&quot;&gt;Two-array update&lt;/h3&gt;
&lt;p&gt;두 개의 배열을 사용한다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_k\)&lt;/span&gt; : 이전 iteration value&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{k+1}\)&lt;/span&gt; : 새로운 value&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;각 state를 순회하며 새로운 값을 계산한다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;in-place-update&quot;&gt;In-place update&lt;/h3&gt;
&lt;p&gt;하나의 배열만 사용한다.&lt;/p&gt;
&lt;p&gt;업데이트된 값을 바로 다음 계산에 사용한다.&lt;/p&gt;
&lt;p&gt;이 방식은 &lt;strong&gt;더 빠르게 수렴하는 경우가 많다.&lt;/strong&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;iterative-policy-evaluation-algorithm&quot;&gt;6. Iterative Policy Evaluation Algorithm&lt;/h1&gt;
&lt;p&gt;![[Pasted image 20260313210428.png]] value의 변화가 theta 안으로 들어오면 끝!&lt;/p&gt;
&lt;h1 id=&quot;policy-improvement&quot;&gt;9. Policy Improvement&lt;/h1&gt;
&lt;p&gt;policy improvement는 value function을 이용해 더 좋은 정책을 만드는 과정이다.&lt;/p&gt;
&lt;p&gt;Policy Improvement Theorem&lt;/p&gt;
&lt;p&gt;다음 조건이 성립하면&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math display&quot;&gt;\[
q_\pi(s,\pi&amp;#39;(s)) \ge v_\pi(s)
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;\)&lt;/span&gt;는 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;보다 같거나 더 좋은 정책이다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1 id=&quot;improved-policy-계산&quot;&gt;10. Improved Policy 계산&lt;/h1&gt;
&lt;p&gt;새 정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;\)&lt;/span&gt;는 다음과 같이 계산된다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math display&quot;&gt;\[
\pi&amp;#39;(s) =
\arg\max_a q_\pi(s,a)
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;이를 전개하면&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math display&quot;&gt;\[
\pi&amp;#39;(s)
=
\arg\max_a
\sum_{s&amp;#39;,r}
p(s&amp;#39;,r|s,a)
\left[
r + \gamma v_\pi(s&amp;#39;)
\right]
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;즉&lt;/p&gt;
&lt;p&gt;기존 policy의 value function을 기준으로 &lt;strong&gt;greedy action을 선택&lt;/strong&gt;한다.&lt;/p&gt;
&lt;p&gt;이를 &lt;strong&gt;greedy policy improvement&lt;/strong&gt;라 한다.&lt;/p&gt;
&lt;h1 id=&quot;lecture-5&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;LECTURE 5&lt;/mark&gt;&lt;/h1&gt;
&lt;p&gt;목표는 &lt;strong&gt;optimal policy&lt;/strong&gt;를 찾는 것이다.&lt;br /&gt;
출발점은 이미 앞 강의에서 본 두 연산, 즉 &lt;strong&gt;policy evaluation&lt;/strong&gt;과 &lt;strong&gt;policy improvement&lt;/strong&gt;다.&lt;br /&gt;
이번 강의는 이 둘을 어떻게 결합하면 실제로 &lt;strong&gt;optimal control&lt;/strong&gt; 문제를 풀 수 있는지 설명한다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;policy evaluation&lt;/strong&gt;: 현재 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;가 주어졌을 때 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;를 계산한다&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;policy improvement&lt;/strong&gt;: 현재 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;가 주어졌을 때 더 나은 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;\)&lt;/span&gt;를 만든다&lt;/li&gt;
&lt;li&gt;이 둘을 반복하면 &lt;strong&gt;policy iteration&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;evaluation을 끝까지 하지 않고 바로 greedy backup을 수행하면 &lt;strong&gt;value iteration&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;이 둘을 더 큰 틀에서 보면 &lt;strong&gt;Generalized Policy Iteration, GPI&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;policy-evaluation과-policy-improvement&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;1. Policy evaluation과 policy improvement&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;policy-evaluation-1&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) Policy evaluation&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;policy evaluation의 입력은 &lt;strong&gt;policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;&lt;/strong&gt; 이고, 출력은 &lt;strong&gt;state-value function &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;&lt;/strong&gt; 다.&lt;br /&gt;
즉 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 시작해서 앞으로 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 계속 따른다고 했을 때의 기대 return을 계산한다.&lt;/p&gt;
&lt;p&gt;정의는 다음과 같다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt;: 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 시작해 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 따를 때의 기대 return&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt;: 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 action &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;를 먼저 하고 이후 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 따를 때의 기대 return&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;finite MDP에서, 그리고 &lt;span class=&quot;math inline&quot;&gt;\(\gamma &amp;lt; 1\)&lt;/span&gt; 이거나 모든 상태에서 종료가 보장되면, &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;는 존재하고 유일하다.&lt;br /&gt;
또한 iterative policy evaluation은 finite MDP에서 수렴한다.&lt;/p&gt;
&lt;p&gt;정책 평가에서 사용하는 Bellman expectation equation은 다음이다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_a \pi(a|s)\sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma v_\pi(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;deterministic policy이면 식이 더 단순해진다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,\pi(s))\big[r+\gamma v_\pi(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;이 식의 의미는 분명하다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서&lt;/li&gt;
&lt;li&gt;policy가 정한 행동을 취하고&lt;/li&gt;
&lt;li&gt;다음 상태와 보상을 transition model로 평균낸 뒤&lt;/li&gt;
&lt;li&gt;한 step reward와 다음 상태의 discounted value를 더한다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;즉 현재 상태의 가치는 &lt;strong&gt;한 step lookahead&lt;/strong&gt;와 &lt;strong&gt;미래 가치&lt;/strong&gt;의 합이다.&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;policy evaluation은 “이 policy로 계속 살면 각 상태가 얼마나 좋은가”를 점수표로 만드는 과정이다.&lt;br /&gt;
아직 policy를 바꾸지는 않는다. 현재 policy의 품질을 정량화만 한다.&lt;/p&gt;

&lt;/details&gt;
&lt;h3 id=&quot;policy-improvement-1&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) Policy improvement&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;policy improvement의 입력은 &lt;strong&gt;현재 policy의 value function &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;&lt;/strong&gt; 이고, 출력은 &lt;strong&gt;개선된 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;\)&lt;/span&gt;&lt;/strong&gt; 다.&lt;br /&gt;
핵심 아이디어는 단순하다. 각 상태에서 지금 value function 기준으로 가장 좋아 보이는 action을 택하면 된다.&lt;/p&gt;
&lt;p&gt;한 step lookahead로 action-value를 계산하면&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma v_\pi(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;이때 greedy policy는&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;(s)\in \arg\max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma v_\pi(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;로 정의할 수 있다.&lt;/p&gt;
&lt;p&gt;강의에서 제시한 &lt;strong&gt;policy improvement theorem&lt;/strong&gt;은 다음이다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\forall s\in S,\ q_\pi(s,\pi&amp;#39;(s))\ge v_\pi(s)\Rightarrow \forall s\in S,\ v_{\pi&amp;#39;}(s)\ge v_\pi(s)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;의미는 다음과 같다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;모든 상태에서&lt;/li&gt;
&lt;li&gt;새 policy가 고른 action의 quality가&lt;/li&gt;
&lt;li&gt;기존 policy value보다 작지 않으면&lt;/li&gt;
&lt;li&gt;새 policy 전체의 value도 기존 policy보다 작지 않다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;즉 &lt;strong&gt;greedy improvement는 policy를 나쁘게 만들지 않는다.&lt;/strong&gt;&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;

&lt;p&gt;이 정리가 있어야 evaluation 뒤에 improvement를 붙이는 전체 알고리즘이 정당화된다.&lt;br /&gt;
그냥 “좋아 보이는 action”을 고른 것이 아니라, 실제로 policy 전체를 개선한다는 보장이 생긴다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;우리가-진짜로-원하는-것&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;2. 우리가 진짜로 원하는 것&lt;/mark&gt;&lt;/h2&gt;
&lt;p&gt;목표는 &lt;strong&gt;optimal policy&lt;/strong&gt;를 찾는 것이다.&lt;br /&gt;
즉 모든 상태에서 최적의 기대 return을 주는 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi^*\)&lt;/span&gt;와 그에 대응하는 optimal value function &lt;span class=&quot;math inline&quot;&gt;\(v^*\)&lt;/span&gt;를 구해야 한다.&lt;/p&gt;
&lt;p&gt;optimal value function은 다음을 만족한다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(s)=\max_\pi v_\pi(s)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;optimal policy는 다음을 만족한다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi^*(s)\in \arg\max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma v^*(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;즉 최종 목표는 단순한 policy 평가가 아니라 &lt;strong&gt;control&lt;/strong&gt;이다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;policy-iteration&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;3. Policy Iteration&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;기본-아이디어&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) 기본 아이디어&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;policy iteration&lt;/strong&gt;은 다음 두 단계를 번갈아 반복한다.&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;현재 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi_k\)&lt;/span&gt;를 평가해서 &lt;span class=&quot;math inline&quot;&gt;\(v_{\pi_k}\)&lt;/span&gt;를 구한다&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{\pi_k}\)&lt;/span&gt;에 대해 greedy한 새로운 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi_{k+1}\)&lt;/span&gt;를 만든다&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;흐름은 다음처럼 쓸 수 있다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi_0 \xrightarrow{E} v_{\pi_0} \xrightarrow{I} \pi_1 \xrightarrow{E} v_{\pi_1} \xrightarrow{I} \pi_2 \xrightarrow{} \cdots \xrightarrow{I} \pi^* \xrightarrow{E} v_{\pi^*}\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;여기서&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(E\)&lt;/span&gt;: policy evaluation&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(I\)&lt;/span&gt;: policy improvement&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;를 뜻한다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;각 iteration에서 policy는 이전 policy보다 &lt;strong&gt;strict improvement&lt;/strong&gt;가 된다&lt;/li&gt;
&lt;li&gt;예외는 현재 policy가 이미 optimal policy일 때뿐이다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;즉 finite MDP에서는 optimal policy에 도달하기 전까지 계속 policy가 좋아진다.&lt;/p&gt;
&lt;h3 id=&quot;pseudocode의-구조&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) Pseudocode의 구조&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;policy iteration pseudocode의 뼈대는 다음과 같다. ![[Pasted image 20260315121658.png]]&lt;/p&gt;
&lt;h4 id=&quot;초기화&quot;&gt;초기화&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;모든 상태의 &lt;span class=&quot;math inline&quot;&gt;\(V(s)\)&lt;/span&gt;를 임의로 초기화&lt;/li&gt;
&lt;li&gt;모든 상태의 &lt;span class=&quot;math inline&quot;&gt;\(\pi(s)\)&lt;/span&gt;도 임의로 초기화&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;policy-evaluation-단계&quot;&gt;Policy evaluation 단계&lt;/h4&gt;
&lt;p&gt;현재 policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;를 고정하고 아래 backup을 반복한다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s)\leftarrow \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,\pi(s))\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;이때 모든 상태를 sweep하면서 값의 변화량 &lt;span class=&quot;math inline&quot;&gt;\(\Delta\)&lt;/span&gt;를 계산하고, &lt;span class=&quot;math inline&quot;&gt;\(\Delta&amp;lt;\theta\)&lt;/span&gt;가 되면 evaluation을 멈춘다.&lt;/p&gt;
&lt;p&gt;즉 이 단계의 목적은&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;현재 policy에 대해&lt;/li&gt;
&lt;li&gt;value function이 self-consistent하도록&lt;/li&gt;
&lt;li&gt;Bellman expectation equation을 충분히 만족하게 만드는 것이다&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;policy-improvement-단계&quot;&gt;Policy improvement 단계&lt;/h4&gt;
&lt;p&gt;각 상태에서 action을 greedy하게 바꾼다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(s)\leftarrow \arg\max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;policy가 어떤 상태에서도 더 이상 바뀌지 않으면 종료한다.&lt;br /&gt;
이 경우 현재 policy가 optimal policy다.&lt;/p&gt;
&lt;h3 id=&quot;왜-수렴하는가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) 왜 수렴하는가&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;policy iteration이 수렴하는 이유는 두 가지다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;evaluation 단계는 현재 policy의 정확한 value 또는 충분히 정확한 근사값으로 수렴한다&lt;/li&gt;
&lt;li&gt;improvement 단계는 policy를 strict improvement 방향으로 바꾼다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;finite MDP에서 deterministic policy의 수는 유한하므로, strict improvement를 무한히 반복할 수 없다.&lt;br /&gt;
따라서 언젠가는 더 이상 바뀌지 않는 policy에 도달한다.&lt;br /&gt;
그 policy가 optimal policy다.&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;policy iteration은 “현재 계획을 완전히 평가하고, 그 결과에 따라 계획을 다시 짠다”를 반복하는 방식이다.&lt;br /&gt;
한 번의 개선 전에 현재 계획을 충분히 이해하고 넘어간다는 점이 특징이다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;value-iteration&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4. Value Iteration&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;왜-필요한가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) 왜 필요한가&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;policy iteration의 약점은 &lt;strong&gt;policy evaluation이 비싸다&lt;/strong&gt;는 점이다.&lt;br /&gt;
한 번의 improvement를 하기 전에 current policy에 대한 value function을 꽤 정확히 구해야 해서, state set 전체를 여러 번 sweep해야 한다. 이러한 단점을 극복한 대안으로 &lt;strong&gt;value iteration&lt;/strong&gt;이 있다.&lt;/p&gt;
&lt;h3 id=&quot;핵심-아이디어&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) 핵심 아이디어&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;value iteration의 핵심은 다음이다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;현재 policy를 끝까지 평가하지 않는다&lt;/li&gt;
&lt;li&gt;매 iteration마다 Bellman optimality backup을 바로 적용한다&lt;/li&gt;
&lt;li&gt;evaluation과 improvement를 사실상 하나의 update로 합친다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;업데이트 식은 다음이다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s)\leftarrow \max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;이 식은 policy를 명시적으로 들고 있지 않다.&lt;br /&gt;
현재 value를 바탕으로 모든 action을 비교해서 최선의 action만 남긴다.&lt;br /&gt;
즉 매 step마다 이미 greedy improvement가 update 안에 들어 있다.&lt;/p&gt;
&lt;p&gt;이 식이 바로 Bellman optimality equation의 iterative form이다.&lt;/p&gt;
&lt;p&gt;최종적으로 수렴한 &lt;span class=&quot;math inline&quot;&gt;\(V\)&lt;/span&gt;가 &lt;span class=&quot;math inline&quot;&gt;\(v^*\)&lt;/span&gt;에 가까워지면, 그때 greedy policy를 뽑는다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(s)\in \arg\max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;pseudocode의-구조-1&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) Pseudocode의 구조&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;![[Pasted image 20260315121958.png]]&lt;/p&gt;
&lt;h4 id=&quot;초기화-1&quot;&gt;초기화&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;small threshold &lt;span class=&quot;math inline&quot;&gt;\(\theta&amp;gt;0\)&lt;/span&gt;를 정한다&lt;/li&gt;
&lt;li&gt;모든 상태에 대해 &lt;span class=&quot;math inline&quot;&gt;\(V(s)\)&lt;/span&gt;를 임의로 초기화한다&lt;/li&gt;
&lt;li&gt;terminal state value는 보통 0으로 둔다&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;반복&quot;&gt;반복&lt;/h4&gt;
&lt;p&gt;모든 상태에 대해&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s)\leftarrow \max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;를 수행하고, 변화량 &lt;span class=&quot;math inline&quot;&gt;\(\Delta\)&lt;/span&gt;가 충분히 작아질 때까지 반복한다.&lt;/p&gt;
&lt;h4 id=&quot;종료-후-policy-추출&quot;&gt;종료 후 policy 추출&lt;/h4&gt;
&lt;p&gt;수렴한 &lt;span class=&quot;math inline&quot;&gt;\(V\)&lt;/span&gt;에 대해 greedy policy를 만든다.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(s)\leftarrow \arg\max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;policy-iteration과의-차이&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(4) policy iteration과의 차이&lt;/mark&gt;&lt;/h3&gt;
&lt;h4 id=&quot;policy-iteration-1&quot;&gt;policy iteration&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;현재 policy를 명시적으로 유지한다&lt;/li&gt;
&lt;li&gt;그 policy의 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;를 충분히 정확히 계산한다&lt;/li&gt;
&lt;li&gt;그 후 greedy improvement를 한다&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;value-iteration-1&quot;&gt;value iteration&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;policy를 따로 끝까지 평가하지 않는다&lt;/li&gt;
&lt;li&gt;매 sweep마다 optimality backup을 한 번씩 적용한다&lt;/li&gt;
&lt;li&gt;evaluation과 improvement가 update 안에서 동시에 일어난다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;즉 policy iteration은 &lt;strong&gt;정책 단위의 큰 걸음&lt;/strong&gt;이고, value iteration은 &lt;strong&gt;가치함수 단위의 잦은 greedy backup&lt;/strong&gt;이다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;generalized-policy-iteration-gpi&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5. Generalized Policy Iteration (GPI)&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;개념&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) 개념&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;강의는 policy iteration을 더 일반적인 틀로 해석한다.&lt;br /&gt;
핵심은 두 개의 상호작용하는 과정이다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;policy evaluation&lt;/strong&gt;: 현재 policy와 value function을 일치시키는 과정&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;policy improvement&lt;/strong&gt;: 현재 value function에 대해 policy를 greedy하게 만드는 과정&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;이 둘은 동시에, 혹은 번갈아 진행될 수 있다.&lt;br /&gt;
중요한 것은 둘 다 계속 모든 상태를 업데이트한다는 점이다.&lt;br /&gt;
그러면 optimal value function과 optimal policy로 수렴한다.&lt;/p&gt;
&lt;h3 id=&quot;왜-일반화인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) 왜 일반화인가&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;policy iteration은 evaluation을 길게 하고 improvement를 한 번 하는 형태다.&lt;br /&gt;
value iteration은 evaluation을 한 step만 하고 바로 improvement를 섞는 형태다.&lt;br /&gt;
둘 다 결국 GPI의 특수한 경우다.&lt;/p&gt;
&lt;p&gt;즉 GPI는 다음을 포괄한다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;완전한 policy evaluation + 간헐적 improvement&lt;/li&gt;
&lt;li&gt;불완전한 evaluation + 빈번한 improvement&lt;/li&gt;
&lt;li&gt;근사적인 value estimate + 근사적인 policy update&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;수학적-핵심-감각&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) 수학적 핵심 감각&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;GPI를 수식으로 한 줄에 담으면 다음 두 목표의 상호작용이다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;value는 현재 policy에 대해 &lt;span class=&quot;math inline&quot;&gt;\(v\approx v_\pi\)&lt;/span&gt;가 되려 한다&lt;/li&gt;
&lt;li&gt;policy는 현재 value에 대해 &lt;span class=&quot;math inline&quot;&gt;\(\pi\approx greedy(v)\)&lt;/span&gt;가 되려 한다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;이 두 관계를 동시에 만족하는 고정점이 결국 &lt;span class=&quot;math inline&quot;&gt;\((v^*,\pi^*)\)&lt;/span&gt;다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;update-방식-synchronous와-asynchronous&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6. Update 방식: synchronous와 asynchronous&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;synchronous-updates-with-two-arrays&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) Synchronous updates with two arrays&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;이 방식은 배열을 두 개 둔다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;old array: &lt;span class=&quot;math inline&quot;&gt;\(v_k\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;new array: &lt;span class=&quot;math inline&quot;&gt;\(v_{k+1}\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;하나의 sweep 동안&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;계산은 전부 old array를 참조하고&lt;/li&gt;
&lt;li&gt;결과는 new array에 기록한다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;모든 상태 업데이트가 끝난 뒤에야 &lt;span class=&quot;math inline&quot;&gt;\(v_{k+1}\)&lt;/span&gt;를 다음 단계의 기준값으로 사용한다.&lt;/p&gt;
&lt;p&gt;장점:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;수학적으로 해석이 가장 깔끔하다&lt;/li&gt;
&lt;li&gt;한 iteration이 명확히 “이전 value 전체에 대한 한 번의 Bellman backup”이 된다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;단점:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;메모리를 더 쓴다&lt;/li&gt;
&lt;li&gt;방금 계산한 좋은 정보가 같은 sweep 안에서 바로 퍼지지 않는다&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;synchronous-in-place-updates&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) Synchronous in-place updates&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;이 방식은 배열 하나만 쓴다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;상태를 정해진 순서대로 방문하며&lt;/li&gt;
&lt;li&gt;계산 결과를 같은 배열에 즉시 덮어쓴다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;즉 어떤 상태는 이번 sweep에서 이미 갱신된 최신 이웃값을 참조하고, 어떤 상태는 아직 갱신되지 않은 이전값을 참조할 수 있다.&lt;/p&gt;
&lt;p&gt;장점:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;메모리가 절약된다&lt;/li&gt;
&lt;li&gt;정보가 더 빨리 전파될 수 있다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;단점:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;상태를 방문하는 순서가 실제 convergence speed에 영향을 줄 수 있다&lt;/li&gt;
&lt;li&gt;엄밀히 보면 two-array 방식과는 다른 update dynamics를 가진다&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;asynchronous-in-place-updates&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) Asynchronous in-place updates&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;이 방식은 더 자유롭다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;모든 상태를 매 sweep마다 반드시 한 번씩 업데이트할 필요가 없다&lt;/li&gt;
&lt;li&gt;어떤 상태는 자주, 어떤 상태는 드물게 업데이트할 수 있다&lt;/li&gt;
&lt;li&gt;중요한 상태나 변화가 큰 상태를 우선 업데이트할 수 있다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;large state space에서 이 방식이 특히 중요하다.&lt;br /&gt;
전체 상태를 균일하게 sweep하는 것이 비효율적일 수 있기 때문이다.&lt;/p&gt;
&lt;p&gt;예를 들어&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;agent가 자주 방문하는 상태&lt;/li&gt;
&lt;li&gt;goal에 가까운 상태&lt;/li&gt;
&lt;li&gt;value 변화가 큰 상태&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;를 우선 업데이트하면 계산 효율이 좋아질 수 있다.&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;

&lt;p&gt;실제 대규모 문제에서는 “모든 상태를 동일하게 같은 빈도로 갱신”하는 방식이 비효율적이다.&lt;br /&gt;
asynchronous update는 계산 자원을 더 필요한 곳에 집중할 수 있게 한다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;dynamic-programming의-효율성&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;7. Dynamic Programming의 효율성&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;상태-수의-증가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) 상태 수의 증가&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;DP가 자주 비실용적으로 여겨지는 이유&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;상태 수 &lt;span class=&quot;math inline&quot;&gt;\(|S|\)&lt;/span&gt;가 너무 크다&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;curse of dimensionality&lt;/strong&gt; 때문에 상태 수가 지수적으로 커질 수 있다&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;그럼에도-효율적인-이유&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) 그럼에도 효율적인 이유&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;DP는 &lt;span class=&quot;math inline&quot;&gt;\(|S|\)&lt;/span&gt;와 &lt;span class=&quot;math inline&quot;&gt;\(|A|\)&lt;/span&gt;에 대한 polynomial time 안에 optimal policy를 찾는다&lt;/li&gt;
&lt;li&gt;deterministic policy 전체 개수는 &lt;span class=&quot;math inline&quot;&gt;\(|A|^{|S|}\)&lt;/span&gt;개다&lt;/li&gt;
&lt;li&gt;따라서 policy space를 직접 검색하는 방식보다 DP가 훨씬 빠르다&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;large-state-space에-대한-해석&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) large state space에 대한 해석&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;large state set의 어려움이 DP 고유의 약점만은 아니다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;large state set이 어렵다는 것은 문제 자체의 inherent difficulty다&lt;/li&gt;
&lt;li&gt;DP는 그 어려움을 정직하게 드러내는 방법이다&lt;/li&gt;
&lt;li&gt;오늘날 컴퓨터로는 millions of states 규모의 MDP도 풀 수 있다&lt;/li&gt;
&lt;li&gt;실제 실행에서는 theoretical worst-case보다 훨씬 빠르게 수렴하는 경우가 많다&lt;/li&gt;
&lt;li&gt;large state spaces에서는 asynchronous DP가 자주 선호된다&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;이-강의에서-꼭-잡아야-할-수식&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;8. 이 강의에서 꼭 잡아야 할 수식&lt;/mark&gt;&lt;/h2&gt;
&lt;p&gt;아래 식들은 강의 전체의 핵심 식들이다.&lt;/p&gt;
&lt;h3 id=&quot;bellman-expectation-equation&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) Bellman expectation equation&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_a \pi(a|s)\sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma v_\pi(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;현재 policy를 평가하는 식이다.&lt;/p&gt;
&lt;h3 id=&quot;one-step-lookahead-action-value-under-v_pi&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) one-step lookahead action value under &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt;&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma v_\pi(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;policy improvement에 바로 쓰인다.&lt;/p&gt;
&lt;h3 id=&quot;policy-improvement-theorem의-조건&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) Policy improvement theorem의 조건&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,\pi&amp;#39;(s))\ge v_\pi(s)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;모든 상태에서 이 조건이 성립하면 &lt;span class=&quot;math inline&quot;&gt;\(v_{\pi&amp;#39;}(s)\ge v_\pi(s)\)&lt;/span&gt;가 된다.&lt;/p&gt;
&lt;h3 id=&quot;policy-evaluation-update&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(4) Policy evaluation update&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s)\leftarrow \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,\pi(s))\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;policy iteration 내부 평가 단계에서 쓴다.&lt;/p&gt;
&lt;h3 id=&quot;policy-improvement-update&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(5) Policy improvement update&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(s)\leftarrow \arg\max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;현재 value에 대해 greedy policy를 만든다.&lt;/p&gt;
&lt;h3 id=&quot;bellman-optimality-backup&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(6) Bellman optimality backup&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s)\leftarrow \max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma V(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;value iteration의 핵심 update다.&lt;/p&gt;
&lt;h3 id=&quot;optimal-policy-extraction&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(7) Optimal policy extraction&lt;/mark&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi^*(s)\in \arg\max_a \sum_{s&amp;#39;,r}p(s&amp;#39;,r|s,a)\big[r+\gamma v^*(s&amp;#39;)\big]\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;optimal value가 있으면 optimal policy는 greedy하게 뽑을 수 있다.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;policy-iteration과-value-iteration을-한-번에-비교&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;9. Policy iteration과 value iteration을 한 번에 비교&lt;/mark&gt;&lt;/h2&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 33%&quot; /&gt;
&lt;col style=&quot;width: 33%&quot; /&gt;
&lt;col style=&quot;width: 33%&quot; /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;항목&lt;/th&gt;
&lt;th&gt;Policy Iteration&lt;/th&gt;
&lt;th&gt;Value Iteration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;기본 철학&lt;/td&gt;
&lt;td&gt;현재 policy를 충분히 평가한 뒤 개선&lt;/td&gt;
&lt;td&gt;완전한 평가 없이 optimality backup 수행&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;policy 보유 방식&lt;/td&gt;
&lt;td&gt;policy를 명시적으로 유지&lt;/td&gt;
&lt;td&gt;value 중심으로 진행, policy는 나중에 추출 가능&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;update 식&lt;/td&gt;
&lt;td&gt;expectation backup + greedy improvement&lt;/td&gt;
&lt;td&gt;max backup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iteration 비용&lt;/td&gt;
&lt;td&gt;비교적 큼&lt;/td&gt;
&lt;td&gt;비교적 작음&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iteration 수&lt;/td&gt;
&lt;td&gt;보통 적을 수 있음&lt;/td&gt;
&lt;td&gt;더 많을 수 있음&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;본질&lt;/td&gt;
&lt;td&gt;evaluation과 improvement를 분리&lt;/td&gt;
&lt;td&gt;evaluation과 improvement를 결합&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;이 표를 문장으로 바꾸면 다음과 같다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;policy iteration은 &lt;strong&gt;정확한 현재 해석 후 개선&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;value iteration은 &lt;strong&gt;부분적 해석과 즉각적 greedy update&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;둘 다 GPI의 구현 방식이다&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;문제&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;문제&lt;/mark&gt;&lt;/h1&gt;
&lt;h2 id=&quot;문제-1.-한-step-policy-evaluation&quot;&gt;문제 1. 한 step policy evaluation&lt;/h2&gt;
&lt;h3 id=&quot;문제-1&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;다음 MDP를 보자.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;상태: &lt;span class=&quot;math inline&quot;&gt;\(s_1, s_2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;discount factor: &lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.8\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;deterministic policy &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(s_1)=a_1\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(s_2)=a_1\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;전이와 보상&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(s_2,3 \mid s_1,a_1)=1\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(s_1,1 \mid s_2,a_1)=1\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;초기 value&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_0(s_1)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_0(s_2)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(s_1)\)&lt;/span&gt;을 계산하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(s_2)\)&lt;/span&gt;를 계산하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(s_1)\)&lt;/span&gt;을 계산하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(s_2)\)&lt;/span&gt;를 계산하라.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(s_1)=3+0.8V_0(s_2)=3\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(s_2)=1+0.8V_0(s_1)=1\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(s_1)=3+0.8V_1(s_2)=3+0.8\cdot1=3.8\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(s_2)=1+0.8V_1(s_1)=1+0.8\cdot3=3.4\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정답&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(s_1)=3\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(s_2)=1\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(s_1)=3.8\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(s_2)=3.4\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-2.-stochastic-policy-evaluation&quot;&gt;문제 2. stochastic policy evaluation&lt;/h2&gt;
&lt;h3 id=&quot;문제-2&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;상태는 하나 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;이다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;action: &lt;span class=&quot;math inline&quot;&gt;\(a_1,a_2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;policy
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(a_1\mid s)=0.3\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(a_2\mid s)=0.7\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.9\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;전이&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_1\)&lt;/span&gt;: 항상 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;로 돌아오고 reward &lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_2\)&lt;/span&gt;: 항상 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;로 돌아오고 reward &lt;span class=&quot;math inline&quot;&gt;\(5\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;현재 값&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_k(s)=10\)&lt;/span&gt;&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;Bellman expectation update로 &lt;span class=&quot;math inline&quot;&gt;\(V_{k+1}(s)\)&lt;/span&gt;를 계산하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a_1)\)&lt;/span&gt;과 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a_2)\)&lt;/span&gt;를 계산하라.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-1&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_{k+1}(s)=0.3(2+0.9\cdot10)+0.7(5+0.9\cdot10)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(=0.3(11)+0.7(14)=3.3+9.8=13.1\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a_1)=2+0.9\cdot10=11\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a_2)=5+0.9\cdot10=14\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정답&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_{k+1}(s)=13.1\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a_1)=11\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a_2)=14\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-3.-greedy-policy-improvement&quot;&gt;문제 3. greedy policy improvement&lt;/h2&gt;
&lt;h3 id=&quot;문제-3&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 두 action이 있다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.5\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;현재 value
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s_1)=8\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s_2)=4\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;전이&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_1\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.6\)&lt;/span&gt; 확률로 &lt;span class=&quot;math inline&quot;&gt;\(s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.4\)&lt;/span&gt; 확률로 &lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_2\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(1.0\)&lt;/span&gt; 확률로 &lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s,a_1)\)&lt;/span&gt;을 계산하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s,a_2)\)&lt;/span&gt;를 계산하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;greedy action을 구하라.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-2&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s,a_1)=0.6(2+0.5\cdot8)+0.4(0+0.5\cdot4)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(=0.6(6)+0.4(2)=3.6+0.8=4.4\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s,a_2)=1.0(3+0.5\cdot4)=3+2=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\max(4.4,5)=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정답&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s,a_1)=4.4\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s,a_2)=5\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;greedy action &lt;span class=&quot;math inline&quot;&gt;\(a_2\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-4.-two-array-update-한-번의-sweep&quot;&gt;문제 4. two-array update 한 번의 sweep&lt;/h2&gt;
&lt;h3 id=&quot;문제-4&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;상태&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(A,B,T\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;는 terminal state, &lt;span class=&quot;math inline&quot;&gt;\(V(T)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=1\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;policy&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(A)=right\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(B)=right\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;전이&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(A,right \rightarrow B\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(B,right \rightarrow T\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(5\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;초기값&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_0(A)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_0(B)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_0(T)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;한 번 sweep 후 &lt;span class=&quot;math inline&quot;&gt;\(V_1(A),V_1(B)\)&lt;/span&gt;를 구하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;두 번 sweep 후 &lt;span class=&quot;math inline&quot;&gt;\(V_2(A),V_2(B)\)&lt;/span&gt;를 구하라.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-3&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(A)=2+V_0(B)=2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(B)=5+V_0(T)=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(A)=2+V_1(B)=7\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(B)=5+V_1(T)=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정답&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_1(A)=2, V_1(B)=5\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_2(A)=7, V_2(B)=5\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-5.-in-place-update&quot;&gt;문제 5. in-place update&lt;/h2&gt;
&lt;h3 id=&quot;문제-5&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;문제 4와 같은 MDP를 사용한다.&lt;/p&gt;
&lt;p&gt;in-place update이며 방문 순서는 &lt;span class=&quot;math inline&quot;&gt;\(B \rightarrow A\)&lt;/span&gt;이다.&lt;/p&gt;
&lt;p&gt;초기값&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(A)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(B)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(T)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;먼저 &lt;span class=&quot;math inline&quot;&gt;\(B\)&lt;/span&gt; 업데이트 후 &lt;span class=&quot;math inline&quot;&gt;\(V(B)\)&lt;/span&gt;를 구하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;이어서 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;를 업데이트하라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;한 번의 sweep 결과 &lt;span class=&quot;math inline&quot;&gt;\((V(A),V(B))\)&lt;/span&gt;를 쓰라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;two-array 결과와 비교해 어떤 상태가 더 빨리 정보를 받는지 말하라.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-4&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(B)\leftarrow5+V(T)=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(A)\leftarrow2+V(B)=2+5=7\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정답&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(B)=5\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(A)=7\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;sweep 결과 &lt;span class=&quot;math inline&quot;&gt;\((7,5)\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;가 더 빨리 terminal 보상을 전달받는다&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-6.-value-iteration-한-번&quot;&gt;문제 6. value iteration 한 번&lt;/h2&gt;
&lt;h3 id=&quot;문제-6&quot;&gt;문제&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;상태 &lt;span class=&quot;math inline&quot;&gt;\(s_1,s_2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;action &lt;span class=&quot;math inline&quot;&gt;\(a_1,a_2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.9\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;전이&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1,a_1 \rightarrow s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1,a_2 \rightarrow s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(4\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2,a_1 \rightarrow s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2,a_2 \rightarrow s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;현재 value&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s_1)=5\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s_2)=10\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1\)&lt;/span&gt;에서 one-step lookahead 계산&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;에서 one-step lookahead 계산&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;새로운 &lt;span class=&quot;math inline&quot;&gt;\(V(s_1)\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;새로운 &lt;span class=&quot;math inline&quot;&gt;\(V(s_2)\)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-5&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_1,a_1)=1+0.9\cdot5=5.5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_1,a_2)=4+0.9\cdot10=13\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_2,a_1)=2+0.9\cdot5=6.5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_2,a_2)=3+0.9\cdot10=12\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_{new}(s_1)=\max(5.5,13)=13\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(V_{new}(s_2)=\max(6.5,12)=12\)&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-7.-greedy-policy-extraction&quot;&gt;문제 7. greedy policy extraction&lt;/h2&gt;
&lt;h3 id=&quot;문제-7&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;주어진 값&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V^*(A)=12\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V^*(B)=7\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V^*(T)=0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=1\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;상태 &lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;left → &lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(10\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;right → &lt;span class=&quot;math inline&quot;&gt;\(B\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(6\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;상태 &lt;span class=&quot;math inline&quot;&gt;\(B\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;left → &lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(8\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;right → &lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(5\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;에서 greedy action&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(B\)&lt;/span&gt;에서 greedy action&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;optimal policy&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-6&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(A\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;left &lt;span class=&quot;math inline&quot;&gt;\(=10\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;right &lt;span class=&quot;math inline&quot;&gt;\(=6+7=13\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;정답 &lt;span class=&quot;math inline&quot;&gt;\(right\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(B\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;left &lt;span class=&quot;math inline&quot;&gt;\(=8\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;right &lt;span class=&quot;math inline&quot;&gt;\(=5\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;정답 &lt;span class=&quot;math inline&quot;&gt;\(left\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi^*(A)=right\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi^*(B)=left\)&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-8.-policy-evaluation-고정점&quot;&gt;문제 8. policy evaluation 고정점&lt;/h2&gt;
&lt;h3 id=&quot;문제-8&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;상태 &lt;span class=&quot;math inline&quot;&gt;\(s_1,s_2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;전이&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1 \rightarrow s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(4\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2 \rightarrow s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;식&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_1)=4+0.5v_\pi(s_2)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_2)=2+0.5v_\pi(s_1)\)&lt;/span&gt;&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_1)\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_2)\)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-7&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_1)=4+0.5(2+0.5v_\pi(s_1))\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_1)=4+1+0.25v_\pi(s_1)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_1)=5+0.25v_\pi(s_1)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.75v_\pi(s_1)=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_1)=\frac{20}{3}\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s_2)=2+0.5\cdot\frac{20}{3}=\frac{16}{3}\)&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-9.-한-번의-policy-improvement&quot;&gt;문제 9. 한 번의 policy improvement&lt;/h2&gt;
&lt;h3 id=&quot;문제-9&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;주어진 값&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s_1)=9\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(V(s_2)=6\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.9\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_1\)&lt;/span&gt;: &lt;span class=&quot;math inline&quot;&gt;\(s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_2\)&lt;/span&gt;: &lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(5\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_1\)&lt;/span&gt;: &lt;span class=&quot;math inline&quot;&gt;\(s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(4\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_2\)&lt;/span&gt;: &lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_1,a_1), q(s_1,a_2)\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;(s_1)\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_2,a_1), q(s_2,a_2)\)&lt;/span&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;(s_2)\)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-8&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_1,a_1)=0+0.9\cdot9=8.1\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_1,a_2)=5+0.9\cdot6=10.4\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;(s_1)=a_2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_2,a_1)=4+0.9\cdot9=12.1\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(q(s_2,a_2)=1+0.9\cdot6=6.4\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi&amp;#39;(s_2)=a_1\)&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;문제-10.-policy-iteration-한-라운드&quot;&gt;문제 10. policy iteration 한 라운드&lt;/h2&gt;
&lt;h3 id=&quot;문제-10&quot;&gt;문제&lt;/h3&gt;
&lt;p&gt;초기 policy&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi_0(s_1)=a_1\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi_0(s_2)=a_2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;전이&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1,a_1 \rightarrow s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1,a_2 \rightarrow s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(4\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2,a_1 \rightarrow s_1\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2,a_2 \rightarrow s_2\)&lt;/span&gt;, reward &lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;정책 평가 식을 세워라.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{\pi_0}(s_1),v_{\pi_0}(s_2)\)&lt;/span&gt; 계산&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1\)&lt;/span&gt;에서 greedy action&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;에서 greedy action&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;개선된 policy&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;답-9&quot;&gt;답&lt;/h3&gt;
&lt;p&gt;정책 평가 식&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{\pi_0}(s_1)=2+0.5v_{\pi_0}(s_1)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{\pi_0}(s_2)=1+0.5v_{\pi_0}(s_2)\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;값 계산&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{\pi_0}(s_1)=4\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{\pi_0}(s_2)=2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;greedy 계산&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_1\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_1=2+0.5\cdot4=4\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_2=4+0.5\cdot2=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정답 &lt;span class=&quot;math inline&quot;&gt;\(a_2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(s_2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_1=3+0.5\cdot4=5\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(a_2=1+0.5\cdot2=2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;정답 &lt;span class=&quot;math inline&quot;&gt;\(a_1\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;개선된 policy&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi_1(s_1)=a_2\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi_1(s_2)=a_1\)&lt;/span&gt;&lt;/p&gt;</description>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/59</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/%EA%B0%95%ED%99%94%ED%95%99%EC%8A%B5-%EB%82%B4%EC%9A%A9-%EC%A0%95%EB%A6%AC-Lecture-45#entry59comment</comments>
      <pubDate>Sun, 15 Mar 2026 20:57:59 +0900</pubDate>
    </item>
    <item>
      <title>강화학습 내용 정리 (Lecture 1~3)</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/%EA%B0%95%ED%99%94%ED%95%99%EC%8A%B5-%EB%82%B4%EC%9A%A9-%EC%A0%95%EB%A6%AC-Lecture-13</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;26년 1학기 오민환 교수님 강화학습 기초 수업을 듣고 필기한 내용이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Lecture 1은 걍 수업 인트로니까 패스&lt;/p&gt;
&lt;h1 id=&quot;lecture-2&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;LECTURE 2&lt;/mark&gt;&lt;/h1&gt;
&lt;h1 id=&quot;multi-armed-bandit&quot;&gt;Multi-armed Bandit&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Multi-armed bandit 문제는 reinforcement learning에서 가장 단순한 형태의 의사결정 문제다. 여러 개의 선택지(arm)가 있고, 각 선택지는 보상을 발생시키는 확률 분포를 가진다. 목표는 &lt;b&gt;시간이 지나면서 총 보상을 최대화하는 arm 선택 전략을 찾는 것&lt;/b&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;multi-armed-bandit-문제의-설정&quot;&gt;1. Multi-armed Bandit 문제의 설정&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;슬롯머신이 여러 개 있다고 가정한다. 각 슬롯머신은 서로 다른 보상 분포를 가진다. 행동을 선택하면 보상이 즉시 관측된다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;중요한 특징:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;행동은 &lt;b&gt;미래 상태(state transition)&lt;/b&gt;에 영향을 주지 않는다.&lt;/li&gt;
&lt;li&gt;보상은 &lt;b&gt;지연되지 않는다.&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 일반적인 reinforcement learning보다 단순한 문제다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;예:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Arm 1 보상 기록 &lt;code&gt;1, 2, 0, 3, 1, 1, 2, 0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Arm 2 보상 기록 &lt;code&gt;50, 30, 0, 0, 0, 0, 0, 0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;평균 보상:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Arm1: 1.25&lt;/li&gt;
&lt;li&gt;Arm2: 10.0&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;겉보기에는 Arm2가 좋아 보인다. 하지만 실제 분포는 아직 모른다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 상황에서 &lt;b&gt;다음에 어떤 arm을 선택할지 결정해야 한다.&lt;/b&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;k-armed-bandit-problem&quot;&gt;2. k-armed Bandit Problem&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;k개의 행동이 존재한다. 각 행동은 &lt;b&gt;기대 보상(expected reward)&lt;/b&gt;을 가진다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;기호 정의:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(A_t\)&lt;/span&gt; : 시간 &lt;span class=&quot;math inline&quot;&gt;\(t\)&lt;/span&gt;에서 선택된 행동&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_t\)&lt;/span&gt; : 시간 &lt;span class=&quot;math inline&quot;&gt;\(t\)&lt;/span&gt;에서 받은 보상&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;행동의 실제 가치: &lt;span class=&quot;math display&quot;&gt;\[ q^*(a) = \mathbb{E}[R_t \mid A_t = a] \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;하지만 실제 &lt;span class=&quot;math inline&quot;&gt;\(q^*(a)\)&lt;/span&gt;는 알 수 없다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;대신 다음을 사용한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[ Q_t(a) \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이는 시간 &lt;span class=&quot;math inline&quot;&gt;\(t\)&lt;/span&gt;에서의 &lt;b&gt;행동 가치 추정값&lt;/b&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;action-value-estimation&quot;&gt;3. Action-value Estimation&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;가장 자연스러운 방법은 &lt;b&gt;sample average&lt;/b&gt;다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[ Q_t(a) = \frac{\sum_{i=1}^{t-1} R_i \cdot \mathbf{1}_{A_i=a}} {\sum_{i=1}^{t-1} \mathbf{1}_{A_i=a}} \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;b&gt;그 행동을 했을 때 받은 보상의 평균&lt;/b&gt;이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;또는 초기값을 임의로 설정할 수도 있다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;exploration-vs-exploitation&quot;&gt;4. Exploration vs Exploitation&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;bandit 문제의 핵심 딜레마다.&lt;/p&gt;
&lt;h3 id=&quot;exploitation&quot; data-ke-size=&quot;size23&quot;&gt;Exploitation&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;현재 알고 있는 정보로 &lt;b&gt;가장 보상이 높을 것 같은 행동 선택&lt;/b&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[ A_t = \arg\max_a Q_t(a) \]&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;exploration&quot; data-ke-size=&quot;size23&quot;&gt;Exploration&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;다른 행동을 시도해서 &lt;b&gt;더 좋은 행동이 있는지 탐색&lt;/b&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;문제는&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;exploration을 너무 많이 하면 보상이 낮아짐&lt;/li&gt;
&lt;li&gt;exploitation만 하면 더 좋은 행동을 못 찾음&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;greedy-policy&quot;&gt;5. Greedy Policy&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;가장 단순한 전략이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[ A_t = \arg\max_a Q_t(a) \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;항상 현재 가장 좋은 arm을 선택한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;문제:&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;초기에 잘못된 추정을 하면 &lt;b&gt;영원히 잘못된 arm을 선택할 수 있다.&lt;/b&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;&amp;epsilon;-greedy-strategy&quot;&gt;6. &amp;epsilon;-Greedy Strategy&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이를 해결하는 방법이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;규칙:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;확률 &lt;span class=&quot;math inline&quot;&gt;\(1-\epsilon\)&lt;/span&gt; greedy action 선택&lt;/li&gt;
&lt;li&gt;확률 &lt;span class=&quot;math inline&quot;&gt;\(\epsilon\)&lt;/span&gt; random action 선택&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 가끔씩 exploration을 강제로 수행한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;특징:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;모든 행동이 무한히 샘플링된다.&lt;/li&gt;
&lt;li&gt;장기적으로 optimal arm을 찾을 가능성이 높다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;실험 결과:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\epsilon = 0.1\)&lt;/span&gt; 빠르게 성능이 증가&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\epsilon = 0.01\)&lt;/span&gt; 더 느리지만 결국 더 좋은 성능 가능&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;571&quot; data-origin-height=&quot;247&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ybI6F/dJMcagrdR0K/mDR0D0SJllf2z9xgvk5Nk1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ybI6F/dJMcagrdR0K/mDR0D0SJllf2z9xgvk5Nk1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ybI6F/dJMcagrdR0K/mDR0D0SJllf2z9xgvk5Nk1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FybI6F%2FdJMcagrdR0K%2FmDR0D0SJllf2z9xgvk5Nk1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;571&quot; height=&quot;247&quot; data-origin-width=&quot;571&quot; data-origin-height=&quot;247&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;리워드에 노이즈가 많이 껴있을수록(=variance가 클수록) optimal action을 찾는데 더 많은 exploration이 필요함&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;incremental-update&quot;&gt;7. Incremental Update&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;단순 평균 방식은 문제가 있다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;시간이 커질수록&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;메모리 증가&lt;/li&gt;
&lt;li&gt;계산량 증가&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그래서 &lt;b&gt;incremental update&lt;/b&gt;를 사용한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;기존 평균: &lt;span class=&quot;math display&quot;&gt;\[ Q_n = \frac{R_1 + \dots + R_{n-1}}{n-1} \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;incremental form: &lt;span class=&quot;math display&quot;&gt;\[ Q_{n+1} = Q_n + \frac{1}{n}(R_n - Q_n) \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(Q_{n+1}= \frac{R_1 + \dots + R_{n}}{n} = \frac{R_1 + \dots + R_{n}}{n-1}*\frac{n-1}{n} = (\frac{R_1 + \dots + R_{n-1}}{n-1} + \frac{R_n}{n-1})*\frac{n-1}{n}\)&lt;/span&gt; &lt;span class=&quot;math inline&quot;&gt;\(= (Q_n + \frac{R_n}{n-1})*\frac{n-1}{n} = Q_n*\frac{n-1}{n} + \frac{R_n}{n} = Q_n + \frac{1}{n}(R_n - Q_n)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;일반형: &lt;span class=&quot;math display&quot;&gt;\[ \text{NewEstimate} = \text{OldEstimate} + \text{StepSize} \cdot (\text{Target} - \text{OldEstimate}) \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;장점:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;constant memory&lt;/li&gt;
&lt;li&gt;constant computation&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;simple-bandit-algorithm&quot;&gt;8. Simple Bandit Algorithm&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;알고리즘 구조:&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;초기화 Q(a) = 0 N(a) = 0&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;반복:&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;&amp;epsilon;-greedy로 action 선택&lt;/li&gt;
&lt;li&gt;reward 관측&lt;/li&gt;
&lt;li&gt;count 업데이트: N(A) = N(A) + 1&lt;/li&gt;
&lt;li&gt;value update: Q(A) = Q(A) + (1/N(A)) [R - Q(A)]&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;764&quot; data-origin-height=&quot;513&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/FEHQh/dJMcajnSCSh/bKyoLLTHjkU20LUNRE84EK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/FEHQh/dJMcajnSCSh/bKyoLLTHjkU20LUNRE84EK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/FEHQh/dJMcajnSCSh/bKyoLLTHjkU20LUNRE84EK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FFEHQh%2FdJMcajnSCSh%2FbKyoLLTHjkU20LUNRE84EK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;764&quot; height=&quot;513&quot; data-origin-width=&quot;764&quot; data-origin-height=&quot;513&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;step-size와-convergence&quot;&gt;9. Step Size와 Convergence&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;일반 업데이트:&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[ Q_{n+1}(a) = Q_n(a) + \alpha_n(a)(R_n(a) - Q_n(a)) \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;수렴 조건:&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\sum_{n=1}^{\infty} \alpha_n(a) = \infty\)&lt;/span&gt;: step size는 충분히 커야 초기 영향 제거 가능&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\sum_{n=1}^{\infty} \alpha_n(a)^2 &amp;lt; \infty\)&lt;/span&gt;: 결국 작아져야 수렴 가능&lt;/li&gt;
&lt;/ol&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;optimistic-initial-values&quot;&gt;10. Optimistic Initial Values&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;실제 평균보다 초깃값을 크게 설정(optimistic)하면 &amp;epsilon;-greedy 없이도 탐색을 유도할 수 있다.&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;752&quot; data-origin-height=&quot;357&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/VlqCn/dJMcahDEqXn/Q4NvV4DichANcO8LvpkwIK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/VlqCn/dJMcahDEqXn/Q4NvV4DichANcO8LvpkwIK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/VlqCn/dJMcahDEqXn/Q4NvV4DichANcO8LvpkwIK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FVlqCn%2FdJMcahDEqXn%2FQ4NvV4DichANcO8LvpkwIK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;752&quot; height=&quot;357&quot; data-origin-width=&quot;752&quot; data-origin-height=&quot;357&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;효과:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;초기 행동들이 과대평가됨&lt;/li&gt;
&lt;li&gt;exploration이 자연스럽게 발생(처음에 가장 좋아보이는 행동을 하는데, 과대평가되었으므로 행동한 뒤 그 행동의 예측된 가치가 내려감. 그럼 다음으로 좋아보이는 행동을 하는데, 비슷한 현상이 계속 일어남. 그래서 위 사진 보면 파란색 선이 step=3 정도일 때 optimal action이 탁 튀고 그 뒤에 내려가는 것임!)&lt;/li&gt;
&lt;li&gt;epsilon greedy보다 더 좋은 결과를 도출하기도 함. 신기방기~&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;upper-confidence-bound-ucb&quot;&gt;11. Upper Confidence Bound (UCB)&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;epsilon;-greedy의 문제: random exploration은 비효율적이다. 그래서 &lt;b&gt;uncertainty 기반 탐색&lt;/b&gt;을 사용한다. 좋은 선택일 가능성이 높은 애들을 대상으로 non greedy action을 취해보자! 근데 좋은 선택일 포텐셜을 어케 알지?&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;선택 규칙: &lt;span class=&quot;math display&quot;&gt;\[ A_t = \arg\max_a \left[ Q_t(a) + c\sqrt{\frac{\ln t}{N_t(a)}} \right] \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;여기서&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(Q_t(a)\)&lt;/span&gt; : 추정 평균 보상&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(N_t(a)\)&lt;/span&gt; : 행동 선택 횟수&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(c\)&lt;/span&gt; : exploration 정도&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;의미:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;많이 선택된 행동 &amp;rarr; exploration term(루트 어쩌고) 감소&lt;/li&gt;
&lt;li&gt;적게 선택된 행동 &amp;rarr; exploration term 증가&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그래서 &lt;b&gt;불확실성이 큰 arm을 우선적으로 탐색&lt;/b&gt;한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;실험 결과: UCB는 &amp;epsilon;-greedy보다 평균 보상이 높게 나타난다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;gradient-bandit-algorithm&quot;&gt;12. Gradient Bandit Algorithm&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;각 행동에 대해 &lt;b&gt;numerical preference&lt;/b&gt; &lt;span class=&quot;math inline&quot;&gt;\(H_t(a)\)&lt;/span&gt;을 학습한다. 큰 값일수록 선택 확률 증가.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;선택 확률:&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[ \pi_t(a) = \frac{e^{H_t(a)}} {\sum_b e^{H_t(b)}} \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;softmax distribution 사용.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;업데이트:&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;선택된 행동: &lt;span class=&quot;math inline&quot;&gt;\(H_{t+1}(A_t) = H_t(A_t) + \alpha (R_t - \bar{R}_t)(1-\pi_t(A_t))\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;여기서 &lt;span class=&quot;math inline&quot;&gt;\(\bar{R}_t\)&lt;/span&gt;는 평균 보상이다.&lt;/li&gt;
&lt;li&gt;만약 R_t가 평균 보상보다 크면 &lt;span class=&quot;math inline&quot;&gt;\(H_{t+1}(A_t)\)&lt;/span&gt;는 커질 것&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;다른 행동: &lt;span class=&quot;math inline&quot;&gt;\(H_{t+1}(a) = H_t(a) - \alpha (R_t - \bar{R}_t)\pi_t(a)\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;만약 R_t가 평균 보상보다 크면 &lt;span class=&quot;math inline&quot;&gt;\(H_{t+1}(a)\)&lt;/span&gt;는 내려갈 것. 그 결과, A_t를 더 자주 고르게 됨.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉, &lt;b&gt;&amp;ldquo;이번에 고른 행동이 평균보다 좋았는가/나빴는가&amp;rdquo;라는 정보를 정책 전체에 반영하는 것&lt;/b&gt;&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;(1- \(\pi\) )가 어디서 나오나&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;softmax 정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi_t(a)=\frac{e^{H_t(a)}}{\sum_b e^{H_t(b)}}\)&lt;/span&gt; 에 대해 &lt;span class=&quot;math inline&quot;&gt;\(\log \pi_t(A_t)=H_t(A_t)-\log\sum_b e^{H_t(b)}\)&lt;/span&gt; 를 미분해 얻은 &lt;span class=&quot;math inline&quot;&gt;\(\frac{\partial \log \pi_t(A_t)}{\partial H_t(a)}=\mathbf{1}_{\{a=A_t\}}-\pi_t(a)\)&lt;/span&gt; 를 policy gradient 업데이트에 넣어 얻어진 결과이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;softmax 정의에 로그를 취하면 &lt;span class=&quot;math inline&quot;&gt;\(\log \pi_t(A_t)=\log\left(\frac{e^{H_t(A_t)}}{\sum_b e^{H_t(b)}}\right)\)&lt;/span&gt; 이고 정리하면 &lt;span class=&quot;math inline&quot;&gt;\(\log \pi_t(A_t)=H_t(A_t)-\log\left(\sum_b e^{H_t(b)}\right)\)&lt;/span&gt; 이다. 이제 이를 &lt;span class=&quot;math inline&quot;&gt;\(H_t(a)\)&lt;/span&gt;에 대해 미분하면 &lt;span class=&quot;math inline&quot;&gt;\(\frac{\partial \log \pi_t(A_t)}{\partial H_t(a)}=\mathbf{1}_{\{a=A_t\}}-\pi_t(a)\)&lt;/span&gt; 가 된다. 이 결과가 gradient bandit 알고리즘의 핵심이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 값을 업데이트 식에 대입하면 &lt;span class=&quot;math inline&quot;&gt;\(H_{t+1}(a)=H_t(a)+\alpha (R_t-\bar R_t)\left(\mathbf{1}_{\{a=A_t\}}-\pi_t(a)\right)\)&lt;/span&gt; 이다. 이제 경우를 나누어 해석한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;선택된 행동 &lt;span class=&quot;math inline&quot;&gt;\(a=A_t\)&lt;/span&gt;이면 &lt;span class=&quot;math inline&quot;&gt;\(\mathbf{1}_{\{a=A_t\}}=1\)&lt;/span&gt; 이므로 &lt;span class=&quot;math inline&quot;&gt;\(H_{t+1}(A_t)=H_t(A_t)+\alpha (R_t-\bar R_t)(1-\pi_t(A_t))\)&lt;/span&gt; 이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;선택되지 않은 행동 &lt;span class=&quot;math inline&quot;&gt;\(a\neq A_t\)&lt;/span&gt;이면 &lt;span class=&quot;math inline&quot;&gt;\(\mathbf{1}_{\{a=A_t\}}=0\)&lt;/span&gt; 이므로 &lt;span class=&quot;math inline&quot;&gt;\(H_{t+1}(a)=H_t(a)-\alpha (R_t-\bar R_t)\pi_t(a)\)&lt;/span&gt; 이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;gradient의 형태 &lt;span class=&quot;math inline&quot;&gt;\(\mathbf{1}_{\{a=A_t\}}-\pi_t(a)\)&lt;/span&gt; 는 확률 질량을 재분배하는 구조를 가진다. 모든 행동에 대해 합을 계산하면 &lt;span class=&quot;math inline&quot;&gt;\(\sum_a (\mathbf{1}_{\{a=A_t\}}-\pi_t(a))=1-\sum_a \pi_t(a)\)&lt;/span&gt; 이고 softmax 확률의 합은 &lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;이므로 결과는 &lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;이다. 한 행동의 preference가 증가하면 다른 행동 쪽에서 동일한 양이 감소하도록 되어 있다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;보상이 평균보다 큰 경우 &lt;span class=&quot;math inline&quot;&gt;\(R_t-\bar R_t&amp;gt;0\)&lt;/span&gt;이면 선택된 행동의 preference는 증가하고 다른 행동들의 preference는 감소한다. 확률이 선택된 행동 쪽으로 이동한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;보상이 평균보다 작은 경우 &lt;span class=&quot;math inline&quot;&gt;\(R_t-\bar R_t&amp;lt;0\)&lt;/span&gt;이면 선택된 행동의 preference는 감소하고 다른 행동들의 preference는 증가한다. 확률이 다른 행동 쪽으로 이동한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;baseline &lt;span class=&quot;math inline&quot;&gt;\(\bar R_t\)&lt;/span&gt;를 사용하는 이유는 &lt;span class=&quot;math inline&quot;&gt;\(R_t-\bar R_t\)&lt;/span&gt;가 &amp;ldquo;이번 보상이 평소 대비 얼마나 좋은가&amp;rdquo;만 남기는 값이기 때문이다. 이를 사용하면 업데이트의 분산이 감소한다. 환경의 보상 규모와 실제 선택의 품질을 구분하기 쉬워진다. baseline은 gradient의 기대값을 바꾸지 않으며 학습 방향은 유지되고 분산만 감소한다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;non-stationary-rewards&quot;&gt;13. Non-stationary Rewards&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;지금까지 가정: &lt;b&gt;reward distribution이 고정&lt;/b&gt; 하지만 현실에서는 사용자 선호 변화, 환경 변화 등으로 reward가 변한다. 이 경우, sample-average 방식은 문제가 생긴다. 대신 &lt;b&gt;constant step size&lt;/b&gt; 사용한다. &lt;span class=&quot;math display&quot;&gt;\[ Q_{n+1}(a) = Q_n(a) + \alpha (R_n(a) - Q_n(a)) \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 방식은 &lt;b&gt;최근 reward에 더 큰 가중치&lt;/b&gt;를 둔다. (기존에는 &lt;span class=&quot;math inline&quot;&gt;\(\alpha_n(a)\)&lt;/span&gt;를 써서 n에 대한 decreasing function을 썼었음. 이제는 constant를 씀)&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;lecture-3&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;LECTURE 3&lt;/mark&gt;&lt;/h1&gt;
&lt;h1 id=&quot;finite-markov-decision-processes&quot;&gt;Finite Markov Decision Processes&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Markov Decision Process(MDP)는 reinforcement learning에서 &lt;b&gt;순차적 의사결정(sequential decision making)&lt;/b&gt;을 모델링하는 고전적인 수학적 프레임워크다. Multi-armed bandit과 달리, 행동(action)은 &lt;b&gt;즉시 보상뿐 아니라 미래 상태(state)&lt;/b&gt;에도 영향을 준다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;agentenvironment-interface&quot;&gt;1. Agent&amp;ndash;Environment Interface&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;강화학습은 agent와 environment의 상호작용으로 구성된다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;각 시간 단계 &lt;span class=&quot;math inline&quot;&gt;\(t = 0,1,2,...\)&lt;/span&gt;에서 다음 과정이 반복된다.&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;agent는 상태 &lt;span class=&quot;math inline&quot;&gt;\(S_t\)&lt;/span&gt;를 관측한다.&lt;/li&gt;
&lt;li&gt;agent는 행동 &lt;span class=&quot;math inline&quot;&gt;\(A_t\)&lt;/span&gt;를 선택한다.&lt;/li&gt;
&lt;li&gt;환경은 보상 &lt;span class=&quot;math inline&quot;&gt;\(R_{t+1}\)&lt;/span&gt;과 다음 상태 &lt;span class=&quot;math inline&quot;&gt;\(S_{t+1}\)&lt;/span&gt;을 생성한다.&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 상호작용은 다음과 같은 trajectory를 만든다. (기호가 이제부터 엄청 많이 나오니 딱 기억하고 가시길 걍 그러려니 하고 넘기다가 나중에 뇌정지옴)&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math display&quot;&gt;\[ S_0, A_0, R_1, S_1, A_1, R_2, S_2, ... \]&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 &lt;b&gt;state &amp;rarr; action &amp;rarr; reward &amp;rarr; next state&lt;/b&gt; 구조가 반복된다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;dynamics-of-mdp&quot;&gt;2. Dynamics of MDP&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MDP는 환경의 동작을 &lt;b&gt;확률 모델&lt;/b&gt;로 정의한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;dynamic function p: &lt;span class=&quot;math inline&quot;&gt;\(p(s', r | s, a)\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 행동 &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;를 했을 때 다음 상태 &lt;span class=&quot;math inline&quot;&gt;\(s'\)&lt;/span&gt;, 보상 &lt;span class=&quot;math inline&quot;&gt;\(r\)&lt;/span&gt;이 발생할 &lt;b&gt;확률&lt;/b&gt;이다.&lt;/li&gt;
&lt;li&gt;이따 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;가 나오는데 헷갈리면 안된다. p는 s랑 a를 조건부로 받고, &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;는 s만 조건부로 받는다&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정식 정의: &lt;span class=&quot;math inline&quot;&gt;\(p(s', r|s,a) = P(S_t=s', R_t=r \mid S_{t-1}=s, A_{t-1}=a)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 &lt;b&gt;state transition과 reward가 동시에 정의된 확률 모델&lt;/b&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;markov-property&quot;&gt;3. Markov Property&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Markov property:&lt;/p&gt;
&lt;blockquote data-ke-style=&quot;style1&quot;&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;미래는 현재 상태가 주어지면 과거와 독립이다.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;수식: &lt;span class=&quot;math inline&quot;&gt;\(P(S_t=s', R_t=r \mid S_{t-1}=s, A_{t-1}=a) = P(S_t=s', R_t=r \mid S_0,A_0,...,S_{t-1}=s,A_{t-1}=a)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;만 알면 다음에 뭐가 일어날지 알 수 있다. 따라서 전체 history가 필요 없다. 현재 state만 알면 된다. 즉 state는 &lt;b&gt;past의 sufficient statistic&lt;/b&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;state-transition-and-reward-model&quot;&gt;4. State Transition and Reward Model&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Dynamics로부터 여러 중요한 quantity를 정의할 수 있다.&lt;/p&gt;
&lt;h3 id=&quot;state-transition-probability&quot; data-ke-size=&quot;size23&quot;&gt;State transition probability&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(s'|s,a) = P(S_t=s' \mid S_{t-1}=s, A_{t-1}=a) = \sum_r p(s',r|s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;expected-reward-of-stateaction&quot; data-ke-size=&quot;size23&quot;&gt;Expected reward of state&amp;ndash;action&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(s,a) = E[R_t \mid S_{t-1}=s, A_{t-1}=a] = \Sigma_r r \Sigma_{s'} p(s', r|s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;expected-reward-for-transition&quot; data-ke-size=&quot;size23&quot;&gt;Expected reward for transition&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(s,a,s') = E[R_t \mid S_{t-1}=s, A_{t-1}=a, S_t=s'] = \Sigma_r r \frac{p(s', r| s,a)}{p(s'|s,a)}\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 값들은 환경 모델을 완전히 기술한다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;boundary-between-agent-and-environment&quot;&gt;5. Boundary Between Agent and Environment&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MDP에서 agent와 environment의 경계는 &lt;b&gt;물리적 경계와 다를 수 있다&lt;/b&gt;.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;예: 로봇 시스템의 muscles, skeleton 등은 agent가 아니라 &lt;b&gt;environment의 일부&lt;/b&gt;로 모델링될 수 있다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MDP 관점에서 environment는 agent가 임의로 바꿀 수 없는 모든 것 이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;reward-hypothesis&quot;&gt;6. Reward Hypothesis&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;강화학습의 기본 가설 Reward hypothesis: agent의 목표는 &lt;b&gt;누적 보상(cumulative reward)&lt;/b&gt;의 기대값을 최대화하는 것이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 reward signal이 &lt;b&gt;목표(goal)&lt;/b&gt;를 정확히 표현해야 한다. 잘못 설계된 reward는 잘못된 행동을 학습하게 만든다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;return&quot;&gt;7. Return&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;agent의 목표는 장기적으로 얻는 총 reward를 최대화하는 것이다. 이 누적 보상을 &lt;b&gt;return&lt;/b&gt;이라 한다.&lt;/p&gt;
&lt;h3 id=&quot;episodic-task&quot; data-ke-size=&quot;size23&quot;&gt;Episodic task&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_t = R_{t+1}+R_{t+2}+...+R_T\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;continuing-task&quot; data-ke-size=&quot;size23&quot;&gt;Continuing task&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;종료가 없는 경우 discount factor &lt;span class=&quot;math inline&quot;&gt;\(\gamma\)&lt;/span&gt;를 사용한다. &lt;span class=&quot;math inline&quot;&gt;\(G_t = R_{t+1}+\gamma R_{t+2}+\gamma^2 R_{t+3}+...\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_t\)&lt;/span&gt;가 아니라 &lt;span class=&quot;math inline&quot;&gt;\(R_{t+1}\)&lt;/span&gt;부터 시작하는 걸로 정의했다는 점 기억!!&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;또는 &lt;span class=&quot;math inline&quot;&gt;\(G_t = \sum_{k=0}^{\infty} \gamma^k R_{t+k+1}\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;여기서 &lt;span class=&quot;math inline&quot;&gt;\(\gamma \in [0,1]\)&lt;/span&gt;는 &lt;b&gt;discount rate&lt;/b&gt;다.&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma\)&lt;/span&gt; 작음 &amp;rarr; 미래 보상 중요도 감소&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma\)&lt;/span&gt; 큼 &amp;rarr; 미래 보상 중요도 증가&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;policies&quot;&gt;8. Policies&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;policy는 상태에서 행동을 선택하는 규칙이다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정의: &lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;의미: 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;에서 행동 &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;를 선택할 확률&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;p랑 잘 구분해야함. p(s&amp;rsquo;, r|s, a)라서 액션까지 조건부에 들어가있음.&lt;/li&gt;
&lt;li&gt;상태 s에서 액션 a를 선택하고, s랑 a가 미래의 state랑 reward를 결정하는 상황이다.&lt;/li&gt;
&lt;li&gt;초기 상태 s가 주어졌을 때 &lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s)\)&lt;/span&gt; 확률로 액션이 선택되고 s랑 a가 정해졌으니까 p(s&amp;rsquo;, r|s, a) 확률로 미래의 state랑 reward가 결정된다고 생각하면 됨.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;deterministic-policy&quot; data-ke-size=&quot;size23&quot;&gt;Deterministic policy&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;특정 행동을 항상 선택 &lt;span class=&quot;math inline&quot;&gt;\(\pi(a_0|s)=1\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;stochastic-policy&quot; data-ke-size=&quot;size23&quot;&gt;Stochastic policy&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;확률적으로 행동 선택 &lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s) \in [0,1]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;value-functions&quot;&gt;9. Value Functions&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;value function은 상태가 얼마나 좋은지 평가한다.&lt;/p&gt;
&lt;h3 id=&quot;state-value-function&quot; data-ke-size=&quot;size23&quot;&gt;State-value function&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s) = E_\pi[G_t | S_t=s] = E_\pi[\sum_{k=0}^{\infty} \gamma^k R_{t+k+1} \mid S_t=s]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;action-value-function&quot; data-ke-size=&quot;size23&quot;&gt;Action-value function&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a) = E_\pi[G_t | S_t=s, A_t=a] = E_\pi[\sum_{k=0}^{\infty} \gamma^k R_{t+k+1} \mid S_t=s, A_t = a]\)&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)\)&lt;/span&gt; : 상태 가치&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)\)&lt;/span&gt; : 상태-행동 가치&lt;/li&gt;
&lt;li&gt;이것도 나중에 기호가 많아지면 말도 안되게 헷갈리니까 꼭 머리에 집어넣기&lt;/li&gt;
&lt;li&gt;v는 s만 조건부로 받으니까 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;랑 조합이 잘 맞고 q는 s, a 다 조건부로 받으니까 &lt;span class=&quot;math inline&quot;&gt;\(p\)&lt;/span&gt;랑 궁합이 좋다&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;bellman-equation&quot;&gt;10. Bellman Equation&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;value function은 재귀적 구조를 가진다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Bellman equation:&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_{\pi}(s) := E_{\pi}[G_t \mid S_t=s] = E_{\pi}[R_{t+1}+\gamma G_{t+1} \mid S_t=s]\)&lt;/span&gt; &lt;span class=&quot;math inline&quot;&gt;\(= \sum_a \pi(a|s)\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma E_{\pi}[G_{t+1}\mid S_{t+1}=s']\right]\)&lt;/span&gt; &lt;span class=&quot;math inline&quot;&gt;\(= \sum_a \pi(a|s)\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma v_{\pi}(s')\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;의미: state value는 (1) 행동 선택 (2) 다음 상태 (3) 보상의 평균값으로 계산된다.&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;이게 어떻게 이렇게 유도되었을까?&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;state s가 주어지면 (1) Action a가 결정되고, 그럼 (2) 미래 state s&amp;rsquo;랑 r이 결정되는 구조를 잘 따라가면 된다. ## 1. 행동 &lt;span class=&quot;math inline&quot;&gt;\(A_t\)&lt;/span&gt; 에 대해 조건을 분해&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(S_t=s\)&lt;/span&gt;일 때 정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;는 행동 &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;를 확률 &lt;span class=&quot;math inline&quot;&gt;\(\pi(a|s)\)&lt;/span&gt;로 선택한다.&lt;br /&gt;따라서 조건부 기대를 행동에 대해 먼저 분해한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s] = \sum_a \pi(a|s)\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s, A_t=a]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;다음-상태와-보상-s_t1r_t1-에-대해-다시-분해&quot; data-ke-size=&quot;size26&quot;&gt;2. 다음 상태와 보상 &lt;span class=&quot;math inline&quot;&gt;\((S_{t+1},R_{t+1})\)&lt;/span&gt; 에 대해 다시 분해&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MDP에서는 현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;와 행동 &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;가 주어지면 다음 상태와 보상은 &lt;span class=&quot;math inline&quot;&gt;\(p(s',r|s,a)\)&lt;/span&gt;로 결정된다. &lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s, A_t=a] = \sum_{s'}\sum_r p(s',r|s,a)\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;조건-안의-r_t1-은-이미-r로-고정됨&quot; data-ke-size=&quot;size26&quot;&gt;3. 조건 안의 &lt;span class=&quot;math inline&quot;&gt;\(R_{t+1}\)&lt;/span&gt; 은 이미 &lt;span class=&quot;math inline&quot;&gt;\(r\)&lt;/span&gt;로 고정됨&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;조건에 &lt;span class=&quot;math inline&quot;&gt;\(R_{t+1}=r\)&lt;/span&gt;이 포함되어 있으므로 기대값 내부에서 &lt;span class=&quot;math inline&quot;&gt;\(R_{t+1}\)&lt;/span&gt;은 상수 &lt;span class=&quot;math inline&quot;&gt;\(r\)&lt;/span&gt;이 된다. &lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r] = r+\gamma \mathbb E_\pi[G_{t+1}\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;markov-성질&quot; data-ke-size=&quot;size26&quot;&gt;4. Markov 성질&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MDP에서는 미래 return &lt;span class=&quot;math inline&quot;&gt;\(G_{t+1}\)&lt;/span&gt;의 분포가 과거 전체가 아니라 현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(S_{t+1}=s'\)&lt;/span&gt;에만 의존한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[G_{t+1}\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r] = \mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s, A_t=a] = \sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma \mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이를 1번 식에 다시 대입하면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s] = \sum_a \pi(a|s)\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma \mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;value-function으로-표현&quot; data-ke-size=&quot;size26&quot;&gt;5. value function으로 표현&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\mathbb E_\pi[G_t\mid S_t=s]\)&lt;/span&gt;이므로 &lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']=v_\pi(s')\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_a \pi(a|s)\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma v_\pi(s')\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 식이 &lt;b&gt;Bellman expectation equation&lt;/b&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;핵심-요약&quot; data-ke-size=&quot;size26&quot;&gt;핵심 요약&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Iterated Expectation 2번 활용한건데 표현이 많으니까 완전 너무 헷갈림 ㅠ&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E[X\mid S_t=s] = \sum_a P(A_t=a\mid S_t=s)\mathbb E[X\mid S_t=s,A_t=a]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E[X\mid S_t=s,A_t=a] = \sum_{s',r} p(s',r\mid s,a)\mathbb E[X\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;여기서 &lt;span class=&quot;math inline&quot;&gt;\(X=R_{t+1}+\gamma G_{t+1}\)&lt;/span&gt; 를 대입하여 전개한 것이다.&lt;/p&gt;
&lt;/details&gt;
&lt;div style=&quot;border: 1px solid #e6e6e6; border-radius: 10px; background: #ffffff; padding: 14px 16px; margin: 18px 0;&quot;&gt;
&lt;div style=&quot;display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 16px; color: #111; margin: 0 0 12px 0;&quot;&gt;&lt;span style=&quot;display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: #f2f2f2; font-size: 14px; flex: 0 0 auto;&quot;&gt;✏️&lt;/span&gt;&lt;span&gt;Note &amp;middot; Action-value Bellman Equation&lt;/span&gt;&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;수업시간에 언급되지는 않았지만 q도 비슷하게 전개할 수 있다 &lt;span class=&quot;math display&quot;&gt;\[q_\pi(s,a)=\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma\sum_{a'}\pi(a'|s')q_\pi(s',a')\right]\]&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;details&gt;
&lt;summary&gt;Action-value Bellman Expectation Equation은 어떻게 유도되었을까?&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;먼저 action-value function 정의&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\mathbb E_\pi[G_t \mid S_t=s, A_t=a]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;return 정의&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_t=R_{t+1}+\gamma G_{t+1}\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s,A_t=a]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;다음-상태와-보상에-대해-분해&quot; data-ke-size=&quot;size26&quot;&gt;1. 다음 상태와 보상에 대해 분해&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MDP에서는 현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;와 행동 &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;가 주어지면&lt;br /&gt;다음 상태와 보상은&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(s',r|s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;로 결정된다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서 기대값을 &lt;span class=&quot;math inline&quot;&gt;\((S_{t+1},R_{t+1})=(s',r)\)&lt;/span&gt;에 대해 분해하면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s'}\sum_r p(s',r|s,a)\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;보상은-이미-r로-고정됨&quot; data-ke-size=&quot;size26&quot;&gt;2. 보상은 이미 &lt;span class=&quot;math inline&quot;&gt;\(r\)&lt;/span&gt;로 고정됨&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;조건에 &lt;span class=&quot;math inline&quot;&gt;\(R_{t+1}=r\)&lt;/span&gt;이 포함되어 있으므로&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[R_{t+1}+\gamma G_{t+1}\mid \cdots]=r+\gamma\mathbb E_\pi[G_{t+1}\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;markov-성질-1&quot; data-ke-size=&quot;size26&quot;&gt;3. Markov 성질&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;미래 return은 현재 상태 &lt;span class=&quot;math inline&quot;&gt;\(S_{t+1}=s'\)&lt;/span&gt;만 알면 충분하다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[G_{t+1}\mid S_t=s,A_t=a,S_{t+1}=s',R_{t+1}=r]=\mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma\mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;다음-행동-선택&quot; data-ke-size=&quot;size26&quot;&gt;4. 다음 행동 선택&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;는 상태 &lt;span class=&quot;math inline&quot;&gt;\(s'\)&lt;/span&gt;에서 행동 &lt;span class=&quot;math inline&quot;&gt;\(a'\)&lt;/span&gt;를 확률 &lt;span class=&quot;math inline&quot;&gt;\(\pi(a'|s')\)&lt;/span&gt;로 선택한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']=\sum_{a'}\pi(a'|s')q_\pi(s',a')\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;최종-bellman-expectation-equation&quot; data-ke-size=&quot;size26&quot;&gt;5. 최종 Bellman expectation equation&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;위 식을 대입하면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma\sum_{a'}\pi(a'|s')q_\pi(s',a')\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;/details&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;유도는 진짜 (1) state가 정해짐 (2) 그에 따른 액션이 정해짐 (3) 리워드랑 새로운 state가 정해짐 (4) 그럼 또 액션을 정할 수 있음 -&amp;gt; 이거 잘 따라가면 쉽게 나온다. 근데 이 흐름을 잊으면 그냥 미친듯이 복잡해짐&lt;/p&gt;
&lt;div style=&quot;border: 1px solid #e6e6e6; border-radius: 10px; background: #ffffff; padding: 14px 16px; margin: 18px 0;&quot;&gt;
&lt;div style=&quot;display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 16px; color: #111; margin: 0 0 12px 0;&quot;&gt;&lt;span style=&quot;display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: #f2f2f2; font-size: 14px; flex: 0 0 auto;&quot;&gt;✏️&lt;/span&gt;&lt;span&gt;Note &amp;middot; Value function이랑 Action-value function 사이의 관계에 대한 식&lt;/span&gt;&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이거는 퀴즈로 나온 내용인데, Bellman Equation 전개하다보면 이렇게 q랑 v 사이 관계도 나온다. &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_a \pi(a|s)q_\pi(s,a)\)&lt;/span&gt; &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma v_\pi(s')\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;details&gt;
&lt;summary&gt;v = f(q)는 어떻게 유도되었을까?&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\mathbb E_\pi[G_t\mid S_t=s]\)&lt;/span&gt; , &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\mathbb E_\pi[G_t\mid S_t=s,A_t=a]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;조건부 기대의 tower property를 쓰면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\mathbb E_\pi[G_t\mid S_t=s]=\sum_a P(A_t=a\mid S_t=s)\mathbb E_\pi[G_t\mid S_t=s,A_t=a]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정책의 정의에 의해 &lt;span class=&quot;math inline&quot;&gt;\(P(A_t=a\mid S_t=s)=\pi(a|s)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그리고 action-value 정의에 의해 &lt;span class=&quot;math inline&quot;&gt;\(\mathbb E_\pi[G_t\mid S_t=s,A_t=a]=q_\pi(s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_a \pi(a|s)q_\pi(s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;/details&gt;&lt;details&gt;
&lt;summary&gt;q = f(v)는 어떻게 유도되었을까?&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Action-value Bellman Expectation Equation은 어떻게 유도되었을까? 토글을 펼쳐본 다음에, 3. Markov 성질까지 쭉 따라가보자.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;여기서 state-value function 정의에 의해 &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s')=\mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']\)&lt;/span&gt; 이므로&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이를 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma\mathbb E_\pi[G_{t+1}\mid S_{t+1}=s']\right]\)&lt;/span&gt;에 대입하면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma v_\pi(s')\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;bellman-backup&quot;&gt;11. Bellman Backup&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi (s)= \sum_a \pi(a|s)\sum_{s'}\sum_r p(s',r|s,a)\left[r+\gamma v_{\pi}(s')\right]\)&lt;/span&gt;이니까 Bellman equation은 value 정보를 &lt;b&gt;뒤에서 전파(backpropagation)&lt;/b&gt;한다고 할 수 있다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;leaf state의 value가 계산되면 그 값이 이전 state로 전달된다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 미래 state 가치가 현재 state 가치 계산에 사용된다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이를 &lt;b&gt;Bellman backup&lt;/b&gt;이라 한다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;gridworld-example&quot;&gt;12. Gridworld Example&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Gridworld는 MDP의 대표적인 예시다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;행동: north, south, east, west&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;보상:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;A &amp;rarr; A&amp;rsquo; : +10&lt;/li&gt;
&lt;li&gt;B &amp;rarr; B&amp;rsquo; : +5&lt;/li&gt;
&lt;li&gt;grid 밖 이동 : &amp;minus;1&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;상태 전이는 대부분 deterministic이다. 단 A와 B에서는 모든 행동이 각각 A&amp;rsquo;, B&amp;rsquo;로 이동한다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;optimal-policies&quot;&gt;13. Optimal Policies&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정책 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;와 &lt;span class=&quot;math inline&quot;&gt;\(\pi'\)&lt;/span&gt;가 있을 때&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s) \ge v_{\pi'}(s)\)&lt;/span&gt;이면 &lt;span class=&quot;math inline&quot;&gt;\(\pi\)&lt;/span&gt;가 더 좋은 정책이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;optimal-policy&quot; data-ke-size=&quot;size23&quot;&gt;Optimal policy&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;모든 상태에서 가장 좋은 정책&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;optimal-value-functions&quot; data-ke-size=&quot;size23&quot;&gt;Optimal value functions&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;state value &lt;span class=&quot;math inline&quot;&gt;\(v^*(s) = \max_\pi v_\pi(s)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;action value &lt;span class=&quot;math inline&quot;&gt;\(q^*(s,a) = \max_\pi q_\pi(s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그리고 &lt;span class=&quot;math inline&quot;&gt;\(q^*(s,a) = E[R_{t+1}+\gamma v^*(S_{t+1})]\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;bellman-optimality-equation&quot;&gt;14. Bellman Optimality Equation&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;최적 value function은 다음을 만족한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(s) = \max_a \sum_{s',r} p(s',r|s,a) [r+\gamma v^*(s')]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;의미: 현재 state에서 &lt;b&gt;최적 행동을 선택했을 때의 기대 return&lt;/b&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Bellman optimality equation의 특징&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;해가 &lt;b&gt;유일하다&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*\)&lt;/span&gt;를 알면 optimal policy를 쉽게 얻을 수 있다&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi^*(s) = \arg\max_a q^*(s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h1 id=&quot;caveat-현실-문제&quot;&gt;15. Caveat (현실 문제)&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;지금까지 설명한 optimal solution은 다음 가정을 필요로 한다.&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; type=&quot;1&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;환경 dynamics를 정확히 알고 있다&lt;/li&gt;
&lt;li&gt;충분한 계산 자원이 있다&lt;/li&gt;
&lt;li&gt;상태가 Markov property를 만족한다&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;실제 문제에서는 이 가정들이 성립하지 않는다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그래서 approximate methods와 learning algorithms가 필요하다.&lt;/p&gt;
&lt;h1 id=&quot;작은-mdp-예제로-끝까지-계산하기&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;작은 MDP 예제로 끝까지 계산하기&lt;/mark&gt;&lt;/h1&gt;
&lt;h2 id=&quot;전체-설정-요약&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;전체 설정 요약&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 예시는 아주 작은 &lt;b&gt;MDP&lt;/b&gt;를 하나 고정하고, 그 위에서 다음 개념들을 전부 실제 숫자로 계산하는 예시다.&lt;br /&gt;핵심은 &lt;b&gt;environment dynamics&lt;/b&gt;, &lt;b&gt;policy&lt;/b&gt;, &lt;b&gt;return&lt;/b&gt;, &lt;b&gt;value function&lt;/b&gt;, &lt;b&gt;Bellman equation&lt;/b&gt;, &lt;b&gt;optimal policy&lt;/b&gt;가 서로 어떻게 연결되는지 한 번에 보는 데 있다.&lt;/p&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;구성요소&lt;/th&gt;
&lt;th&gt;내용&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;States&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt; (시작), &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt; (중간), &lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt; (terminal)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Actions at &lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Safe&lt;/code&gt;, &lt;code&gt;Risky&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Actions at &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Finish&lt;/code&gt;, &lt;code&gt;Loop&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Actions at &lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;없음&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Discount factor&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.9\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;agentenvironment-interface-1&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;1. Agent&amp;ndash;Environment Interface&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;한 번의 interaction은 항상 다음 순서로 일어난다.&lt;/p&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;순서&lt;/th&gt;
&lt;th&gt;의미&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(S_t\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;현재 state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(A_t\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;agent가 선택한 action&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_{t+1}, S_{t+1}\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;environment가 생성한 reward와 다음 state&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 흐름은 &lt;span class=&quot;math inline&quot;&gt;\(S_t \to A_t \to R_{t+1},S_{t+1}\)&lt;/span&gt; 이다.&lt;/p&gt;
&lt;h3 id=&quot;예시-trajectory&quot; data-ke-size=&quot;size23&quot;&gt;예시 trajectory&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;다음과 같은 trajectory를 생각한다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(C \xrightarrow{\text{Risky},\,-2} D \xrightarrow{\text{Loop},\,1} D \xrightarrow{\text{Finish},\,3} T\)&lt;/span&gt;&lt;/p&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;시점&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;State&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;Action&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;Reward&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;Next state&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(t=0\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;Risky&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(-2\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(t=1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;Loop&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(t=2\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;Finish&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;dynamics-of-mdp-psrmid-sa&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;2. Dynamics of MDP: &lt;span class=&quot;math inline&quot;&gt;\(p(s',r\mid s,a)\)&lt;/span&gt;&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;dynamics-요약-표&quot; data-ke-size=&quot;size23&quot;&gt;dynamics 요약 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State-action&lt;/th&gt;
&lt;th&gt;Next-state distribution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Safe})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D:1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D:0.6,\ T:0.4\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Finish})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T:1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D:0.5,\ T:0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&quot;전체-dynamics-표&quot; data-ke-size=&quot;size23&quot;&gt;전체 dynamics 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;&lt;colgroup&gt; &lt;col style=&quot;width: 17%;&quot; /&gt; &lt;col style=&quot;width: 17%;&quot; /&gt; &lt;col style=&quot;width: 17%;&quot; /&gt; &lt;col style=&quot;width: 23%;&quot; /&gt; &lt;col style=&quot;width: 23%;&quot; /&gt; &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Current state &lt;span class=&quot;math inline&quot;&gt;\(s\)&lt;/span&gt;&lt;/th&gt;
&lt;th&gt;Action &lt;span class=&quot;math inline&quot;&gt;\(a\)&lt;/span&gt;&lt;/th&gt;
&lt;th&gt;Next state &lt;span class=&quot;math inline&quot;&gt;\(s'\)&lt;/span&gt;&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;Reward &lt;span class=&quot;math inline&quot;&gt;\(r\)&lt;/span&gt;&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;Probability &lt;span class=&quot;math inline&quot;&gt;\(p(s',r\mid s,a)\)&lt;/span&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Safe&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Risky&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(6\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.4\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Risky&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Risky&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(-2\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Finish&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Loop&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Loop&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&quot;state별-요약&quot; data-ke-size=&quot;size23&quot;&gt;state별 요약&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;&lt;colgroup&gt; &lt;col style=&quot;width: 33%;&quot; /&gt; &lt;col style=&quot;width: 33%;&quot; /&gt; &lt;col style=&quot;width: 33%;&quot; /&gt; &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;설명&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Safe&lt;/td&gt;
&lt;td&gt;항상 &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;로 가고 reward는 &lt;span class=&quot;math inline&quot;&gt;\(+2\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Risky&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;로 가며 &lt;span class=&quot;math inline&quot;&gt;\(+6\)&lt;/span&gt; 또는 &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;로 가며 &lt;span class=&quot;math inline&quot;&gt;\(+2,-2\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Finish&lt;/td&gt;
&lt;td&gt;항상 종료하며 reward는 &lt;span class=&quot;math inline&quot;&gt;\(+3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Loop&lt;/td&gt;
&lt;td&gt;절반 확률로 계속 &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;에 머물며 &lt;span class=&quot;math inline&quot;&gt;\(+1\)&lt;/span&gt;, 절반 확률로 종료하며 &lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;state-transition-probability-psmid-sa&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4. State transition probability: &lt;span class=&quot;math inline&quot;&gt;\(p(s'\mid s,a)\)&lt;/span&gt;&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정의는 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(s'\mid s,a)=\sum_r p(s',r\mid s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;계산-표&quot; data-ke-size=&quot;size23&quot;&gt;계산 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;&lt;/th&gt;
&lt;th&gt;가능한 &lt;span class=&quot;math inline&quot;&gt;\(s'\)&lt;/span&gt;&lt;/th&gt;
&lt;th&gt;계산&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;결과&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Safe})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(D\mid C,\text{Safe})=1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.4\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(T\mid C,\text{Risky})=0.4\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.3+0.3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(D\mid C,\text{Risky})=0.6\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Finish})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(T\mid D,\text{Finish})=1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(D\mid D,\text{Loop})=0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(p(T\mid D,\text{Loop})=0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;expected-reward-of-state-action-rsa&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;5. Expected reward of state-action: &lt;span class=&quot;math inline&quot;&gt;\(r(s,a)\)&lt;/span&gt;&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정의는 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(s,a)=\sum_r r\sum_{s'} p(s',r\mid s,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;계산-표-1&quot; data-ke-size=&quot;size23&quot;&gt;계산 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;&lt;colgroup&gt; &lt;col style=&quot;width: 30%;&quot; /&gt; &lt;col style=&quot;width: 30%;&quot; /&gt; &lt;col style=&quot;width: 40%;&quot; /&gt; &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;span class=&quot;math inline&quot;&gt;\((s,a)\)&lt;/span&gt;&lt;/th&gt;
&lt;th&gt;계산&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;결과&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Safe})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(2\cdot 1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(C,\text{Safe})=2\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(6\cdot 0.4+2\cdot 0.3+(-2)\cdot 0.3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(C,\text{Risky})=2.4\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Finish})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\cdot 1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(D,\text{Finish})=3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop})\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(1\cdot 0.5+0\cdot 0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(D,\text{Loop})=0.5\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;expected-reward-for-transition-rsas&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6. Expected reward for transition: &lt;span class=&quot;math inline&quot;&gt;\(r(s,a,s')\)&lt;/span&gt;&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정의는 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(s,a,s')=\sum_r r\frac{p(s',r\mid s,a)}{p(s'\mid s,a)}\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;계산-표-2&quot; data-ke-size=&quot;size23&quot;&gt;계산 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;&lt;colgroup&gt; &lt;col style=&quot;width: 30%;&quot; /&gt; &lt;col style=&quot;width: 30%;&quot; /&gt; &lt;col style=&quot;width: 40%;&quot; /&gt; &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;span class=&quot;math inline&quot;&gt;\((s,a,s')\)&lt;/span&gt;&lt;/th&gt;
&lt;th&gt;계산&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;결과&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Safe},D)\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;항상 reward가 &lt;span class=&quot;math inline&quot;&gt;\(2\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(C,\text{Safe},D)=2\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky},T)\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;로 가는 경우는 reward가 &lt;span class=&quot;math inline&quot;&gt;\(6\)&lt;/span&gt;뿐&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(C,\text{Risky},T)=6\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky},D)\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(2\cdot \frac{0.3}{0.6}+(-2)\cdot \frac{0.3}{0.6}\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(C,\text{Risky},D)=0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Finish},T)\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;항상 reward가 &lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(D,\text{Finish},T)=3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop},D)\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;항상 reward가 &lt;span class=&quot;math inline&quot;&gt;\(1\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(D,\text{Loop},D)=1\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop},T)\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;항상 reward가 &lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(r(D,\text{Loop},T)=0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;return-계산&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;9. Return 계산&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;trajectory는 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(C \xrightarrow{\text{Risky},\,-2} D \xrightarrow{\text{Loop},\,1} D \xrightarrow{\text{Finish},\,3} T\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;reward sequence는 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_1=-2,\ R_2=1,\ R_3=3\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;episodic-return&quot; data-ke-size=&quot;size23&quot;&gt;9-1. Episodic return&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;시점&lt;/th&gt;
&lt;th&gt;식&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;값&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_0\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_1+R_2+R_3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(-2+1+3=2\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_1\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_2+R_3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(1+3=4\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_2\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&quot;discounted-return&quot; data-ke-size=&quot;size23&quot;&gt;9-2. Discounted return&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\gamma=0.9\)&lt;/span&gt; 이므로 다음과 같다.&lt;/p&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;&lt;colgroup&gt; &lt;col style=&quot;width: 30%;&quot; /&gt; &lt;col style=&quot;width: 30%;&quot; /&gt; &lt;col style=&quot;width: 40%;&quot; /&gt; &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;시점&lt;/th&gt;
&lt;th&gt;식&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;값&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_0\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_1+\gamma R_2+\gamma^2R_3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(-2+0.9\cdot 1+0.9^2\cdot 3=1.33\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_1\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_2+\gamma R_3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(1+0.9\cdot 3=3.7\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(G_2\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(R_3\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;policy-piamid-s-설정&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;10. Policy &lt;span class=&quot;math inline&quot;&gt;\(\pi(a\mid s)\)&lt;/span&gt; 설정&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이제 평가할 &lt;b&gt;stochastic policy&lt;/b&gt;를 고정한다.&lt;/p&gt;
&lt;h3 id=&quot;policy-표&quot; data-ke-size=&quot;size23&quot;&gt;policy 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;Probability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Safe&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.7\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Risky&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Finish&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.4\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Loop&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.6\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(\text{Safe}\mid C)=0.7,\ \pi(\text{Risky}\mid C)=0.3\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi(\text{Finish}\mid D)=0.4,\ \pi(\text{Loop}\mid D)=0.6\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;value-functions-계산&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;11. Value Functions 계산&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;terminal state는 다음처럼 둔다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(T)=0\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;d에서의-action-value&quot; data-ke-size=&quot;size23&quot;&gt;11-1. &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;에서의 action-value&lt;/h3&gt;
&lt;h4 id=&quot;dtextfinish&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Finish})\)&lt;/span&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Finish})=\sum_{s',r}p(s',r\mid D,\text{Finish})[r+\gamma v_\pi(s')]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;가능한 경우는 &lt;span class=&quot;math inline&quot;&gt;\((T,3)\)&lt;/span&gt; 하나뿐이므로&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Finish})=3+0.9v_\pi(T)=3\)&lt;/span&gt;&lt;/p&gt;
&lt;h4 id=&quot;dtextloop&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop})\)&lt;/span&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Loop})=0.5[1+0.9v_\pi(D)]+0.5[0+0.9v_\pi(T)]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(T)=0\)&lt;/span&gt; 이므로&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Loop})=0.5+0.45v_\pi(D)\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;d에서의-state-value&quot; data-ke-size=&quot;size23&quot;&gt;11-2. &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;에서의 state-value&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)=\sum_a \pi(a\mid D)q_\pi(D,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)=0.4\cdot 3+0.6\cdot q_\pi(D,\text{Loop})\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Loop})=0.5+0.45v_\pi(D)\)&lt;/span&gt; 를 넣으면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)=1.2+0.6(0.5+0.45v_\pi(D))\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)=1.2+0.3+0.27v_\pi(D)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)=1.5+0.27v_\pi(D)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.73v_\pi(D)=1.5\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)=\frac{1.5}{0.73}\approx 2.0548\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 값을 다시 넣으면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Loop})=0.5+0.45(2.0548)\approx 1.4247\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;c에서의-action-value&quot; data-ke-size=&quot;size23&quot;&gt;11-3. &lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;에서의 action-value&lt;/h3&gt;
&lt;h4 id=&quot;ctextsafe&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Safe})\)&lt;/span&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Safe})=2+0.9v_\pi(D)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Safe})=2+0.9(2.0548)\approx 3.8493\)&lt;/span&gt;&lt;/p&gt;
&lt;h4 id=&quot;ctextrisky&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky})\)&lt;/span&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Risky})=0.4[6+0.9v_\pi(T)]+0.3[2+0.9v_\pi(D)]+0.3[-2+0.9v_\pi(D)]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(T)=0\)&lt;/span&gt; 이므로&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Risky})=0.4\cdot 6+0.3(2+0.9v_\pi(D))+0.3(-2+0.9v_\pi(D))\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Risky})=2.4+0.54v_\pi(D)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Risky})=2.4+0.54(2.0548)\approx 3.5096\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;c에서의-state-value&quot; data-ke-size=&quot;size23&quot;&gt;11-4. &lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;에서의 state-value&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)=\sum_a \pi(a\mid C)q_\pi(C,a)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)=0.7\cdot q_\pi(C,\text{Safe})+0.3\cdot q_\pi(C,\text{Risky})\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)=0.7(3.8493)+0.3(3.5096)\approx 3.7474\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;value-summary-표&quot; data-ke-size=&quot;size23&quot;&gt;value summary 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;값&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;결과&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(T)\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\approx 2.0548\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\approx 3.7474\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Finish})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Loop})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\approx 1.4247\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Safe})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\approx 3.8493\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Risky})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\approx 3.5096\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;v_pi-와-q_pi-관계-확인&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;12. &lt;span class=&quot;math inline&quot;&gt;\(v_\pi\)&lt;/span&gt; 와 &lt;span class=&quot;math inline&quot;&gt;\(q_\pi\)&lt;/span&gt; 관계 확인&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;v_pissum_a-piamid-sq_pisa&quot; data-ke-size=&quot;size23&quot;&gt;12-1. &lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_a \pi(a\mid s)q_\pi(s,a)\)&lt;/span&gt;&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;계산&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;결과&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.7\cdot 3.8493+0.3\cdot 3.5096\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\approx 3.7474\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.4\cdot 3+0.6\cdot 1.4247\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\approx 2.0548\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&quot;q_pisasum_srpsrmid-sargamma-v_pis&quot; data-ke-size=&quot;size23&quot;&gt;12-2. &lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s',r}p(s',r\mid s,a)[r+\gamma v_\pi(s')]\)&lt;/span&gt;&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;예를 들어 &lt;span class=&quot;math inline&quot;&gt;\((C,\text{Risky})\)&lt;/span&gt;에 대해&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Risky})=0.4[6+0.9v_\pi(T)]+0.3[2+0.9v_\pi(D)]+0.3[-2+0.9v_\pi(D)]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;직접 계산하면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Risky})\approx 3.5096\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 관계식이 실제 숫자로도 성립한다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;bellman-expectation-equation-검산&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;13. Bellman expectation equation 검산&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Bellman expectation equation은 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(s)=\sum_a \pi(a\mid s)\sum_{s',r}p(s',r\mid s,a)[r+\gamma v_\pi(s')]\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;상태-c에서-직접-대입&quot; data-ke-size=&quot;size23&quot;&gt;상태 &lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;에서 직접 대입&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)=0.7\big(2+0.9v_\pi(D)\big)+0.3\big(0.4\cdot 6+0.3(2+0.9v_\pi(D))+0.3(-2+0.9v_\pi(D))\big)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)=0.7(2+0.9\cdot 2.0548)+0.3(2.4+0.54\cdot 2.0548)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)\approx 0.7(3.8493)+0.3(3.5096)=3.7474\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;정확히 앞에서 계산한 값과 일치한다.&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;왜 Bellman equation이 중요한가&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;현재 value를 직접 미래 trajectory 전체로 계산하지 않고,&lt;br /&gt;한 step 뒤의 value를 이용해 재귀적으로 계산할 수 있게 해 준다.&lt;br /&gt;강화학습의 거의 모든 핵심 알고리즘이 이 구조 위에 서 있다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;action-value-bellman-equation-검산&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;14. Action-value Bellman equation 검산&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;식은 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(s,a)=\sum_{s',r}p(s',r\mid s,a)\left[r+\gamma \sum_{a'}\pi(a'\mid s')q_\pi(s',a')\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;dtextloop에서-검산&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\((D,\text{Loop})\)&lt;/span&gt;에서 검산&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Loop})=0.5\left[1+\gamma\sum_{a'}\pi(a'\mid D)q_\pi(D,a')\right]+0.5\left[0+\gamma\sum_{a'}\pi(a'\mid T)q_\pi(T,a')\right]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt;는 terminal이므로 두 번째 항은 &lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;이다. 또한&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\sum_{a'}\pi(a'\mid D)q_\pi(D,a')=v_\pi(D)\approx 2.0548\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Loop})=0.5(1+0.9\cdot 2.0548)=1.4247\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 역시 앞 계산과 일치한다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;bellman-backup의-실제-모양&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;15. Bellman backup의 실제 모양&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 예시에서 값은 뒤에서 앞으로 전달된다.&lt;/p&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;단계&lt;/th&gt;
&lt;th&gt;계산&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(T)=0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(D,\text{Finish})=3+0.9\cdot 0=3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(D)\)&lt;/span&gt; 계산&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q_\pi(C,\text{Safe}), q_\pi(C,\text{Risky})\)&lt;/span&gt; 계산&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)\)&lt;/span&gt; 계산&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 흐름은 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v(T)\to v(D)\to v(C)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 backward propagation이 바로 &lt;b&gt;Bellman backup&lt;/b&gt;이다.&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;optimal-value와-optimal-policy-계산&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;16. Optimal value와 optimal policy 계산&lt;/mark&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이제 같은 environment에서 &lt;b&gt;optimal policy&lt;/b&gt;를 계산한다.&lt;/p&gt;
&lt;h3 id=&quot;d에서-optimal-action&quot; data-ke-size=&quot;size23&quot;&gt;16-1. &lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;에서 optimal action&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Bellman optimality equation은 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(s)=\max_a \sum_{s',r}p(s',r\mid s,a)[r+\gamma v^*(s')]\)&lt;/span&gt;&lt;/p&gt;
&lt;h4 id=&quot;finish&quot; data-ke-size=&quot;size20&quot;&gt;&lt;code&gt;Finish&lt;/code&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(D,\text{Finish})=3\)&lt;/span&gt;&lt;/p&gt;
&lt;h4 id=&quot;loop&quot; data-ke-size=&quot;size20&quot;&gt;&lt;code&gt;Loop&lt;/code&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(D,\text{Loop})=0.5[1+0.9v^*(D)]+0.5[0+0.9v^*(T)]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(T)=0\)&lt;/span&gt; 이므로&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(D,\text{Loop})=0.5+0.45v^*(D)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이제 &lt;code&gt;Loop&lt;/code&gt;가 optimal이라고 가정하면&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(D)=0.5+0.45v^*(D)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0.55v^*(D)=0.5\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(D)=0.9091\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그런데 이 값은 &lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;보다 작다. 따라서 optimal action은 &lt;code&gt;Finish&lt;/code&gt;다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그래서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(D)=3\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;그리고&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(D,\text{Loop})=0.5+0.45\cdot 3=1.85\)&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;c에서-optimal-action&quot; data-ke-size=&quot;size23&quot;&gt;16-2. &lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;에서 optimal action&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(D)=3\)&lt;/span&gt; 을 넣는다.&lt;/p&gt;
&lt;h4 id=&quot;safe&quot; data-ke-size=&quot;size20&quot;&gt;&lt;code&gt;Safe&lt;/code&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(C,\text{Safe})=2+0.9\cdot 3=4.7\)&lt;/span&gt;&lt;/p&gt;
&lt;h4 id=&quot;risky&quot; data-ke-size=&quot;size20&quot;&gt;&lt;code&gt;Risky&lt;/code&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(C,\text{Risky})=0.4[6+0.9v^*(T)]+0.3[2+0.9v^*(D)]+0.3[-2+0.9v^*(D)]\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(C,\text{Risky})=0.4\cdot 6+0.3(2+2.7)+0.3(-2+2.7)\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(C,\text{Risky})=2.4+1.41+0.21=4.02\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(C)=\max\{4.7,4.02\}=4.7\)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 optimal action은 &lt;code&gt;Safe&lt;/code&gt;다.&lt;/p&gt;
&lt;h3 id=&quot;optimal-summary-표&quot; data-ke-size=&quot;size23&quot;&gt;optimal summary 표&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;값&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;결과&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(T)\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(0\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(D)\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(C)\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(4.7\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(D,\text{Finish})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(3\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(D,\text{Loop})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(1.85\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(C,\text{Safe})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(4.7\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(q^*(C,\text{Risky})\)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(4.02\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&quot;optimal-policy-1&quot; data-ke-size=&quot;size23&quot;&gt;optimal policy&lt;/h3&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;Optimal action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Safe&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;math inline&quot;&gt;\(D\)&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Finish&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;즉 deterministic optimal policy는 다음과 같다.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(\pi^*(C)=\text{Safe},\ \pi^*(D)=\text{Finish}\)&lt;/span&gt;&lt;/p&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;현재-policy와-optimal-policy-비교&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;17. 현재 policy와 optimal policy 비교&lt;/mark&gt;&lt;/h2&gt;
&lt;table data-ke-align=&quot;alignLeft&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;항목&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;값&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;현재 policy의 시작 상태 value&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v_\pi(C)\approx 3.7474\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;optimal policy의 시작 상태 value&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;math inline&quot;&gt;\(v^*(C)=4.7\)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;따라서 현재 policy보다 optimal policy가 더 좋다.&lt;/p&gt;</description>
      <category>딥러닝 논문/강화학습</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/58</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/%EA%B0%95%ED%99%94%ED%95%99%EC%8A%B5-%EB%82%B4%EC%9A%A9-%EC%A0%95%EB%A6%AC-Lecture-13#entry58comment</comments>
      <pubDate>Fri, 13 Mar 2026 21:02:31 +0900</pubDate>
    </item>
    <item>
      <title>[REVIEW] Streaming Long Video Understanding with Large Language Models</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/REVIEW-Streaming-Long-Video-Understanding-with-Large-Language-Models</link>
      <description>&lt;h2 id=&quot;어떤-문제를-해결하고-싶은가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;1) 어떤 문제를 해결하고 싶은가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;이 논문은 &lt;strong&gt;long video understanding&lt;/strong&gt;에서 발생하는 핵심 병목인 &lt;strong&gt;video token explosion&lt;/strong&gt; 문제를 해결하려고 한다. 긴 비디오를 그대로 Vision-Language Large Model에 넣으면 frame 수가 많아져 token 수가 급격히 늘고, 계산량이 커지며, 앞부분 문맥이 소실되기 쉽다.&lt;/li&gt;
&lt;li&gt;기존 long video 처리 방식은 대체로
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;sparse temporal sampling&lt;/strong&gt;으로 일부 frame만 뽑거나,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;spatio-temporal pooling / frame compression&lt;/strong&gt;으로 token 수를 줄이거나,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memory bank&lt;/strong&gt;를 따로 두는 방식이었다. 그런데 이 방식들은 긴 시간축의 temporal information을 잃거나, spatial detail을 희생하거나, 특정 timestamp가 주어져야만 필요한 정보를 잘 꺼낼 수 있다는 문제가 있다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;이 논문이 겨냥하는 문제는 단순히 “긴 영상을 압축하자”가 아니다. &lt;strong&gt;임의 길이의 비디오를 constant한 수의 memory/token으로 표현하면서도, 질문에 따라 필요한 시점을 정확히 찾아 detailed QA와 temporal grounding까지 수행하는 것&lt;/strong&gt;이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;긴 영상을 한 번에 다 보는 방식은 비효율적이다. 이 논문은 영상을 &lt;strong&gt;짧은 clip들의 stream&lt;/strong&gt;으로 보고, 이전까지 본 내용을 작은 memory에 계속 누적 저장한 뒤, 질문이 들어오면 그 질문과 관련 있는 memory만 골라 답하게 만든다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;선행연구는-어땠는가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;2) 선행연구는 어땠는가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;video-LLM 계열의 일반적 접근&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;sparse sampling이나 simple temporal pooling으로 비디오를 적게 본다.&lt;/li&gt;
&lt;li&gt;대표적으로 recent video understanding with LLM 계열은 minute-long video에서도 sampling 또는 pooling으로 token 수를 줄인다.&lt;/li&gt;
&lt;li&gt;문제는 긴 시간축에서 중요한 사건 순서나 중간 맥락이 사라질 수 있다는 점이다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;frame-wise compression 계열&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;예로 LLaMA-VID는 각 frame을 매우 적은 token으로 압축한다.&lt;/li&gt;
&lt;li&gt;이 방식은 frame 단위 압축에 집중하기 때문에 &lt;strong&gt;inter-frame temporal dynamics&lt;/strong&gt;를 compression 단계에서 충분히 반영하지 못한다.&lt;/li&gt;
&lt;li&gt;또한 question-dependent compression이어서, 하나의 일반적인 long-video representation을 만들기 어렵다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memory bank 계열&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;MovieChat, MA-LMM, MC-ViT류는 history information을 memory bank에 저장한다.&lt;/li&gt;
&lt;li&gt;긴 문맥 유지에는 도움이 되지만, 일부 방법은 handcrafted rule이나 clustering에 의존하고, 특정 moment에 대한 질문에 강하게 반응하려면 explicit timestamp cue가 필요하다.&lt;/li&gt;
&lt;li&gt;즉, global understanding은 가능해도 fine-grained temporal question answering은 제한된다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;caption-then-reason 계열&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;긴 비디오를 short clip으로 쪼갠 뒤 각 clip caption을 만들고, 그 caption들을 LLM이 다시 읽는 구조다.&lt;/li&gt;
&lt;li&gt;이 방식은 end-to-end 학습이 어렵고, 전체 성능이 short clip caption quality에 종속된다.&lt;/li&gt;
&lt;li&gt;caption 단계에서 이미 정보가 손실되면 이후 reasoning에서 복구할 수 없다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;

&lt;p&gt;long video understanding의 핵심은 단순 압축이 아니다. &lt;strong&gt;무엇을 남기고 무엇을 버릴지&lt;/strong&gt;, 그리고 &lt;strong&gt;질문이 들어왔을 때 어느 시점의 정보를 다시 참조할지&lt;/strong&gt;가 성능을 결정한다. 선행연구는 이 두 문제를 동시에 잘 푸는 데 한계가 있었다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;이-논문에서-하는-새로운-기여는-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;3) 이 논문에서 하는 새로운 기여는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;이 논문의 핵심 기여는 두 가지다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;memory-propagated-streaming-encoding&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) Memory-Propagated Streaming Encoding&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;긴 비디오를 여러 short clip으로 나누고, 각 clip을 순차적으로 encoding한다.&lt;/li&gt;
&lt;li&gt;현재 clip을 encoding할 때 &lt;strong&gt;직전 clip의 condensed memory&lt;/strong&gt;를 함께 넣는다.&lt;/li&gt;
&lt;li&gt;그래서 현재 memory는 현재 clip 정보만 담는 것이 아니라, &lt;strong&gt;지금까지 본 전체 영상의 누적 요약&lt;/strong&gt;이 된다.&lt;/li&gt;
&lt;li&gt;결과적으로 영상 길이가 아무리 길어져도 &lt;strong&gt;fixed-length memory&lt;/strong&gt;로 전체를 대표할 수 있게 한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;adaptive-memory-selection&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) Adaptive Memory Selection&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;final global memory 하나만 쓰면 초반부 detail이 사라질 수 있다.&lt;/li&gt;
&lt;li&gt;이를 해결하기 위해, 각 clip마다 historical memory를 저장해 두고, 질문이 주어지면 &lt;strong&gt;질문과 관련 있는 memory subset만 adaptively select&lt;/strong&gt;한다.&lt;/li&gt;
&lt;li&gt;질문 indicator와 각 clip indicator의 similarity를 계산하고, &lt;strong&gt;Gumbel-Topk&lt;/strong&gt;로 관련 clip들을 선택해 LLM에 넣는다.&lt;/li&gt;
&lt;li&gt;그래서 global understanding과 moment-specific reasoning을 동시에 노린다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;disentangled-extraction-and-reasoning&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) disentangled extraction and reasoning&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;비디오를 질문마다 다시 encoding하지 않는다.&lt;/li&gt;
&lt;li&gt;먼저 stream 방식으로 비디오를 일반적인 condensed memory 집합으로 만들어 두고, 질문이 들어오면 그 질문에 필요한 memory만 골라 reasoning한다.&lt;/li&gt;
&lt;li&gt;이것이 &lt;strong&gt;inference efficiency&lt;/strong&gt; 측면의 중요한 기여다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;long-video-qa-data-construction&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(4) long-video QA data construction&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;long video QA 데이터 부족 문제를 해결하려고
&lt;ul&gt;
&lt;li&gt;기존 short-video QA를 이어 붙여 synthetic long video를 만들고,&lt;/li&gt;
&lt;li&gt;Panda-70M의 segmented captions와 timestamps를 활용해 &lt;strong&gt;timestamp-aware multi-round QA pairs&lt;/strong&gt;를 생성했다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;이 데이터는 memory selection과 temporal grounding supervision에 사용된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;이 논문의 본질적 새로움&lt;/summary&gt;

&lt;p&gt;이 논문의 핵심은 “long video를 잘 요약하는 memory를 순차적으로 만들고, 질문이 오면 관련 memory만 다시 꺼내 쓰는 구조”다. 즉, &lt;strong&gt;streaming summarization&lt;/strong&gt;과 &lt;strong&gt;question-conditioned retrieval&lt;/strong&gt;를 하나의 학습 가능한 구조로 결합했다는 점이 새롭다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;연구-방법은-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4) 연구 방법은 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;h2 id=&quot;전체-파이프라인&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;전체 파이프라인&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;입력 비디오를 &lt;span class=&quot;math inline&quot;&gt;\(K\)&lt;/span&gt;개의 short clip으로 나눈다.&lt;/li&gt;
&lt;li&gt;각 clip에서 frame-wise visual feature를 추출한다.&lt;/li&gt;
&lt;li&gt;작은 language model을 이용해 각 clip을 condensed memory로 바꾼다.&lt;/li&gt;
&lt;li&gt;이때 이전 clip의 memory를 현재 clip encoding에 함께 넣어 history를 전달한다.&lt;/li&gt;
&lt;li&gt;모든 historical memory를 저장해 둔다.&lt;/li&gt;
&lt;li&gt;질문이 들어오면 질문과 관련 있는 memory 몇 개만 뽑아서 최종 LLM이 답한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;single-clip-encoding&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(1) Single Clip Encoding&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;pre-trained &lt;strong&gt;CLIP ViT-L/14&lt;/strong&gt;로 frame-wise feature를 뽑는다.&lt;/li&gt;
&lt;li&gt;spatially adjacent visual token 4개를 channel 방향으로 합쳐 token 수를 75% 줄인다.&lt;/li&gt;
&lt;li&gt;각 frame을 대표하는 &lt;strong&gt;summarization tokens&lt;/strong&gt; &lt;span class=&quot;math inline&quot;&gt;\(S\)&lt;/span&gt;를 adaptive pooling으로 초기화한다.&lt;/li&gt;
&lt;li&gt;clip feature &lt;span class=&quot;math inline&quot;&gt;\(F\)&lt;/span&gt;와 summarization tokens &lt;span class=&quot;math inline&quot;&gt;\(S\)&lt;/span&gt;를 concat하여 encoder &lt;span class=&quot;math inline&quot;&gt;\(g(\cdot)\)&lt;/span&gt;에 넣고, 마지막 &lt;span class=&quot;math inline&quot;&gt;\(T \times P\)&lt;/span&gt;개의 token을 condensed representation &lt;span class=&quot;math inline&quot;&gt;\(H\)&lt;/span&gt;로 사용한다:
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(H = g([F \circ S])\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;encoder는 &lt;strong&gt;MLP projector + Phi-2 small language model&lt;/strong&gt;로 구성된다.&lt;/li&gt;
&lt;li&gt;저자들의 직관은 decoder-only LM의 autoregressive 구조상, sequence 정보가 뒤쪽 token에 축적되기 쉽다는 점이다. 그래서 마지막 token들을 요약 표현으로 활용한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 vision transformer가 아니라 language model을 encoder로 쓰는가&lt;/summary&gt;

&lt;p&gt;저자들은 LM의 causal/autoregressive 성질을 이용하면 sequence 전체 정보가 뒤쪽 token에 자연스럽게 모인다고 본다. 또한 이후 reasoning 단계도 LLM이 수행하므로, LM이 만든 memory representation이 후단 LLM 입력공간과 더 잘 맞는다고 주장한다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;prefix-task&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(2) Prefix Task&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;단순히 summarization token을 붙이는 것만으로는 그 token이 진짜 정보를 모은다는 보장이 약하다.&lt;/li&gt;
&lt;li&gt;그래서 논문은 &lt;strong&gt;modified attention mask&lt;/strong&gt;를 사용한 prefix task를 설계한다.&lt;/li&gt;
&lt;li&gt;text response token이 video clip token 전체를 직접 보지 못하게 하고, &lt;strong&gt;summarization token만 참조&lt;/strong&gt;하게 만든다.&lt;/li&gt;
&lt;li&gt;이렇게 하면 summarization token이 실제로 clip 정보를 압축하도록 학습된다. 이 부분은 page 4의 Figure 2, 3에서 도식적으로 설명된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;memory-propagated-streaming-encoding-1&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(3) Memory-Propagated Streaming Encoding&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(k\)&lt;/span&gt;번째 clip에서는 현재 clip feature &lt;span class=&quot;math inline&quot;&gt;\(F_k\)&lt;/span&gt;, summarization tokens &lt;span class=&quot;math inline&quot;&gt;\(S_k\)&lt;/span&gt;, 그리고 clip 전체를 요약하는 global token &lt;span class=&quot;math inline&quot;&gt;\(\hat{S}_k\)&lt;/span&gt;를 사용한다.&lt;/li&gt;
&lt;li&gt;이전 clip에서 나온 condensed memory &lt;span class=&quot;math inline&quot;&gt;\(H_{k-1}\)&lt;/span&gt;를 historical memory로 받아서 함께 넣는다.&lt;/li&gt;
&lt;li&gt;수식은 다음과 같다:
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(H_k, \hat{H}_k = g([H_{k-1} \circ F_k \circ S_k \circ \hat{S}_k])\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;여기서 &lt;span class=&quot;math inline&quot;&gt;\(\hat{H}_k\)&lt;/span&gt;는 &lt;strong&gt;clip indicator&lt;/strong&gt; 역할을 하며, 이후 memory selection에 쓰인다.&lt;/li&gt;
&lt;li&gt;결과적으로 &lt;span class=&quot;math inline&quot;&gt;\(H_k\)&lt;/span&gt;는 단순히 현재 clip만 요약한 것이 아니라, &lt;strong&gt;0초부터 &lt;span class=&quot;math inline&quot;&gt;\(k\)&lt;/span&gt;번째 clip까지의 누적 표현&lt;/strong&gt;이 된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;time-prompt&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;time prompt&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;각 clip과 historical memory에 대해 explicit timestamp text prompt를 넣는다.&lt;/li&gt;
&lt;li&gt;예:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;This contains a history of {start} to {end} seconds&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;a clip sampled in {start} to {end} seconds&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;이 prompt는 temporal awareness를 높이는 역할을 한다. 실제 ablation에서도 time prompt가 없으면 breakpoint accuracy가 크게 떨어진다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;adaptive-memory-selection-1&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(4) Adaptive Memory Selection&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;최종 memory &lt;span class=&quot;math inline&quot;&gt;\(H_K\)&lt;/span&gt;만 쓰면 초반 detail이 사라질 수 있으므로, 전체 historical memory 집합 &lt;span class=&quot;math inline&quot;&gt;\(\{H_1, \dots, H_K\}\)&lt;/span&gt;를 저장한다.&lt;/li&gt;
&lt;li&gt;질문이 들어오면 final global memory &lt;span class=&quot;math inline&quot;&gt;\(H_K\)&lt;/span&gt;와 question text를 다시 small LM에 넣어 &lt;strong&gt;instruction indicator&lt;/strong&gt; &lt;span class=&quot;math inline&quot;&gt;\(\hat{H}_Q\)&lt;/span&gt;를 만든다.&lt;/li&gt;
&lt;li&gt;각 clip indicator &lt;span class=&quot;math inline&quot;&gt;\(\{\hat{H}_1, \dots, \hat{H}_K\}\)&lt;/span&gt;와 cosine similarity를 계산한다.&lt;/li&gt;
&lt;li&gt;Gumbel-Topk로 상위 &lt;span class=&quot;math inline&quot;&gt;\(V\)&lt;/span&gt;개 clip을 선택한다:
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;math inline&quot;&gt;\(I = \text{Gumbel-Topk}(s, V)\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;선택된 memory만 temporal order로 concat해서 LLM에 넣고 답변을 생성한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;전체 영상의 축약본 하나만 보면 세부 장면은 놓칠 수 있다. 그래서 질문이 “중간에 왜 팔을 들었는가?”처럼 특정 moment를 요구하면, 그 질문과 가장 관련 있는 clip memory를 다시 찾아서 LLM에 보여준다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;training&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(5) Training&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;stage-1-single-clip-training&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Stage 1: single-clip training&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;image/video caption data 790K로 projector를 먼저 학습한다.&lt;/li&gt;
&lt;li&gt;이후 image/video instruction data 763K로 small LM을 finetune한다.&lt;/li&gt;
&lt;li&gt;기본 설정:
&lt;ul&gt;
&lt;li&gt;video는 &lt;span class=&quot;math inline&quot;&gt;\(T=16\)&lt;/span&gt; frame&lt;/li&gt;
&lt;li&gt;resolution &lt;span class=&quot;math inline&quot;&gt;\(224 \times 224\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;CLIP ViT-L/14 사용&lt;/li&gt;
&lt;li&gt;frame당 256 token에서 merging 후 64 token&lt;/li&gt;
&lt;li&gt;각 frame을 &lt;span class=&quot;math inline&quot;&gt;\(P=4\)&lt;/span&gt; summarization token으로 줄임&lt;/li&gt;
&lt;li&gt;16 frame clip 전체가 64 token memory가 된다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;compression ratio는 &lt;strong&gt;16:1&lt;/strong&gt;이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;stage-2-streaming-long-video-training&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Stage 2: streaming long-video training&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;long video QA data로 전체 구조를 joint finetuning한다.&lt;/li&gt;
&lt;li&gt;long video QA 데이터는
&lt;ul&gt;
&lt;li&gt;25K movie QA&lt;/li&gt;
&lt;li&gt;Panda-70M 기반 300K multi-round long video QA&lt;/li&gt;
&lt;li&gt;short-video QA를 이어붙인 synthetic 20K long video 로 구성된다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;streaming encoder는 &lt;strong&gt;Phi-2의 첫 16 layers&lt;/strong&gt; 출력만 condensed memory로 사용한다.&lt;/li&gt;
&lt;li&gt;최종적으로 &lt;strong&gt;&lt;span class=&quot;math inline&quot;&gt;\(V=4\)&lt;/span&gt;개의 relevant timestamps&lt;/strong&gt;를 선택하고, 총 &lt;strong&gt;256 memory tokens&lt;/strong&gt;를 Vicuna-7B에 넣어 답변한다.&lt;/li&gt;
&lt;li&gt;temporal grounding supervision을 위해 일부 QA pair에는 pseudo temporal labels를 붙이고, warm-up 시 &lt;strong&gt;KL divergence loss&lt;/strong&gt;로 selection을 지도한다. 이후 나머지 데이터에서는 response loss와 weak supervision으로 학습한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;실험-결과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(6) 실험 결과&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;videochatgpt-benchmark&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;VideoChatGPT benchmark&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;모든 metric에서 강한 baseline들을 넘는다.&lt;/li&gt;
&lt;li&gt;특히 &lt;strong&gt;Temporal Understanding&lt;/strong&gt;에서 강점이 크다. 이는 streaming memory가 temporal dynamics를 더 잘 보존한다는 저자 해석과 연결된다. Table 2.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;egoschema&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;EgoSchema&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;zero-shot에서 44.1을 기록한다.&lt;/li&gt;
&lt;li&gt;finetuned MC-ViT 44.4와 비슷한 수준이고, 다른 zero-shot LLM-based 방법들보다 높다. Table 3.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;next-qa&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Next-QA&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;zero-shot 성능이 strong baseline들을 넘는다.&lt;/li&gt;
&lt;li&gt;Temporal split에서 특히 강하다. Table 4.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;next-gqa&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Next-GQA&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;specialized grounding module 없이도 높은 grounding 성능을 낸다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Acc@GQA 17.8&lt;/strong&gt;로 비교군 대비 가장 높다. Table 5.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;moviechat-1k&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;MovieChat-1K&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;global mode와 breakpoint mode 모두 strong performance를 보인다.&lt;/li&gt;
&lt;li&gt;특히 global accuracy 90.4, breakpoint accuracy 54.9를 기록했다. Table 6.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;movienet-qa&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;MovieNet-QA&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;subtitle 없이 visual-only로도 경쟁력 있는 성능을 낸다.&lt;/li&gt;
&lt;li&gt;평균 LLM input token 수가 &lt;strong&gt;256&lt;/strong&gt;으로 매우 작고, inference latency도 &lt;strong&gt;5.32 sec/question&lt;/strong&gt;로 baseline보다 짧다. Table 7.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 실험이 의미 있는가&lt;/summary&gt;

&lt;p&gt;이 논문은 단순히 정확도만 올린 것이 아니다. &lt;strong&gt;token 수를 크게 줄이면서도&lt;/strong&gt;, &lt;strong&gt;global understanding&lt;/strong&gt;, &lt;strong&gt;moment-specific QA&lt;/strong&gt;, &lt;strong&gt;temporal grounding&lt;/strong&gt;을 함께 개선했다는 점이 중요하다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;ablation에서-확인된-핵심&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;(7) Ablation에서 확인된 핵심&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;memory-propagation의-효과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;memory propagation의 효과&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;propagated memory가 있으면 global understanding이 크게 좋아진다.&lt;/li&gt;
&lt;li&gt;MovieChat-1K global accuracy는 selection과 함께 쓸 때 90.4까지 올라간다.&lt;/li&gt;
&lt;li&gt;propagated memory가 없으면 selection이 조금 틀려도 필요한 이전 문맥을 잃기 쉽다. Table 8.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;adaptive-selection의-효과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;adaptive selection의 효과&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;breakpoint mode처럼 특정 moment 이해가 중요한 task에서는 selection이 없으면 성능이 크게 떨어진다.&lt;/li&gt;
&lt;li&gt;즉, long video에서 “질문 관련 clip retrieval”이 필수적이라는 것을 보여준다. Table 8.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;language-model-encoder의-효과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;language model encoder의 효과&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;vision-based MC-ViT encoder보다 partial layers of Phi-2를 encoder로 쓰는 편이 더 좋다.&lt;/li&gt;
&lt;li&gt;16 layers of Phi가 가장 좋고, 너무 깊은 layer는 오히려 성능이 떨어진다.&lt;/li&gt;
&lt;li&gt;저자 해석은 final layer가 next-token prediction에 최적화되어 있어 visual condensation 목적과 완전히 맞지 않기 때문이라는 것이다. Table 10.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;time-prompt의-효과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;time prompt의 효과&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;time prompt가 없으면 breakpoint accuracy가 크게 떨어진다.&lt;/li&gt;
&lt;li&gt;clip timestamp와 memory timestamp를 둘 다 넣는 것이 가장 좋다. Table 14.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;selection-similarity&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;selection similarity&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;cosine similarity가 dot product보다 훨씬 안정적이고 성능도 높다.&lt;/li&gt;
&lt;li&gt;dot product는 numerical instability를 일으켜 grounding 성능이 크게 낮아진다. Table 15.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;한계는-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5) 한계는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;논문이 직접 밝힌 핵심 한계는 &lt;strong&gt;uniform sampling&lt;/strong&gt;이다.&lt;/li&gt;
&lt;li&gt;긴 비디오의 모든 구간이 동일한 정보량을 갖는 것은 아니다.
&lt;ul&gt;
&lt;li&gt;bland content 구간에는 token을 낭비할 수 있고,&lt;/li&gt;
&lt;li&gt;반대로 event가 밀집한 구간에는 현재 clip/token budget이 부족할 수 있다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;저자들은 이를 해결하려면 &lt;strong&gt;adaptive segmentation&lt;/strong&gt;이 필요하다고 말한다. 즉, clip 길이를 영상 복잡도에 따라 동적으로 조절해야 한다고 본다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;추가로-읽히는-한계&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;추가로 읽히는 한계&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;pseudo temporal labels&lt;/strong&gt;와 synthetic long-video QA에 의존한다. 따라서 selection이 얼마나 genuine temporal reasoning을 배우는지, 아니면 데이터 생성 규칙의 편향을 학습하는지는 더 검증이 필요하다. 이 부분은 논문이 일부 supervision을 Panda-70M과 concatenated short-video QA로 만든다고 명시한다.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;hour-long video에서도 1 FPS / clip-based sampling&lt;/strong&gt; 수준의 coarse visual scan에 의존한다. 아주 짧고 결정적인 event가 sampling 사이에 끼어 있으면 놓칠 수 있다. 논문도 uniform sampling의 한계를 인정한다.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;statistical significance&lt;/strong&gt;가 보고되지 않았다. NeurIPS checklist에서 error bar를 제공하지 않았고, 이유는 compute cost라고 적었다. 따라서 reported gain의 variance는 확인되지 않는다.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;code/data는 submission 시점에 공개되지 않았다.&lt;/strong&gt; 재현성 설명은 충분히 제공했지만, checklist에서 open access to data and code는 No라고 밝혔다.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;전체 평가&lt;/summary&gt;

&lt;p&gt;이 논문은 long video를 처리하는 구조를 &lt;strong&gt;compression&lt;/strong&gt;만의 문제가 아니라, &lt;strong&gt;streaming memory construction + question-conditioned memory retrieval&lt;/strong&gt; 문제로 재정의했다는 점이 강하다. 특히 temporal understanding과 temporal grounding 성능이 좋아진 이유가 구조적으로 납득된다. 한편 adaptive segmentation, 더 정밀한 sampling, stronger grounding supervision 없이도 얼마나 일반화되는지는 아직 남아 있다.&lt;/p&gt;

&lt;/details&gt;
&lt;h2 id=&quot;한-줄-요약&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;한 줄 요약&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;이 논문은 긴 비디오를 short clip stream으로 순차 encoding하면서 이전 memory를 다음 clip에 전달해 &lt;strong&gt;global condensed memory&lt;/strong&gt;를 만들고, 질문이 들어오면 관련 clip memory만 골라 LLM에 넣는 방식으로 &lt;strong&gt;long video QA와 temporal grounding을 효율적으로 수행&lt;/strong&gt;한다.&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>딥러닝 논문/VLM(비전 랭귀지 모델) 딥러닝 논문</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/56</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/REVIEW-Streaming-Long-Video-Understanding-with-Large-Language-Models#entry56comment</comments>
      <pubDate>Wed, 11 Mar 2026 13:14:11 +0900</pubDate>
    </item>
    <item>
      <title>[REVIEW] INTERNVIDEO2: SCALING FOUNDATION MODELS FOR MULTIMODAL VIDEO UNDERSTANDING</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/REVIEW-INTERNVIDEO2-SCALING-FOUNDATION-MODELS-FOR-MULTIMODAL-VIDEO-UNDERSTANDING</link>
      <description>&lt;h2 id=&quot;어떤-문제를-해결하고-싶은가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;1) 어떤 문제를 해결하고 싶은가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;이 논문은 &lt;b&gt;multimodal video understanding를 위한 large-scale Video Foundation Model&lt;/b&gt;을 어떻게 만들 것인가를 다룬다. 목표는 단순한 action recognition 하나가 아니라, &lt;b&gt;video recognition, video-text retrieval, temporal grounding, audio-related tasks, video-centric dialogue, long video understanding&lt;/b&gt;까지 폭넓게 잘하는 범용 video encoder를 구축하는 것이다.&lt;/li&gt;
&lt;li&gt;저자들이 본 핵심 문제는 기존 video learning이 대체로 다음 셋 중 하나에 치우쳐 있었다는 점이다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;masked video modeling&lt;/b&gt; 중심&lt;/li&gt;
&lt;li&gt;&lt;b&gt;video-text alignment&lt;/b&gt; 중심&lt;/li&gt;
&lt;li&gt;&lt;b&gt;next token prediction / video-LLM 연결&lt;/b&gt; 중심&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 이 세 학습 방식이 서로 경쟁 관계가 아니라 &lt;b&gt;complementary&lt;/b&gt;하다고 본다. 따라서 이들을 하나의 progressive training scheme으로 결합하면, video encoder가
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;perceptive&lt;/b&gt;하고&lt;/li&gt;
&lt;li&gt;&lt;b&gt;semantic&lt;/b&gt;하며&lt;/li&gt;
&lt;li&gt;&lt;b&gt;reasoning-capable&lt;/b&gt;한 representation을 학습할 수 있다고 주장한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;또 하나의 문제는 &lt;b&gt;data quality&lt;/b&gt;다. video-text pair를 많이 모으는 것만으로는 부족하고, video의 시간적 단위가 semantic하게 잘려 있어야 하며, video/audio/speech를 함께 반영하는 caption이 필요하다고 본다. 기존 clip 생성이나 caption은 종종 &lt;b&gt;temporal inconsistency&lt;/b&gt;와 &lt;b&gt;modality misalignment&lt;/b&gt;를 일으킨다.&lt;/li&gt;
&lt;li&gt;최종적으로 해결하려는 것은 다음이다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;video에서 &lt;b&gt;spatiotemporal perception&lt;/b&gt;을 잘 배우는 것&lt;/li&gt;
&lt;li&gt;text/audio/speech와 &lt;b&gt;semantic alignment&lt;/b&gt;를 잘 맞추는 것&lt;/li&gt;
&lt;li&gt;LLM과 연결해 &lt;b&gt;open-ended video QA / dialogue / long-context reasoning&lt;/b&gt;까지 가능하게 만드는 것&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 &amp;ldquo;좋은 video model 하나로 웬만한 video task를 다 처리하고 싶다&amp;rdquo;는 문제를 푼다. 기존에는 reconstruction을 잘하는 모델, retrieval을 잘하는 모델, dialogue를 잘하는 모델이 따로 노는 경우가 많았다. 이 논문은 그것들을 순차적으로 이어 붙여서 하나의 foundation model로 만들려 한다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;선행연구는-어땠는가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;2) 선행연구는 어땠는가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;논문은 prior work를 크게 두 축으로 정리한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;Video Foundation Models&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Multimodal Large Language Models&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;video-foundation-models-계열&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;2-1. Video Foundation Models 계열&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;기존 Video Foundation Model 구축 방식은 대표적으로 다음 세 가지였다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;video-text contrastive learning&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;masked video modeling&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;next token prediction&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;video-text contrastive learning&lt;/b&gt; 계열은 VideoCLIP, InternVideo류처럼 video와 text를 embedding space에서 가깝게 맞추는 방식이다. retrieval과 zero-shot transfer에 강하다. 하지만 세밀한 motion perception이나 low-level spatiotemporal structure를 충분히 담지 못할 수 있다. 이 논문은 이런 방향을 계승하되, contrastive learning만으로는 부족하다고 본다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;masked video modeling&lt;/b&gt; 계열은 VideoMAE, VideoMAEv2, MVD 등처럼 video token reconstruction이나 masked feature prediction을 통해 representation을 배운다. 이 계열은 spatiotemporal perception을 학습하는 데 유리하다. 하지만 language/audio와 직접적으로 정렬되지는 않는다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;next token prediction&lt;/b&gt; 계열은 Flamingo, VideoChat, VideoChatGPT류처럼 visual/video input을 LLM과 연결해 open-ended generation을 수행한다. 이 계열은 dialogue나 VQA에 유리하다. 하지만 강한 video encoder 없이 붙이면 perception quality가 약할 수 있다.&lt;/li&gt;
&lt;li&gt;기존에도 이 둘 이상을 섞으려는 시도는 있었다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;InternVideo, UMT, VideoPrism&lt;/b&gt;은 masked reconstruction과 multimodal contrastive learning을 결합한 two-stage 방식이었다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;All-in-one&lt;/b&gt;은 여러 objective를 단일 backbone에서 unified pretraining으로 묶었다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;VALOR, VAST&lt;/b&gt;는 video 외에 audio/speech까지 포함해 multimodal representation을 배우려 했다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;이 논문은 이런 흐름 위에서 한 단계 더 나가, &lt;b&gt;세 가지 objective를 모두 progressive하게 연결&lt;/b&gt;하고, model scale과 data scale을 함께 키운다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;mllm-계열&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;2-2. MLLM 계열&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;LLM과 vision encoder를 연결하는 &lt;b&gt;MLLM&lt;/b&gt; 계열은 open-world task에서 강력했다. Flamingo, LLaVA, InstructBLIP 같은 흐름이 대표적이다.&lt;/li&gt;
&lt;li&gt;video 분야에서도 VideoChat, VideoChatGPT, Valley 등 video-centric MLLM이 등장했다. 이런 모델들은 instruction data를 사용해 video encoder를 LLM과 연결한다.&lt;/li&gt;
&lt;li&gt;다만 이 계열의 한계는 &lt;b&gt;기초 video representation이 약하면 reasoning 이전에 perception이 흔들린다&lt;/b&gt;는 점이다. 그래서 이 논문은 stage 3에서 곧바로 LLM fine-tuning을 하지 않고, 먼저 stage 1과 stage 2를 통해 video encoder 자체를 충분히 강하게 만든 뒤 연결한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;선행연구는 각자 잘하는 영역이 달랐다. reconstruction은 perception에 강하고, contrastive learning은 alignment에 강하고, LLM 연결은 dialogue에 강하다. 이 논문은 &amp;ldquo;이 셋을 순서대로 쌓으면 더 강한 범용 video model이 된다&amp;rdquo;는 설계를 내세운다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;이-논문에서-하는-새로운-기여는-무엇인가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;3) 이 논문에서 하는 새로운 기여는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;논문이 제시하는 핵심 기여는 &lt;b&gt;InternVideo2라는 새로운 family of Video Foundation Models&lt;/b&gt;다. 이 모델은 &lt;b&gt;masked video modeling, crossmodal contrastive learning, next token prediction&lt;/b&gt;을 progressive training scheme 안에서 결합한다.&lt;/li&gt;
&lt;li&gt;첫 번째 기여는 &lt;b&gt;3-stage progressive learning framework&lt;/b&gt;다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;Stage 1:&lt;/b&gt; unmasked video token reconstruction&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Stage 2:&lt;/b&gt; video-audio-speech-text contrastive learning&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Stage 3:&lt;/b&gt; video-centric dialogue를 위한 next token prediction&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;766&quot; data-origin-height=&quot;236&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Nj1dh/dJMcagEJeMh/fTKKW7oJkbSdEGSY1bUvok/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Nj1dh/dJMcagEJeMh/fTKKW7oJkbSdEGSY1bUvok/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Nj1dh/dJMcagEJeMh/fTKKW7oJkbSdEGSY1bUvok/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FNj1dh%2FdJMcagEJeMh%2FfTKKW7oJkbSdEGSY1bUvok%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;766&quot; height=&quot;236&quot; data-origin-width=&quot;766&quot; data-origin-height=&quot;236&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;두 번째 기여는 &lt;b&gt;대규모 multimodal video dataset 설계&lt;/b&gt;다. 논문은 총 &lt;b&gt;402M data entries&lt;/b&gt; 규모의 training corpus를 사용한다고 설명한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;2M video-only data&lt;/li&gt;
&lt;li&gt;50M video-text pairs&lt;/li&gt;
&lt;li&gt;50M video-audio-speech-text pairs&lt;/li&gt;
&lt;li&gt;300M image-text pairs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;세 번째 기여는 &lt;b&gt;InternVid2&lt;/b&gt;라는 video-audio-speech-caption dataset 구축이다. 단순한 video-text pair가 아니라, video를 &lt;b&gt;semantic temporal segmentation&lt;/b&gt;한 뒤, video/audio/speech를 각각 captioning하고, 이를 다시 LLM으로 fusion하여 &lt;b&gt;VAS caption&lt;/b&gt;을 만든다.&lt;/li&gt;
&lt;li&gt;네 번째 기여는 &lt;b&gt;scaling&lt;/b&gt;이다. video encoder를 최대 &lt;b&gt;6B parameters&lt;/b&gt;까지 키운다. 논문은 이 스케일링이 특히 zero-shot recognition, retrieval, temporal grounding 같은 transferable representation task에서 이득을 준다고 보여준다.&lt;/li&gt;
&lt;li&gt;다섯 번째 기여는 &lt;b&gt;매우 넓은 task coverage&lt;/b&gt;다. 논문 초반 figure와 본문 설명에 따르면, action recognition부터 temporal grounding, retrieval, audio QA, video dialogue, long video understanding까지 총 60개가 넘는 task에서 SOTA 혹은 매우 경쟁력 있는 결과를 낸다고 주장한다. figure1는 이 모델이 &lt;b&gt;70 tasks&lt;/b&gt;에 걸쳐 강한 transferable representation을 보인다고 요약한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;757&quot; data-origin-height=&quot;259&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/LKpdT/dJMcafTk1lV/s2kaCK8VyCTAlJSgcF69g1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/LKpdT/dJMcafTk1lV/s2kaCK8VyCTAlJSgcF69g1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/LKpdT/dJMcafTk1lV/s2kaCK8VyCTAlJSgcF69g1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FLKpdT%2FdJMcafTk1lV%2Fs2kaCK8VyCTAlJSgcF69g1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;757&quot; height=&quot;259&quot; data-origin-width=&quot;757&quot; data-origin-height=&quot;259&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;여섯 번째 기여는 &lt;b&gt;long video / procedure-aware reasoning&lt;/b&gt; capability를 강조한 점이다. page 1 figure와 stage 3 실험에서 temporal commonsense reasoning, event counting, temporal order, navigation decision 같은 사례를 제시한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;한 줄 핵심&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;새로운 architecture를 발명한 논문이 아니다. 기존에 효과가 있던 세 가지 학습 패러다임과 데이터 정제 방식을 매우 큰 스케일에서 잘 조합해, 범용 video foundation model을 만든 논문이다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;연구-방법은-무엇인가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4) 연구 방법은 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;h2 id=&quot;전체-구조&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4-1. 전체 구조&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;구조
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;Stage 1:&lt;/b&gt; expert encoder들을 teacher로 사용하여 video encoder를 학습&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Stage 2:&lt;/b&gt; audio encoder와 text encoder를 붙여 multimodal alignment&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Stage 3:&lt;/b&gt; QFormer와 LLM을 붙여 next-token prediction 기반 video dialogue 학습&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;video encoder는 ViT 기반이며, sparse하게 샘플링한 &lt;b&gt;8 frames&lt;/b&gt;를 입력으로 사용한다. spatial downsampling은 &lt;b&gt;14&amp;times;14&lt;/b&gt; patch 단위다. token에 class token과 &lt;b&gt;3D positional embedding&lt;/b&gt;을 더한다.&lt;/li&gt;
&lt;li&gt;supplementary architecture table(page 23, Table 20)에 따르면, 6B vision encoder는 48-layer ViT encoder와 attention pooling, projection heads 등으로 구성된다. token 수는 3200 수준이며, stage 1에서 projection layer를 사용하고 이후 버린다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;학습 초반에는 &amp;ldquo;잘 보는 능력&amp;rdquo;을 만든다. 그다음에는 &amp;ldquo;다른 modality와 의미를 맞추는 능력&amp;rdquo;을 붙인다. 마지막에는 &amp;ldquo;LLM과 대화하는 능력&amp;rdquo;을 붙인다. 즉 perception &amp;rarr; alignment &amp;rarr; reasoning 순서다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;stage-1-reconstructing-unmasked-video-tokens&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4-2. Stage 1: Reconstructing Unmasked Video Tokens&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Stage 1의 목적은 video encoder가 기본적인 &lt;b&gt;spatiotemporal perception&lt;/b&gt;을 학습하도록 하는 것이다. 하지만 일반적인 MAE처럼 masked token 자체를 복원하는 것이 아니라, &lt;b&gt;unmasked video token reconstruction&lt;/b&gt; 형태를 쓴다.&lt;/li&gt;
&lt;li&gt;teacher는 두 개다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;InternVL-6B&lt;/b&gt;: multimodal-friendly semantic teacher&lt;/li&gt;
&lt;li&gt;&lt;b&gt;VideoMAEv2-g&lt;/b&gt;: motion-aware teacher&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;학습 시 full video를 teacher에 넣고, student 쪽에서는 &lt;b&gt;80% token masking&lt;/b&gt;을 frame-by-frame으로 적용한다. 그리고 &lt;b&gt;unmasked token들만&lt;/b&gt; teacher의 대응 token과 MSE로 맞춘다. 손실은 두 teacher와의 거리의 weighted sum이다.&lt;/li&gt;
&lt;li&gt;더 구체적으로는 다음을 align한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;InternVL의 마지막 6개 layer&lt;/li&gt;
&lt;li&gt;VideoMAEv2의 마지막 4개 layer&lt;/li&gt;
&lt;li&gt;InternVL의 final output token&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;이 과정의 핵심 아이디어는 단순하다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;InternVL teacher는 &lt;b&gt;semantic / multimodal 친화성&lt;/b&gt;을 준다.&lt;/li&gt;
&lt;li&gt;VideoMAE teacher는 &lt;b&gt;motion sensitivity&lt;/b&gt;를 준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 이 전략이 UMT나 VideoPrism처럼 multimodal teacher 하나만 쓰는 것보다, &lt;b&gt;temporal sensitivity까지 강화한다&lt;/b&gt;고 설명한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;video encoder를 처음부터 혼자 학습시키는 대신, &amp;ldquo;의미를 잘 아는 teacher&amp;rdquo;와 &amp;ldquo;motion을 잘 아는 teacher&amp;rdquo; 둘에게 동시에 배우게 한다. 그래서 초기 representation이 semantic과 temporal 양쪽을 같이 갖게 된다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;stage-2-aligning-video-to-audio-speech-text&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4-3. Stage 2: Aligning Video to Audio-Speech-Text&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Stage 2의 목표는 video encoder가 &lt;b&gt;다른 modality와 의미적으로 정렬된 representation&lt;/b&gt;을 배우게 하는 것이다. 여기서는 audio encoder와 text/speech encoder를 추가한다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;audio encoder&lt;/b&gt;는 12-layer transformer이며, &lt;b&gt;BEATs&lt;/b&gt;로 initialize된다. 입력은 10초 clip의 &lt;b&gt;64-dim log Mel filterbank spectrogram&lt;/b&gt;이다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;text encoder&lt;/b&gt;와 multimodal decoder는 &lt;b&gt;BERT-Large&lt;/b&gt; 기반이다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;앞의 19개 layer는 text encoder&lt;/li&gt;
&lt;li&gt;뒤의 5개 layer는 cross-attention이 있는 multimodal decoder&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;loss는 세 가지다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;crossmodal contrastive loss&lt;/b&gt; &lt;span class=&quot;math inline&quot;&gt;\(L_{CON}\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;matching loss&lt;/b&gt; &lt;span class=&quot;math inline&quot;&gt;\(L_{MAC}\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;masked language modeling loss&lt;/b&gt; &lt;span class=&quot;math inline&quot;&gt;\(L_{MLM}\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;contrastive loss는 각 modality embedding과 이를 설명하는 text embedding 사이의 cosine similarity를 maximization하는 형태다. 논문의 식 (3)에 정식 수식이 나온다. matching loss는 paired / unpaired 여부를 binary classification으로 맞춘다. MLM loss는 caption text reconstruction이다.&lt;/li&gt;
&lt;li&gt;Stage 2는 두 단계로 나뉜다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;Aligning Masked Visual-Language-Audio&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;audio encoder를 freeze&lt;/li&gt;
&lt;li&gt;masked video token과 다른 modality를 먼저 정렬&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Unmasked Visual-Audio-Language Post-Pretraining&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;이번에는 vision encoder를 freeze&lt;/li&gt;
&lt;li&gt;full video token으로 audio/visual/text joint alignment를 추가 학습&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자 설명에 따르면, 이렇게 하면 학습 효율이 좋아지고, inference와 더 일관된 표현을 얻게 된다. 특히 큰 6B ViT를 freeze하고 post-pretraining하는 이유는 compute와 downstream degradation 문제를 피하기 위해서다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Stage 1에서 &amp;ldquo;video를 잘 보는 눈&amp;rdquo;을 만들었다면, Stage 2에서는 그 눈이 text/audio/speech와 같은 의미 공간으로 들어오도록 맞춘다. 그래야 retrieval, grounding, audio-text task, zero-shot recognition이 강해진다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;stage-3-predicting-next-token-with-video-centric-inputs&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4-4. Stage 3: Predicting Next Token with Video-Centric Inputs&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Stage 3의 목표는 &lt;b&gt;video-centric dialogue&lt;/b&gt; 능력을 추가하는 것이다. 여기서는 InternVideo2 encoder를 &lt;b&gt;LLM과 연결&lt;/b&gt;한다. 연결 방식은 &lt;b&gt;QFormer design&lt;/b&gt;이다.&lt;/li&gt;
&lt;li&gt;저자들은 VideoChat 계열의 progressive learning scheme을 이어받아, InternVideo2를 video encoder로 사용하고 open-source LLM과 연결한다. stage 3에서 video encoder는 next-token prediction 학습을 통해 다시 업데이트된다.&lt;/li&gt;
&lt;li&gt;추가로 &lt;b&gt;high-definition post-training&lt;/b&gt;을 수행한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;입력 video를 최대 6개 sub-video + 1개 global resized sub-video로 나눈다.&lt;/li&gt;
&lt;li&gt;각 sub-video는 224&amp;times;224 resolution이다.&lt;/li&gt;
&lt;li&gt;추가 2 epoch 동안 학습한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;1 epoch: 8-frame input&lt;/li&gt;
&lt;li&gt;1 epoch: 16-frame input&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;이 추가 학습에서 업데이트되는 것은
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;video encoder&lt;/li&gt;
&lt;li&gt;BLIP QFormer&lt;/li&gt;
&lt;li&gt;LLM은 &lt;b&gt;LoRA&lt;/b&gt; 방식으로 업데이트된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;이 stage의 목적은 caption generation이 아니라, &lt;b&gt;video question answering, reasoning, dialogue, long-context response&lt;/b&gt;에 필요한 open-ended generation 능력을 붙이는 것이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;데이터-설계&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4-5. 데이터 설계&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;stage-1-데이터-k-mash&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(1) Stage 1 데이터: K-Mash&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Stage 1은 label 없는 video-only dataset인 &lt;b&gt;K-Mash&lt;/b&gt;를 쓴다.&lt;/li&gt;
&lt;li&gt;action recognition datasets들에서 영상을 모아 만들었고, 이후 &lt;b&gt;K-Mash2M&lt;/b&gt;에서는 YouTube에서 추가로 844K 영상을 더 골라 총 2M 규모로 확장한다.&lt;/li&gt;
&lt;li&gt;supplementary의 page 24 Table 21에 따르면 K-Mash2M은
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;K710 658K&lt;/li&gt;
&lt;li&gt;Something-Something V2 169K&lt;/li&gt;
&lt;li&gt;HACS 106K&lt;/li&gt;
&lt;li&gt;ActivityNet 15K&lt;/li&gt;
&lt;li&gt;MiT 207K&lt;/li&gt;
&lt;li&gt;self-collected 844K 로 구성된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;stage-2-데이터-internvid2와-multimodal-captioning&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(2) Stage 2 데이터: InternVid2와 multimodal captioning&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 5 Table 1에 pretraining data summary가 있다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Stage 1: KMash 2M&lt;/li&gt;
&lt;li&gt;Stage 2 image-text: LAION 등 300M&lt;/li&gt;
&lt;li&gt;Stage 2 vid-txt:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;WebVid2M 250k&lt;/li&gt;
&lt;li&gt;WebVid10M 9.7M&lt;/li&gt;
&lt;li&gt;InternVid 40M&lt;/li&gt;
&lt;li&gt;InternVid2 50M&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Stage 3: LLaVA 등 2.1M conversation / QA data&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;InternVid2는 video-audio-speech information이 포함된 dataset이다. 본문에는 100M videos라고 서술되는 부분도 있지만, pretraining summary에서는 50M video-audio-speech-text pairs로 사용한다고 정리한다. 논문 내 서술 간 규모 표현이 다소 혼재되어 있다. 확실한 것은 stage 2에서 매우 큰 규모의 VAS-caption pair를 사용한다는 점이다.&lt;/li&gt;
&lt;li&gt;clip generation에서 중요한 점은 &lt;b&gt;temporal consistency&lt;/b&gt;다. 저자들은 FFMPEG SceneDet 대신 &lt;b&gt;AutoShot&lt;/b&gt;을 써서 semantic boundary 기반으로 clip을 나눈다. pixel difference가 아니라 temporal semantic variation을 기준으로 segment를 나누므로 더 의미 있는 clip을 얻을 수 있다고 설명한다.&lt;/li&gt;
&lt;li&gt;annotation 시스템은 &lt;b&gt;VidCap&lt;/b&gt;이다. Figure 3에 framework가 나온다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Video Captioner&lt;/li&gt;
&lt;li&gt;Audio Captioner&lt;/li&gt;
&lt;li&gt;Speech Captioner&lt;/li&gt;
&lt;li&gt;LLM-based Crossmodal CapFusion&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;543&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/mC7dr/dJMcacWAxul/nAFnMV8HFCPMNPNPDI88J0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/mC7dr/dJMcacWAxul/nAFnMV8HFCPMNPNPDI88J0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/mC7dr/dJMcacWAxul/nAFnMV8HFCPMNPNPDI88J0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmC7dr%2FdJMcacWAxul%2FnAFnMV8HFCPMNPNPDI88J0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;732&quot; height=&quot;543&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;543&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;audio captioner는 오픈소스가 없어서 직접 설계했고, BEATs feature와 VideoChat 기반 구조를 사용하며 &lt;b&gt;WavCaps&lt;/b&gt;로 학습한다. speech는 WhisperV2-large로 ASR하고, non-English는 번역도 수행한다. caption fusion은 Vicuna-1.5를 이용한다.&lt;/li&gt;
&lt;li&gt;supplementary page 24 Table 22에는 fusion prompt가 나온다. video/audio/speech caption을 단순 concatenation하지 말고 &lt;b&gt;자연스러운 한 문장&lt;/b&gt;으로 통합하라는 prompt를 쓴다. 또한 이해 불가능한 audio/speech는 drop할 수 있게 한다.&lt;/li&gt;
&lt;li&gt;최종적으로 video마다 5종류 caption을 만든다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;A&lt;/li&gt;
&lt;li&gt;V&lt;/li&gt;
&lt;li&gt;S&lt;/li&gt;
&lt;li&gt;AV&lt;/li&gt;
&lt;li&gt;AVS&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;stage-3-데이터-instruction-tuning&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,238,238,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(3) Stage 3 데이터: instruction tuning&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;stage 3은 updated version의 &lt;b&gt;MVBench-based instruction data&lt;/b&gt;를 사용한다.&lt;/li&gt;
&lt;li&gt;기존 1.9M samples에서 caption data 일부를 줄이고, S-MiT 등 새 데이터를 넣어 &lt;b&gt;diversity&lt;/b&gt;를 높였다.&lt;/li&gt;
&lt;li&gt;추가로 ShareGPT4Video, PerceptionTestQA, TVQA, NTU-RGB-D, EgotaskQA, DiDeMo, COCO 기반 grounding data도 넣는다.&lt;/li&gt;
&lt;li&gt;논문은 이 instruction data가 다음 task를 포괄하도록 설계됐다고 설명한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;conversation&lt;/li&gt;
&lt;li&gt;caption&lt;/li&gt;
&lt;li&gt;visual question answer&lt;/li&gt;
&lt;li&gt;reasoning&lt;/li&gt;
&lt;li&gt;classification&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;실험은-어떻게-했는가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;5) 실험은 어떻게 했는가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;평가 범위가 매우 넓다. 논문은 stage별로 서로 다른 capability를 평가한다.&lt;/li&gt;
&lt;li&gt;training resource도 크다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Stage 1: 256 A100, 18일&lt;/li&gt;
&lt;li&gt;Stage 2: 256 A100, 14일&lt;/li&gt;
&lt;li&gt;Stage 3: 64 A100, 3일&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;평가 task는 다음과 같다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;video classification&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;temporal action localization&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;video instance segmentation&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;video retrieval&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;video temporal grounding&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;audio retrieval / audio QA / audio classification&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;video-centric dialogue / multiple-choice video QA&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;movie understanding&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;핵심-실험-결과&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6) 핵심 실험 결과&lt;/mark&gt;&lt;/h2&gt;
&lt;h2 id=&quot;action-recognition&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-1. Action Recognition&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 7 Table 2의 end-to-end finetuning 결과에서, &lt;b&gt;InternVideo2s1-6B, 16&amp;times;224&lt;/b&gt;는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;K400: &lt;b&gt;92.1&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;K600: &lt;b&gt;91.9&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;K700: &lt;b&gt;85.9&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Something-Something V2: &lt;b&gt;77.4&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;MiT: &lt;b&gt;51.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;ActivityNet: &lt;b&gt;95.9&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;HACS: &lt;b&gt;97.0&lt;/b&gt; 를 기록한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 이것이 여러 dataset에서 SOTA라고 설명한다. 특히 더 큰 resolution이나 ensemble 없이 16-frame만으로 이 성능을 냈다고 강조한다.&lt;/li&gt;
&lt;li&gt;attentive probing 결과(page 7 Table 3)에서는 &lt;b&gt;InternVideo2s2-6B&lt;/b&gt;가
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;K400: &lt;b&gt;88.8&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;K600: &lt;b&gt;89.1&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;K700: &lt;b&gt;81.0&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;MiT: &lt;b&gt;47.8&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;SSV2: &lt;b&gt;67.7&lt;/b&gt; 이다. stage 2 multimodal pretraining 이후에도 transferable feature quality가 매우 높다는 뜻이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;linear probing(page 8 Table 4)에서는 &lt;b&gt;InternVideo2s2-6B&lt;/b&gt;가
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;K400: &lt;b&gt;84.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;SSV2: &lt;b&gt;56.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;UCF101: &lt;b&gt;97.3&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;HMDB51: &lt;b&gt;80.7&lt;/b&gt; 을 기록한다. frozen representation 자체가 강하다는 의미다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;해석&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;end-to-end finetuning만 잘 되는 모델은 많다. linear probing과 attentive probing까지 강하다는 것은 encoder representation 자체가 좋다는 뜻이다. 즉 downstream head가 억지로 맞춘 것이 아니라, backbone feature가 강하다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;zero-shot-recognition&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-2. Zero-shot Recognition&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 8 Table 5와 Table 6에 zero-shot action recognition 결과가 나온다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;InternVideo2clip-6B&lt;/b&gt;는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;UCF: &lt;b&gt;89.5&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;HMDB: &lt;b&gt;56.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;MiT: &lt;b&gt;32.9&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;SSv2-MC: &lt;b&gt;63.5&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Charades: &lt;b&gt;34.6&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Kinetics 계열에서는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;K400 top-1: &lt;b&gt;72.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;K600 top-1: &lt;b&gt;71.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;K700 top-1: &lt;b&gt;64.2&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 VideoPrism이 K400 zero-shot에서는 더 높다고 인정한다. 그리고 그 원인으로 VideoPrism의 massive pretraining corpus와 manually labeled subset의 영향 가능성을 언급한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;temporal-action-localization&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-3. Temporal Action Localization&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 8 Table 7에서 feature-based TAL 결과를 제시한다. &lt;b&gt;InternVideo2s1-6B&lt;/b&gt;는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;THUMOS14: &lt;b&gt;72.0&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;HACS: &lt;b&gt;43.3&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;ActivityNet: &lt;b&gt;41.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;FineAction: &lt;b&gt;27.7&lt;/b&gt; average mAP를 기록한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 거의 모든 dataset에서 비교 대상보다 높다고 말한다. 단, FineAction에서는 model scaling만으로 fine-grained discrimination이 크게 늘지 않는다고 해석한다. detailed annotation scaling이 추가로 필요하다고 본다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;video-retrieval&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-4. Video Retrieval&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 9 Table 9와 Table 10이 retrieval 결과다.&lt;/li&gt;
&lt;li&gt;zero-shot retrieval에서 &lt;b&gt;InternVideo2s2-6B&lt;/b&gt;는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;MSR-VTT t2v / v2t: &lt;b&gt;55.9 / 53.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;LSMDC: &lt;b&gt;33.8 / 30.1&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;DiDeMo: &lt;b&gt;57.9 / 57.1&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;MSVD: &lt;b&gt;59.3 / 83.1&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;ActivityNet: &lt;b&gt;63.2 / 56.5&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;VATEX: &lt;b&gt;71.5 / 85.3&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;finetuned retrieval에서는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;MSR-VTT: &lt;b&gt;62.8 / 60.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;LSMDC: &lt;b&gt;46.4 / 46.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;DiDeMo: &lt;b&gt;74.2 / 71.9&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;MSVD: &lt;b&gt;61.4 / 85.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;ActivityNet: &lt;b&gt;74.1 / 69.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;VATEX: &lt;b&gt;75.5 / 89.3&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 거의 모든 dataset에서 zero-shot과 finetuned 모두 SOTA급이라고 주장한다. retrieval은 이 모델의 &lt;b&gt;semantic alignment 품질&lt;/b&gt;을 가장 직접적으로 보여주는 실험이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;temporal-grounding&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-5. Temporal Grounding&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 10 Table 11에서 temporal grounding 결과를 제시한다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;QVHighlight&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;InternVideo2s2-6B:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;R1@0.5: &lt;b&gt;71.42&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;R1@0.7: &lt;b&gt;56.45&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;mAP: &lt;b&gt;49.24&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Highlight mAP: &lt;b&gt;42.90&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;HiT@1: &lt;b&gt;72.00&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Charade-STA&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;InternVideo2s2-6B:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;R1@0.3: &lt;b&gt;79.70&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;R1@0.5: &lt;b&gt;70.03&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;R1@0.7: &lt;b&gt;48.95&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;mIoU: &lt;b&gt;58.79&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 larger spatiotemporal model이 short-term semantic alignment capability에 유리하다고 해석한다. temporal grounding은 &amp;ldquo;문장에 맞는 순간을 찾는 능력&amp;rdquo;이므로 video-language alignment quality를 잘 반영한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;audio-related-tasks&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-6. Audio-related Tasks&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 10 Table 12와 Table 13에서 audio 관련 결과를 보고한다.&lt;/li&gt;
&lt;li&gt;audio retrieval zero-shot / finetuning에서 &lt;b&gt;InternVideo2s2-6B&lt;/b&gt;는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;AudioCaps: &lt;b&gt;37.1 / 55.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;ClothoV1: &lt;b&gt;17.4 / 25.3&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;ClothoV2: &lt;b&gt;17.4 / 27.2&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;AudioQA에서는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;ClothoAQA: &lt;b&gt;30.14&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;AMAVQA: &lt;b&gt;80.51&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ESC-50 audio classification에서는 &lt;b&gt;98.60&lt;/b&gt; top-1이다.&lt;/li&gt;
&lt;li&gt;흥미로운 점은 audio encoder와 text encoder가 상대적으로 작음에도 이 성능이 나온다는 것이다. 저자들은 이를 &lt;b&gt;crossmodal contrastive learning의 상호 이득&lt;/b&gt;으로 해석한다. video가 audio에, audio가 video에 도움을 준다는 뜻이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;video-centric-dialogue&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-7. Video-centric Dialogue&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 11 Table 14는 chat-centric multiple-choice Video-QA 결과다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;VideoChat2-HD-F16 + InternVideo2s3-1B + Mistral-7B&lt;/b&gt;는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;MVBench: &lt;b&gt;67.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Egoschema: &lt;b&gt;60.0&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Perception Test: &lt;b&gt;63.4&lt;/b&gt; 를 기록한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 이것이 open-source와 commercial baseline 대비 상당히 강하며, 특히 &lt;b&gt;Perception Test&lt;/b&gt;와 &lt;b&gt;MVBench&lt;/b&gt;에서 강하다고 설명한다. 다만 Egoschema에서는 proprietary model이 여전히 더 강하다.&lt;/li&gt;
&lt;li&gt;page 12~14의 qualitative figures는 temporal action recognition, confused action recognition, temporal order understanding, event counting, unexpected action reasoning, visual-language navigation 사례를 보여준다. 저자들은 이 figure들을 통해 InternVideo2-Chat이 GPT-4V나 Gemini Pro보다 temporal order나 misleading action, counting에서 더 정확한 예시를 제시한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;중요한 해석&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 qualitative example들은 엄밀한 benchmark 수치만큼 강한 증거는 아니다. 하지만 저자들이 강조하고 싶은 것은 이 encoder가 단순 classification feature를 넘어서, LLM과 결합했을 때 temporal order, event counting, procedural reasoning 같은 질문에 비교적 잘 대응한다는 점이다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;scaling-효과&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6-8. Scaling 효과&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 11 Table 15는 1B &amp;rarr; 6B scaling의 평균 효과를 요약한다.&lt;/li&gt;
&lt;li&gt;zero-shot action recognition 평균:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;1B: &lt;b&gt;55.5&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;6B: &lt;b&gt;56.9&lt;/b&gt; (+1.4)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;zero-shot video retrieval 평균:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;1B: &lt;b&gt;55.0&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;6B: &lt;b&gt;56.9&lt;/b&gt; (+1.9)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;finetuned action recognition 평균:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;1B: &lt;b&gt;73.2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;6B: &lt;b&gt;73.6&lt;/b&gt; (+0.4)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;해석은 중요하다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;scaling은 &lt;b&gt;transfer / zero-shot&lt;/b&gt;에는 분명한 이득이 있다.&lt;/li&gt;
&lt;li&gt;하지만 fully finetuned classification에서는 증가폭이 작다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;즉 이 논문에서 scaling의 진짜 효용은 단순 supervised finetuning accuracy가 아니라, &lt;b&gt;generalizable representation&lt;/b&gt;에 있다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;ablation에서-무엇이-확인되었는가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;7) Ablation에서 무엇이 확인되었는가&lt;/mark&gt;&lt;/h2&gt;
&lt;h2 id=&quot;stage-1-teacher와-데이터-규모&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;7-1. Stage 1 teacher와 데이터 규모&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 11 Table 16에서 stage 1 ablation을 한다.&lt;/li&gt;
&lt;li&gt;teacher를 CLIP-L만 쓰는 ViT-L보다, &lt;b&gt;InternVL-6B&lt;/b&gt;를 teacher로 쓰는 ViT-1B가 더 좋다.&lt;/li&gt;
&lt;li&gt;또 &lt;b&gt;InternVL-6B + VideoMAE-g&lt;/b&gt;를 함께 teacher로 쓴 경우가 특히 SSV2 같은 temporal task에서 더 좋다.&lt;/li&gt;
&lt;li&gt;예를 들어 ViT-1B + InternVL-6B + VideoMAE-g + K-Mash1.1M은 평균 &lt;b&gt;79.1&lt;/b&gt;, ViT-6B + same teachers + K-Mash2M은 평균 &lt;b&gt;79.6&lt;/b&gt;이다.&lt;/li&gt;
&lt;li&gt;저자 해석은 명확하다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;multimodal teacher와 motion-aware teacher의 &lt;b&gt;synergy&lt;/b&gt;가 중요하다.&lt;/li&gt;
&lt;li&gt;model scale이 커질수록 stage 1 pretraining data scale도 같이 커져야 한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;stage-2에서-audiospeech-추가의-효과&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;7-2. Stage 2에서 audio/speech 추가의 효과&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 15 Table 17을 보면,
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;baseline(video-text only): &lt;b&gt;24.7&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;audio encoder w/ audio-text learning: &lt;b&gt;24.0&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;speech encoder w/ video-speech-text learning: &lt;b&gt;24.9&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;audio encoder w/ video-audio-text learning: &lt;b&gt;27.8&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;audio &amp;amp; speech encoders + video-audio-speech-text: &lt;b&gt;25.7&lt;/b&gt; 이다. metric은 zero-shot MSR-VTT t2v retrieval R@1이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;핵심은 &lt;b&gt;audio encoder를 넣되, video-audio-text joint learning을 하는 설정이 가장 좋다&lt;/b&gt;는 점이다.&lt;/li&gt;
&lt;li&gt;speech를 추가하는 것은 오히려 retrieval에는 덜 효과적이었다. 즉 modality를 많이 붙인다고 무조건 좋은 것이 아니고, 어떤 objective로 어떻게 학습하느냐가 중요하다는 뜻이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;temporal-segmentation과-fused-caption의-효과&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;7-3. Temporal segmentation과 fused caption의 효과&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 15 Table 18에 중요한 ablation이 있다.&lt;/li&gt;
&lt;li&gt;caption을 점점 더 풍부하게 만들수록 MSR-VTT zero-shot t2v가 개선된다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;baseline: &lt;b&gt;24.7&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;video+audio: &lt;b&gt;26.6&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;video+audio+speech: &lt;b&gt;27.1&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;그리고 &lt;b&gt;AutoShot + multimodal caption&lt;/b&gt; 설정: &lt;b&gt;34.8&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;여기서 제일 중요한 메시지는 &lt;b&gt;semantic segmentation quality&lt;/b&gt;가 크다는 점이다. AutoShot을 써서 clip boundary를 semantic하게 자르는 것이 retrieval을 거의 7 point 수준으로 끌어올린다. 저자들은 이것을 통해 InternVid2와 annotation system의 효과를 검증했다고 말한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;stage-3에서-question-injection의-효과&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;7-4. Stage 3에서 question injection의 효과&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 15 Table 19는 qformer instruction 사용 여부를 비교한다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;qformer instruction 없이&lt;/b&gt; 학습한 쪽이
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;MVBench: &lt;b&gt;60.4&lt;/b&gt; vs 59.9&lt;/li&gt;
&lt;li&gt;Egoschema-full: &lt;b&gt;55.8&lt;/b&gt; vs 52.9&lt;/li&gt;
&lt;li&gt;Egoschema-subset: &lt;b&gt;66.4&lt;/b&gt; vs 65.8 로 더 낫다. NextQA만 question-injected version이 약간 낫다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자들은 scaled-up VideoLLM에서 question을 QFormer에 넣는 방식이 &lt;b&gt;out-of-domain overfitting&lt;/b&gt;을 유발한다고 해석한다. 즉 instruction tuning을 더 많이 넣는 것이 항상 generalization을 높이지는 않는다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;이-논문의-의미는-무엇인가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;8) 이 논문의 의미는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;이 논문은 video 이해를 위한 foundation model을 만들 때,
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;reconstruction&lt;/li&gt;
&lt;li&gt;multimodal alignment&lt;/li&gt;
&lt;li&gt;LLM-based generation 을 &lt;b&gt;분리된 패러다임이 아니라 하나의 연속적인 학습 과정&lt;/b&gt;으로 묶을 수 있음을 보여준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;핵심은 architecture novelty보다 &lt;b&gt;training recipe와 data curation&lt;/b&gt;이다. stage를 잘 나누고, teacher를 잘 고르고, caption과 segmentation을 잘 만들면 매우 큰 성능 향상을 얻는다는 메시지다.&lt;/li&gt;
&lt;li&gt;특히 retrieval, grounding, zero-shot recognition, dialogue 등 여러 task에서 고르게 강하다는 점은 이 모델이 단순 task-specific network가 아니라 &lt;b&gt;transferable representation learner&lt;/b&gt;에 가깝다는 것을 시사한다.&lt;/li&gt;
&lt;li&gt;또 하나의 의미는 &lt;b&gt;video-audio-speech-text fusion data quality&lt;/b&gt;가 매우 중요하다는 점이다. 이 논문은 대규모 비디오 모델 성능의 병목이 model architecture만이 아니라 &lt;b&gt;clip segmentation quality와 caption quality&lt;/b&gt;일 수 있음을 강조한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 알아야 하는가&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;최근 multimodal video model 논문 중 많은 수가 &amp;ldquo;더 큰 model&amp;rdquo;만 강조한다. 이 논문은 그것만으로는 부족하고, 어떤 단계로 학습시키는지와 어떤 형태의 multimodal caption을 주는지가 성능에 직접적 영향을 준다는 점을 꽤 설득력 있게 보여준다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;한계는-무엇인가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;9) 한계는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;논문이 스스로 명시한 가장 중요한 한계는 &lt;b&gt;specific novel architectural design이 없다&lt;/b&gt;는 점이다. 저자들 표현대로 이 논문은 새로운 구조를 제안하기보다는, 기존 학습 기법을 잘 조합하고 scale-up한 것이다.&lt;/li&gt;
&lt;li&gt;두 번째 한계는 &lt;b&gt;fixed input resolution, sampling rate, compressed token representation&lt;/b&gt;의 제약이다. 저자들은 이 때문에 rich video information과 fine-grained details를 충분히 담지 못한다고 인정한다. 즉 long video understanding을 강조하지만, 여전히 입력 representation의 병목이 있다.&lt;/li&gt;
&lt;li&gt;세 번째 한계는 &lt;b&gt;joint training의 scalability&lt;/b&gt; 문제다. 세 objective를 동시에 joint optimization하는 것이 원론적으로 가능하더라도, 실제 compute resource가 제한되면 scaling이 어렵다. 그래서 progressive scheme이 compute와 capability 사이의 타협으로 제시된다.&lt;/li&gt;
&lt;li&gt;네 번째 한계는 &lt;b&gt;implicit world model을 보장하지 못한다&lt;/b&gt;는 점이다. 저자들은 benchmark에서 reasoning 성능이 좋아도, visual reasoning의 consistency를 보장하는 world model을 형성했다고 단정할 수 없다고 명시한다. 즉 temporal reasoning이 잘 된다고 해서 진짜로 세계를 이해한다고 말할 수는 없다는 뜻이다.&lt;/li&gt;
&lt;li&gt;다섯 번째 한계는 &lt;b&gt;bias&lt;/b&gt;다. 논문은 synthetic caption을 기반으로 age, gender, race 분포를 분석했고, 분포 불균형이 존재한다고 보고한다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;adult 86.99%&lt;/li&gt;
&lt;li&gt;children 12.87%&lt;/li&gt;
&lt;li&gt;senior 0.04%&lt;/li&gt;
&lt;li&gt;men 62.04%&lt;/li&gt;
&lt;li&gt;women 37.96%&lt;/li&gt;
&lt;li&gt;race 분포도 불균형 존재&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;여섯 번째 한계는 실험적으로도 드러난다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;zero-shot K400에서는 VideoPrism보다 낮다.&lt;/li&gt;
&lt;li&gt;FineAction처럼 fine-grained discrimination이 중요한 task에서는 scaling 효과가 제한적이다.&lt;/li&gt;
&lt;li&gt;Egoschema처럼 longer context가 핵심인 benchmark에서는 여전히 proprietary model보다 약하다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;중요한 해석&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 &amp;ldquo;비디오를 정말 이해하는 world model&amp;rdquo;을 만든 논문이 아니다. 여러 video task에 잘 transfer되는 대규모 encoder를 만든 논문이다. reasoning benchmark 성능이 좋아도 consistency와 causality를 완전히 보장하지는 않는다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;최종-정리&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;10) 최종 정리&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;해결하려는 문제는 &lt;b&gt;perception, semantic alignment, dialogue/reasoning을 모두 아우르는 범용 multimodal video foundation model&lt;/b&gt;을 만드는 것이다.&lt;/li&gt;
&lt;li&gt;선행연구는 masked video modeling, video-text contrastive learning, next-token prediction/MLLM 연결로 나뉘어 발전해 왔다. 기존 two-stage 방식도 있었지만, 이 논문은 이를 더 확장해 세 단계를 progressive하게 묶는다.&lt;/li&gt;
&lt;li&gt;새로운 기여는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;3-stage progressive training&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;6B-scale video encoder&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;InternVid2와 VidCap 기반 multimodal captioning&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;semantic temporal segmentation(AutoShot)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;60개 이상 task에서 강한 범용 성능&lt;/b&gt; 이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;연구 방법은
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Stage 1에서 &lt;b&gt;InternVL + VideoMAEv2 teacher distillation&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Stage 2에서 &lt;b&gt;video-audio-speech-text contrastive/matching/MLM&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Stage 3에서 &lt;b&gt;QFormer + LLM 기반 next-token prediction&lt;/b&gt; 으로 요약된다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;실험적으로는 action recognition, retrieval, temporal grounding, audio task, video dialogue 전반에서 매우 강한 결과를 보인다. 특히 retrieval과 zero-shot/linear probing 결과가 좋아서 representation quality가 높다는 점이 설득력 있다.&lt;/li&gt;
&lt;li&gt;한계는 architecture novelty 부족, 입력 압축에 따른 세밀한 정보 손실, true world model 부재, bias 가능성, 일부 long-context / fine-grained task의 제한이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;가장 핵심만 아주 짧게&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 새로운 block 하나를 만든 논문이 아니다. 좋은 teacher, 좋은 multimodal data, 좋은 progressive training recipe를 큰 스케일에서 결합하면, video foundation model이 recognition부터 retrieval, grounding, dialogue까지 폭넓게 강해질 수 있음을 보여준 논문이다.&lt;/p&gt;
&lt;/details&gt;</description>
      <category>딥러닝 논문/비전 딥러닝 논문</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/55</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/REVIEW-INTERNVIDEO2-SCALING-FOUNDATION-MODELS-FOR-MULTIMODAL-VIDEO-UNDERSTANDING#entry55comment</comments>
      <pubDate>Tue, 10 Mar 2026 20:54:42 +0900</pubDate>
    </item>
    <item>
      <title>[REVIEW] VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/REVIEW-VideoMAE-Masked-Autoencoders-are-Data-Efficient-Learners-for-Self-Supervised-Video-Pre-Training</link>
      <description>&lt;h2 id=&quot;어떤-문제를-해결하고-싶은가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;1) 어떤 문제를 해결하고 싶은가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Video Transformer를 &lt;strong&gt;video dataset 자체만으로&lt;/strong&gt;, 그리고 &lt;strong&gt;extra image data 없이&lt;/strong&gt; 잘 pre-train하는 문제를 다룬다. 저자들은 기존에는 ViT 계열이 대체로 대규모 image pre-training에 의존했고, video dataset은 상대적으로 작아서 vanilla ViT를 video만으로 학습시키기 어렵다고 본다.&lt;/li&gt;
&lt;li&gt;구체적으로는 &lt;strong&gt;Self-Supervised Video Pre-Training(SSVP)&lt;/strong&gt; 에서 masked autoencoding을 쓰되, image용 MAE를 그대로 video에 가져오면 잘 안 맞는다는 점이 핵심 문제다. 이유는 video에는 &lt;strong&gt;temporal redundancy&lt;/strong&gt;와 &lt;strong&gt;temporal correlation&lt;/strong&gt;이 있기 때문이다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;temporal redundancy&lt;/strong&gt;는 연속 frame들이 너무 비슷해서, 적당한 masking 비율로는 reconstruction task가 너무 쉬워지는 문제를 만든다. 그러면 모델이 motion이나 high-level spatiotemporal structure를 배우지 못한다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;temporal correlation&lt;/strong&gt;은 인접 frame 사이에 대응되는 patch가 존재해서, masked patch를 주변 frame에서 거의 복사하듯 복원하는 &lt;strong&gt;information leakage&lt;/strong&gt; 문제가 생긴다. 그러면 모델이 semantic reasoning 대신 저수준 correspondence만 익힐 수 있다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;image MAE에서는 “가려진 patch를 주변 맥락으로 복원”하는 것이 충분히 어려운 문제다. video에서는 옆 frame에 거의 같은 장면이 다시 나온다. 그래서 복원이 “내용을 이해해서 맞추는 문제”가 아니라 “시간축 옆에서 베껴오는 문제”가 되기 쉽다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;선행연구는-어땠는가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;2) 선행연구는 어땠는가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;기존 &lt;strong&gt;video representation learning&lt;/strong&gt;은 크게 supervised learning, semi-supervised learning, multimodal contrastive learning, self-supervised learning으로 나뉜다. supervised video recognition은 image backbone에 의존하는 경우가 많았고, video transformer도 대개 image-pretrained model에서 출발했다.&lt;/li&gt;
&lt;li&gt;기존 &lt;strong&gt;self-supervised video learning&lt;/strong&gt;은 temporal order prediction, speed prediction 같은 pretext task나 contrastive learning이 중심이었다. contrastive 계열은 strong augmentation과 large batch size에 많이 의존한다는 한계가 있었다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;masked visual modeling&lt;/strong&gt;은 image domain에서 이미 성공적이었다. BERT식 token prediction, BEiT, MAE, MaskFeat 등이 있었고, image에서는 masked autoencoding이 강력한 self-supervision이 되었다.&lt;/li&gt;
&lt;li&gt;video 쪽 masked modeling도 있었지만, 이 논문은 그중에서도 &lt;strong&gt;plain ViT backbone을 그대로 쓰면서 pixel reconstruction을 하는 단순한 masked video pre-training&lt;/strong&gt;을 전면에 내세운다. 저자들은 이것이 최초의 plain ViT 기반 masked video pre-training framework라고 주장한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;

&lt;p&gt;이 논문 이전에도 video self-supervision은 많았다. 하지만 대부분은 CNN backbone이거나, contrastive objective를 쓰거나, discrete token prediction 같은 더 복잡한 설계를 썼다. 이 논문은 “정말 단순한 MAE가 video에도 통하느냐”를 정면으로 검증했다는 점이 중요하다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;이-논문에서-하는-새로운-기여는-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;3) 이 논문에서 하는 새로운 기여는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;p&gt;![[Pasted image 20260310193245.png]]&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;핵심 기여는 &lt;strong&gt;VideoMAE&lt;/strong&gt;라는 단순한 self-supervised video pre-training 방법을 제안한 것이다. 구조 자체는 MAE와 유사하지만, video 특성에 맞춰 두 가지 설계를 넣는다. &lt;strong&gt;extremely high masking ratio&lt;/strong&gt;와 &lt;strong&gt;tube masking&lt;/strong&gt;이다.&lt;/li&gt;
&lt;li&gt;첫째 기여는 &lt;strong&gt;masking ratio를 90%~95%까지 매우 높여도 잘 작동한다&lt;/strong&gt;는 실증이다. 저자들은 video가 image보다 정보 밀도가 낮고 temporal redundancy가 높기 때문에 높은 masking이 오히려 더 적절하다고 보인다. 실제로 best ratio가 매우 높게 나온다.&lt;/li&gt;
&lt;li&gt;둘째 기여는 &lt;strong&gt;tube masking&lt;/strong&gt;이다. 모든 frame이 동일한 spatial masking map을 공유하게 해서 시간축으로 마스크가 “tube”처럼 이어지게 만든다. 이렇게 하면 adjacent frame에서 대응 patch를 찾아 복원하는 leakage를 줄인다.&lt;/li&gt;
&lt;li&gt;셋째 기여는 &lt;strong&gt;data efficiency&lt;/strong&gt;를 강하게 보여준 점이다. 저자들은 VideoMAE가 3.5k 수준의 작은 dataset(HMDB51)에서도 의미 있게 작동한다고 보고한다. 이는 video transformer를 limited data에서도 self-supervised하게 학습할 수 있음을 보여준다.&lt;/li&gt;
&lt;li&gt;넷째 기여는 &lt;strong&gt;data quality가 data quantity보다 중요하다&lt;/strong&gt;는 관찰이다. pre-training set 규모가 더 커도 domain shift가 크면 target dataset에서 불리할 수 있고, 작은 데이터라도 target domain에 더 맞으면 성능이 더 좋아질 수 있다고 보고한다.&lt;/li&gt;
&lt;li&gt;결과적으로 이 논문은 &lt;strong&gt;video masked modeling에서는 image와 다른 설계 원리가 필요하다&lt;/strong&gt;는 점을 분명히 정리했다. 특히 “높은 masking이 안 될 것”이라는 직관을 뒤집고, video에서는 오히려 그것이 핵심이 된다고 보여준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;border:1px solid #e6e6e6;border-radius:10px;background:#ffffff;padding:14px 16px;margin:18px 0;&quot;&gt;&lt;div style=&quot;display:flex;align-items:center;gap:10px;font-weight:700;font-size:16px;color:#111;margin:0 0 12px 0;&quot;&gt;&lt;span style=&quot;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:6px;background:#f2f2f2;font-size:14px;flex:0 0 auto;&quot;&gt;✏️&lt;/span&gt;&lt;span&gt;Note · 한 줄 핵심&lt;/span&gt;&lt;/div&gt;&lt;p&gt;이 논문의 새로움은 “video에서는 더 많이 가리고, 시간축 전체를 같이 가려야 한다”는 설계를 매우 단순한 형태로 제시하고, 그게 실제로 잘 된다는 것을 대규모 실험으로 보여준 데 있다.&lt;/p&gt;&lt;/div&gt;

&lt;hr /&gt;
&lt;h2 id=&quot;연구-방법은-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4) 연구 방법은 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;전체-파이프라인&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-1. 전체 파이프라인&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;입력은 downsampled video clip이다.&lt;/li&gt;
&lt;li&gt;video를 &lt;strong&gt;cube token&lt;/strong&gt;으로 나눈다.&lt;/li&gt;
&lt;li&gt;대부분의 token을 masking한다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;visible token만 encoder&lt;/strong&gt;에 넣는다.&lt;/li&gt;
&lt;li&gt;decoder는 visible token과 learnable mask token을 합쳐 원래 video를 reconstruction한다.&lt;/li&gt;
&lt;li&gt;loss는 masked token에 대한 &lt;strong&gt;pixel-space MSE loss&lt;/strong&gt;다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;image MAE와 큰 틀은 같다. 차이는 “video라는 데이터의 시간축 구조 때문에 어떤 masking을 하느냐”가 성능을 거의 결정한다는 점이다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;video-데이터-특성-분석&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-2. Video 데이터 특성 분석&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;저자들은 method를 바로 제안하지 않고, 먼저 video의 두 성질을 분석한다. &lt;strong&gt;temporal redundancy&lt;/strong&gt;와 &lt;strong&gt;temporal correlation&lt;/strong&gt;이다.&lt;/li&gt;
&lt;li&gt;temporal redundancy 때문에 인접 frame은 매우 비슷하다. 따라서 원래 frame rate를 그대로 쓰면 static content 비중이 커지고, motion representation 학습이 약해질 수 있다.&lt;/li&gt;
&lt;li&gt;temporal correlation 때문에 plain random masking이나 frame masking에서는 masked patch의 대응 patch를 adjacent frame에서 쉽게 찾을 수 있다. 그 결과 reconstruction이 너무 쉬워진다. Figure 2는 random masking, frame masking, tube masking의 차이를 시각적으로 보여준다. tube masking에서는 같은 spatial 위치가 모든 frame에서 함께 가려진다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;![[Pasted image 20260310193337.png]]&lt;/p&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;temporal-downsampling&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-3. Temporal downsampling&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;먼저 원본 video에서 연속된 &lt;span class=&quot;math inline&quot;&gt;\(t\)&lt;/span&gt;개의 frame clip을 뽑은 뒤, temporal stride를 두고 downsample하여 &lt;span class=&quot;math inline&quot;&gt;\(T\)&lt;/span&gt; frame만 사용한다. 이는 redundancy를 줄이기 위한 설계다.&lt;/li&gt;
&lt;li&gt;실험에서는 Kinetics에서는 stride &lt;span class=&quot;math inline&quot;&gt;\(\tau=4\)&lt;/span&gt;, Something-Something에서는 &lt;span class=&quot;math inline&quot;&gt;\(\tau=2\)&lt;/span&gt;를 사용한다. Something-Something이 motion-centric dataset이어서 temporal resolution을 더 보존하려는 선택으로 읽힌다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;cube-embedding&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-4. Cube embedding&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;이 논문은 2D patch가 아니라 &lt;strong&gt;3D cube&lt;/strong&gt;를 token으로 쓴다.&lt;/li&gt;
&lt;li&gt;각 token의 크기는 &lt;strong&gt;&lt;span class=&quot;math inline&quot;&gt;\(2 \times 16 \times 16\)&lt;/span&gt;&lt;/strong&gt; 이다. 즉 temporal 길이 2, spatial patch 16x16을 한 token으로 묶는다.&lt;/li&gt;
&lt;li&gt;이렇게 하면 최종 token 수는 &lt;span class=&quot;math inline&quot;&gt;\(T/2 \times H/16 \times W/16\)&lt;/span&gt;이 된다. 공간축과 시간축을 동시에 줄여 redundancy를 더 완화한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;

&lt;p&gt;video를 frame별 2D patch로만 자르면 temporal dimension이 너무 길어진다. cube embedding은 시간축도 같이 압축하므로 computation을 줄이고, local motion 단위를 token화하는 효과가 있다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;tube-masking-with-extremely-high-ratio&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-5. Tube masking with extremely high ratio&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;이 논문의 가장 중요한 설계다.&lt;/li&gt;
&lt;li&gt;masking ratio를 &lt;strong&gt;90% 전후&lt;/strong&gt;, 경우에 따라 &lt;strong&gt;95%&lt;/strong&gt;까지 올린다. 저자들은 video가 image보다 중복이 심해서 높은 masking이 더 의미 있는 reconstruction task를 만든다고 주장한다.&lt;/li&gt;
&lt;li&gt;단순 random masking이 아니라 &lt;strong&gt;tube masking&lt;/strong&gt;을 쓴다. 수학적으로는 spatial position &lt;span class=&quot;math inline&quot;&gt;\((x,y)\)&lt;/span&gt;에 대해 mask 여부를 샘플링하고, 그 값이 시간축 전체에 공유된다. 즉 서로 다른 &lt;span class=&quot;math inline&quot;&gt;\(t\)&lt;/span&gt;가 같은 masking 값을 가진다.&lt;/li&gt;
&lt;li&gt;이렇게 하면 특정 spatial 위치의 temporal neighbors가 모두 함께 가려지므로, adjacent frame에서 같은 물체 패치를 가져오는 shortcut이 어려워진다. 저자들은 이것이 특히 &lt;strong&gt;no motion 혹은 negligible motion인 cube&lt;/strong&gt;에서 leakage를 막는 데 유효하다고 설명한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;backbone과-attention&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-6. Backbone과 attention&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;backbone은 &lt;strong&gt;vanilla ViT&lt;/strong&gt;다.&lt;/li&gt;
&lt;li&gt;attention은 &lt;strong&gt;joint space-time attention&lt;/strong&gt;을 사용한다. 즉 남아 있는 token들이 공간과 시간 전체에 걸쳐 서로 상호작용한다.&lt;/li&gt;
&lt;li&gt;높은 masking 비율 덕분에 encoder에 들어가는 token 수가 적어서, 원래 quadratic complexity가 큰 joint attention도 계산 가능해진다. 이것이 성능 향상뿐 아니라 efficiency 측면에서도 중요하다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;loss&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-7. Loss&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;복원 loss는 &lt;strong&gt;masked token에 대한 normalized pixel MSE loss&lt;/strong&gt;다. ImageMAE와 유사한 형태다. 식은 masked set &lt;span class=&quot;math inline&quot;&gt;\(\Omega\)&lt;/span&gt;에 대해 reconstruction error를 평균하는 구조다.&lt;/li&gt;
&lt;li&gt;ablation에서 &lt;strong&gt;MSE loss&lt;/strong&gt;가 L1, smooth L1보다 더 좋았다. Something-Something V2에서는 69.6, Kinetics-400에서는 80.0 top-1을 기록했다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h3 id=&quot;실험-설정&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4-8. 실험 설정&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;평가 dataset은 &lt;strong&gt;Kinetics-400, Something-Something V2, UCF101, HMDB51, AVA&lt;/strong&gt;다. action classification과 action detection 전이를 모두 본다.&lt;/li&gt;
&lt;li&gt;기본 backbone은 &lt;strong&gt;16-frame ViT-B&lt;/strong&gt;다. ablation은 주로 SSV2와 K400에서 수행한다.&lt;/li&gt;
&lt;li&gt;appendix의 architecture table에 따르면, 16-frame ViT-B 예시에서 encoder는 12 block, decoder는 4 block이며, decoder hidden width는 384다. page 16 Table 8에 이 구조가 요약되어 있다.&lt;/li&gt;
&lt;li&gt;pre-training optimizer는 &lt;strong&gt;AdamW&lt;/strong&gt;, batch size 1024, cosine decay, warmup 40 epoch를 쓴다. fine-tuning에서도 AdamW를 사용한다. page 17 Table 9, Table 10에 세부 hyperparameter가 정리되어 있다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;실험-결과와-해석&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5) 실험 결과와 해석&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;ablation-decoder-depth&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5-1. Ablation: decoder depth&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;decoder depth를 1, 2, 4, 8 block으로 바꿔보면 &lt;strong&gt;4 block&lt;/strong&gt;이 가장 좋은 trade-off를 보인다.&lt;/li&gt;
&lt;li&gt;SSV2에서는 68.5, 69.2, 69.6, 69.3이고, K400에서는 79.0, 79.2, 80.0, 79.7이다.&lt;/li&gt;
&lt;li&gt;GPU memory는 block 수가 늘수록 크게 증가한다. 4 block에서 14.7G, 8 block에서 23.7G다. page 6 Table 1a가 이 결과를 보여준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;ablation-masking-strategy&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5-2. Ablation: masking strategy&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tube 90%&lt;/strong&gt;가 가장 좋다.&lt;/li&gt;
&lt;li&gt;tube 75는 SSV2 68.0, K400 79.8&lt;/li&gt;
&lt;li&gt;tube 90은 SSV2 69.6, K400 80.0&lt;/li&gt;
&lt;li&gt;random 90은 SSV2 68.3, K400 79.5&lt;/li&gt;
&lt;li&gt;frame masking은 SSV2 61.5, K400 76.5다.&lt;/li&gt;
&lt;li&gt;해석은 분명하다. 높은 비율로 많이 가리는 것 자체가 중요하고, 동시에 시간축 전체를 같이 가리는 tube structure가 추가 이득을 준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;ablation-reconstruction-target&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5-3. Ablation: reconstruction target&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;center frame만 reconstruction target으로 쓰면 성능이 크게 떨어진다. SSV2 63.0, K400 79.3이다.&lt;/li&gt;
&lt;li&gt;input으로 쓴 downsampled clip 전체를 그대로 target으로 재구성하는 것이 기본값이며 가장 안정적이다.&lt;/li&gt;
&lt;li&gt;이는 VideoMAE가 단순히 한 장면의 appearance 복원이 아니라 &lt;strong&gt;clip-level spatiotemporal structure&lt;/strong&gt;를 학습해야 성능이 좋아짐을 뜻한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;ablation-pre-training-strategy&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5-4. Ablation: pre-training strategy&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;from scratch: SSV2 32.6, K400 68.8&lt;/li&gt;
&lt;li&gt;ImageNet-21k supervised pre-training: SSV2 61.8, K400 78.9&lt;/li&gt;
&lt;li&gt;IN-21k + K400 supervised: SSV2 65.2&lt;/li&gt;
&lt;li&gt;VideoMAE: SSV2 69.6, K400 80.0&lt;/li&gt;
&lt;li&gt;즉 video transformer를 video dataset 자체에서 self-supervised하게 학습한 VideoMAE가 supervised image pre-training보다도 더 좋다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;ablation-pre-training-dataset&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5-5. Ablation: pre-training dataset&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;ImageMAE를 ImageNet-1K에서 학습해 옮기는 것보다, target video dataset에서 직접 VideoMAE pre-training한 것이 더 좋다. SSV2 기준 ImageMAE 64.8, K400-trained VideoMAE 68.5, SSV2-trained VideoMAE 69.6이다.&lt;/li&gt;
&lt;li&gt;이 결과는 단순히 scale이 아니라 &lt;strong&gt;domain match&lt;/strong&gt;가 중요함을 시사한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;메인-결과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6) 메인 결과&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;data-efficiency&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6-1. Data efficiency&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Table 2에서 VideoMAE는 모든 dataset에서 from scratch와 MoCo v3를 크게 이긴다.&lt;/li&gt;
&lt;li&gt;K400: from scratch 68.8, MoCo v3 74.2, VideoMAE 80.0&lt;/li&gt;
&lt;li&gt;SSV2: from scratch 32.6, MoCo v3 54.2, VideoMAE 69.6&lt;/li&gt;
&lt;li&gt;UCF101: from scratch 51.4, MoCo v3 81.7, VideoMAE 91.3&lt;/li&gt;
&lt;li&gt;HMDB51: from scratch 18.0, MoCo v3 39.2, VideoMAE 62.6&lt;/li&gt;
&lt;li&gt;특히 HMDB51처럼 train clip이 약 3.5k 수준인 매우 작은 데이터에서도 62.6을 달성한다는 점이 이 논문의 가장 강한 메시지 중 하나다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;efficiency&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6-2. Efficiency&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Table 3에서 pre-training 시간은 MoCo v3가 61.7시간, VideoMAE가 19.5시간이다. speedup은 &lt;strong&gt;3.2x&lt;/strong&gt;다.&lt;/li&gt;
&lt;li&gt;VideoMAE는 epoch 수는 더 많이 필요하지만(800 vs. 300), encoder가 visible token만 처리하고 masking ratio가 매우 높아서 실제 wall-clock time이 더 짧다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;high-masking-ratio-효과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6-3. High masking ratio 효과&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Figure 3에서 masking ratio 90%가 SSV2와 K400 모두에서 가장 좋은 지점이다.&lt;/li&gt;
&lt;li&gt;SSV2는 50%에서 65.2, 75%에서 68.0, 90%에서 69.6, 95%에서 69.3, 98%에서 67.8 정도다.&lt;/li&gt;
&lt;li&gt;K400은 50%에서 78.5, 75%에서 79.8, 90%에서 80.0, 95%에서 79.8, 98%에서 78.6 정도다. page 8 Figure 3이 이 곡선을 보여준다.&lt;/li&gt;
&lt;li&gt;95%에서도 성능이 크게 무너지지 않는다는 점이 중요하다. video의 redundancy가 그만큼 높다는 뜻이기도 하다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;transfer-learning-quality-vs.-quantity&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6-4. Transfer learning: quality vs. quantity&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;K400에서 pre-train한 VideoMAE를 다른 dataset에 transfer하면, UCF101과 HMDB51에서는 매우 좋지만 SSV2에서는 자체 pre-training보다 약간 불리하다. Table 4에서 K400→SSV2 68.5, K400→UCF 96.1, K400→HMDB 73.3이다.&lt;/li&gt;
&lt;li&gt;Figure 4에 따르면 SSV2에서는 pre-training 데이터 수를 줄여도, target domain 자체에서 학습한 representation이 K400에서 옮긴 representation보다 더 좋을 수 있다. 저자들은 이를 &lt;strong&gt;domain shift&lt;/strong&gt; 문제로 해석한다.&lt;/li&gt;
&lt;li&gt;결론은 분명하다. self-supervised pre-training에서는 dataset 규모만 크게 늘리는 것이 아니라, &lt;strong&gt;target task와 얼마나 같은 분포인가&lt;/strong&gt;가 결정적이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;downstream-action-detection&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6-5. Downstream action detection&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;AVA action detection에서도 transfer가 잘 된다.&lt;/li&gt;
&lt;li&gt;VideoMAE ViT-B, K400 pre-training, extra labels 없음: &lt;strong&gt;26.7 mAP&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;같은 모델을 K400 label로 추가 fine-tuning 후 transfer: &lt;strong&gt;31.8 mAP&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;더 큰 backbone과 dataset으로 scale-up하면 ViT-L K700은 39.3, ViT-H K400은 39.5 mAP를 기록한다. Table 5가 이를 보여준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;sota-비교&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;6-6. SOTA 비교&lt;/mark&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Something-Something V2에서 VideoMAE는 extra data 없이도 매우 강하다.&lt;/li&gt;
&lt;li&gt;ViT-L, 32 frame 설정에서 &lt;strong&gt;75.4% top-1&lt;/strong&gt;을 달성한다.&lt;/li&gt;
&lt;li&gt;Kinetics-400에서는 ViT-H, 32 frame, higher resolution 설정으로 &lt;strong&gt;87.4% top-1&lt;/strong&gt;을 달성한다.&lt;/li&gt;
&lt;li&gt;논문 초록에서도 87.4(K400), 75.4(SSV2), 91.3(UCF101), 62.6(HMDB51)을 핵심 결과로 제시한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;이-논문이-주는-해석&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;7) 이 논문이 주는 해석&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;video masked modeling의 핵심 난점은 “복원이 너무 쉬워진다”는 데 있다.&lt;/li&gt;
&lt;li&gt;이 논문은 그 문제를 &lt;strong&gt;더 많이 가리고&lt;/strong&gt;, &lt;strong&gt;시간축으로 같이 가리는&lt;/strong&gt; 매우 단순한 설계로 해결했다.&lt;/li&gt;
&lt;li&gt;따라서 이 논문의 본질은 “masked reconstruction이 좋은가” 자체보다, &lt;strong&gt;video에서 reconstruction task를 어떻게 genuinely hard하게 만들 것인가&lt;/strong&gt;에 있다.&lt;/li&gt;
&lt;li&gt;또 하나의 메시지는 &lt;strong&gt;vanilla ViT도 잘 설계된 self-supervision만 있으면 video에서 충분히 강해질 수 있다&lt;/strong&gt;는 것이다. 이건 당시 video transformer가 image pre-training에 크게 의존하던 흐름과 대비되는 결과다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;쉽게 설명하면&lt;/summary&gt;

&lt;p&gt;이 논문은 video를 보면서 “중요한 부분 대부분을 일부러 가려버리고, 남은 아주 적은 단서만으로 전체 영상을 맞히게” 만든다. 그런데 그냥 가리면 옆 frame을 보고 베껴서 맞출 수 있다. 그래서 같은 위치를 시간축 전체에서 통째로 가린다. 이렇게 해야 모델이 물체와 동작의 전체 구조를 이해해야만 복원할 수 있다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;한계는-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;8) 한계는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;저자들이 명시적으로 인정한 한계는 &lt;strong&gt;RGB stream만 사용한다&lt;/strong&gt;는 점이다. audio나 text를 함께 쓰지 않는다. future work로 audio/text 활용을 제안한다.&lt;/li&gt;
&lt;li&gt;pre-training은 여전히 계산량이 크고, broader impact에서 &lt;strong&gt;energy consumption&lt;/strong&gt; 문제를 언급한다. 대규모 pre-training은 carbon emission을 유발할 수 있다.&lt;/li&gt;
&lt;li&gt;방법론적으로 보면, 매우 높은 masking ratio는 강력하지만 동시에 &lt;strong&gt;작은 motion token이 전부 masking될 위험&lt;/strong&gt;도 있다. appendix의 error analysis에서 저자들은 아주 작은 물체 motion을 놓치는 사례를 언급한다. 이는 high masking의 부작용으로 해석할 수 있다. page 19의 분석에서 작은 motion pattern이 모두 masked될 수 있다고 설명한다.&lt;/li&gt;
&lt;li&gt;논문은 classification과 detection에선 강하지만, &lt;strong&gt;temporal localization&lt;/strong&gt;이나 &lt;strong&gt;fine-grained event order reasoning&lt;/strong&gt; 같은 더 정밀한 temporal task를 본격적으로 다루지는 않는다. 따라서 “spatiotemporal representation을 잘 배운다”는 주장과 “긴 시간 구조를 완전히 이해한다”는 주장은 동일하지 않다. 이 부분은 실험 범위의 한계다.&lt;/li&gt;
&lt;li&gt;domain shift의 중요성을 보여주긴 했지만, 이를 해결하는 별도 메커니즘은 제시하지 않는다. 즉 “quality가 중요하다”는 관찰은 있지만, 어떤 source dataset이 어떤 target에 잘 맞는지 자동으로 판단하는 방법은 없다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;최종-정리&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;9) 최종 정리&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;해결하려는 문제는 &lt;strong&gt;extra data 없이도 video transformer를 data-efficient하게 self-supervised pre-train하는 것&lt;/strong&gt;이다.&lt;/li&gt;
&lt;li&gt;선행연구는 contrastive learning, temporal pretext task, image-based pre-training, 기존 masked modeling이 중심이었다. 하지만 video 고유의 redundancy와 correlation 문제를 충분히 처리하지 못했다.&lt;/li&gt;
&lt;li&gt;새 기여는 &lt;strong&gt;VideoMAE&lt;/strong&gt;, 특히 &lt;strong&gt;90~95% high masking ratio&lt;/strong&gt;와 &lt;strong&gt;tube masking&lt;/strong&gt;이다.&lt;/li&gt;
&lt;li&gt;연구 방법은 temporal downsampling, cube embedding, asymmetric encoder-decoder, joint space-time attention, masked pixel MSE reconstruction이다.&lt;/li&gt;
&lt;li&gt;한계는 RGB-only, 큰 계산량, 작은 motion 손실 가능성, domain shift 해결 부재다.&lt;/li&gt;
&lt;li&gt;실험적으로는 K400 87.4, SSV2 75.4, UCF101 91.3, HMDB51 62.6을 기록했고, 특히 작은 dataset에서도 잘 되는 &lt;strong&gt;data-efficient learner&lt;/strong&gt;라는 점이 논문의 핵심 결론이다.&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>딥러닝 논문/비전 딥러닝 논문</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/54</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/REVIEW-VideoMAE-Masked-Autoencoders-are-Data-Efficient-Learners-for-Self-Supervised-Video-Pre-Training#entry54comment</comments>
      <pubDate>Tue, 10 Mar 2026 19:36:13 +0900</pubDate>
    </item>
    <item>
      <title>REVIEW MovieChat: From Dense Token to Sparse Memory for Long Video Understanding</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/REVIEW-MovieChat-From-Dense-Token-to-Sparse-Memory-for-Long-Video-Understanding</link>
      <description>&lt;h2 id=&quot;어떤-문제를-해결하고-싶은가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;1) 어떤 문제를 해결하고 싶은가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;이 논문은 &lt;strong&gt;long video understanding&lt;/strong&gt; 문제를 다룬다. 기존 Video-LLM 계열 시스템은 몇십~몇백 프레임 수준에서는 동작하지만, &lt;strong&gt;1분 이상 길이의 비디오&lt;/strong&gt;, 특히 &lt;strong&gt;10K frames 이상&lt;/strong&gt;의 비디오를 처리할 때 &lt;strong&gt;computation complexity&lt;/strong&gt;, &lt;strong&gt;memory cost&lt;/strong&gt;, &lt;strong&gt;long-term temporal connection&lt;/strong&gt; 문제가 커진다고 본다.&lt;/li&gt;
&lt;li&gt;저자들은 기존 방법이 긴 비디오를 제대로 다루지 못하는 핵심 이유를 세 가지로 정리한다.
&lt;ul&gt;
&lt;li&gt;많은 프레임을 한꺼번에 넣기 어려운 &lt;strong&gt;VRAM/GPU memory&lt;/strong&gt; 제약&lt;/li&gt;
&lt;li&gt;프레임 수가 길어질수록 커지는 &lt;strong&gt;연산량&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;멀리 떨어진 장면 사이 관계를 유지하기 어려운 &lt;strong&gt;long-term temporal connection&lt;/strong&gt; 문제다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;논문은 단순히 “비디오를 더 길게 넣자”가 아니라, &lt;strong&gt;긴 비디오를 기억 구조(memory mechanism)로 요약하면서도 질문응답이 가능하게 만드는 시스템&lt;/strong&gt;을 만들고자 한다. 특히 전체 영상을 묻는 질문과 특정 시점을 묻는 질문을 모두 처리하는 것이 목표다.&lt;/li&gt;
&lt;li&gt;그림 1의 주장도 이 문제의식과 직접 연결된다. 기존 방법들은 약 100 frames 수준에서 VRAM 부담이 커지지만, 이 방법은 &lt;strong&gt;24GB GPU에서 10K+ frames&lt;/strong&gt;까지 다룰 수 있다고 주장한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;이 논문은 긴 영상을 처음부터 끝까지 모두 dense하게 기억하는 대신, &lt;strong&gt;중요하지 않은 중복은 압축하고, 필요한 정보만 남겨서 “기억”처럼 저장&lt;/strong&gt;하는 구조를 만들겠다는 작업이다. 핵심은 video token을 전부 들고 가는 것이 아니라, &lt;strong&gt;dense token을 sparse memory로 바꾸는 것&lt;/strong&gt;이다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;선행연구는-어땠는가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;2) 선행연구는 어땠는가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MLLM / Video-LLM 계열 선행연구&lt;/strong&gt;로 Flamingo, BLIP-2, MiniGPT-4, Otter, VideoChat, Video-LLaMA, ChatVideo 등을 언급한다. 이들은 대체로 &lt;strong&gt;pretrained visual encoder + pretrained LLM + additional adapter/Q-former/projection&lt;/strong&gt; 구조를 사용한다. 비디오 분야에서도 같은 패러다임이 쓰였지만, 저자들은 이들이 &lt;strong&gt;long video understanding에는 적합하지 않다&lt;/strong&gt;고 본다. 이유는 높은 계산비용, 큰 메모리 비용, 약한 장기 시간 연결성 때문이다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;long video understanding&lt;/strong&gt; 쪽 선행연구는 3D CNN 기반 long-term feature bank, object/human-centric motion, MIST 같은 효율화 방법이 있었다. 그러나 이 계열은 주로 전통적인 video understanding 문제를 다뤘고, &lt;strong&gt;LLM과 결합된 open-ended long video understanding&lt;/strong&gt;으로 이어지지는 못했다고 정리한다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;dataset/benchmark&lt;/strong&gt;도 부족했다고 본다. 기존 long-video 관련 데이터셋은 event boundary detection, language grounding, movie QA 등 일부 과제는 지원했지만, 저자 기준으로는 &lt;strong&gt;긴 비디오 전체 이해와 시점별 질문응답을 함께 평가하는 benchmark&lt;/strong&gt;가 없었다고 본다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memory model&lt;/strong&gt; 관련 선행연구는 VOS, MOT, VOT, action understanding에서 이미 존재했다. 예를 들어 XMem, MeMOT 같은 방법이 메모리를 활용한다. 이 논문은 그 흐름을 받아들여, 비디오 토큰의 redundancy를 줄이고 긴 시간 범위에서 정보를 전달하는 memory mechanism을 LLM과 결합한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;이-논문에서-하는-새로운-기여는-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;3) 이 논문에서 하는 새로운 기여는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;논문이 명시적으로 제시한 기여는 세 가지다.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;10K frames 이상 long video understanding을 지원하는 최초의 framework&lt;/strong&gt; 제시&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memory management mechanism&lt;/strong&gt; 제안&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MovieChat-1K benchmark&lt;/strong&gt; 공개 및 정량/정성 평가 수행이다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;구체적으로 새로운 점은 다음과 같다.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;dense token → sparse memory&lt;/strong&gt; 변환: short-term memory에 쌓인 frame token을 그대로 오래 저장하지 않고, 인접 프레임 similarity를 이용해 점진적으로 merge해서 long-term memory에 저장한다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;short-term memory / long-term memory 분리&lt;/strong&gt;: Atkinson-Shiffrin memory model에서 영감을 받아, 빠르게 갱신되는 short-term memory와 압축된 long-term memory를 나눈다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;두 가지 inference mode&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Global mode&lt;/strong&gt;: 전체 비디오에 대한 이해&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Breakpoint mode&lt;/strong&gt;: 특정 시점 이해 로 나눠서 long video QA를 설계한다. breakpoint mode에서는 long-term memory뿐 아니라 current short-term memory와 current frame feature까지 함께 사용한다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;benchmark contribution&lt;/strong&gt;: 1K개의 긴 비디오와 약 14K 수작업 annotation으로 long video understanding 평가셋을 만든다. 본문에서는 14K manual annotations라고 하고, supplementary 비교표에서는 13K QA pairs라고 적혀 있다. 이 부분은 문서 내 표기 차이가 있다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;핵심 novelty 한 줄&lt;/summary&gt;

&lt;p&gt;이 논문의 핵심 기여는 &lt;strong&gt;긴 비디오를 모두 token으로 들고 있지 않고, memory consolidation으로 압축하면서도 QA 성능을 유지하는 구조&lt;/strong&gt;를 제안한 데 있다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;연구-방법은-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;4) 연구 방법은 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;h2 id=&quot;전체-구조&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;전체 구조&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;시스템은 크게
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;visual feature extractor&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;short-term memory&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;long-term memory&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;projection layer&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LLM&lt;/strong&gt; 로 구성된다. 그림 2가 전체 흐름을 보여준다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;raw video를 한꺼번에 넣지 않고, &lt;strong&gt;sliding window&lt;/strong&gt; 방식으로 잘라 처리한다. 각 프레임을 token 형태 feature로 바꾼 뒤 순차적으로 short-term memory에 넣고, short-term memory가 차면 memory consolidation을 거쳐 long-term memory로 압축 저장한다. 이후 질문과 함께 LLM에 넣어 답을 생성한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;visual-feature-extraction&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Visual Feature Extraction&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;video foundation model 대신 &lt;strong&gt;image-based model&lt;/strong&gt;을 쓴다. 구체적으로 &lt;strong&gt;EVA-CLIP의 ViT-G/14&lt;/strong&gt;와 &lt;strong&gt;BLIP-2의 Q-former&lt;/strong&gt;를 visual feature extractor로 사용한다. 저자들이 video foundation model을 쓰지 않은 이유는
&lt;ul&gt;
&lt;li&gt;text alignment가 좋은 video foundation model이 많지 않고&lt;/li&gt;
&lt;li&gt;자신들의 memory mechanism이 temporal feature를 포착할 수 있다고 보기 때문이다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;입력 비디오 &lt;span class=&quot;math inline&quot;&gt;\(v \in \mathbb{Z}^{T \times 3 \times H \times W}\)&lt;/span&gt; 에 대해, sliding window마다 &lt;span class=&quot;math inline&quot;&gt;\(C\)&lt;/span&gt;개의 프레임을 처리하고 각 프레임에서 &lt;span class=&quot;math inline&quot;&gt;\(N\)&lt;/span&gt;개의 visual token을 뽑는다. 식 (1)은 이를 &lt;span class=&quot;math inline&quot;&gt;\(B_n = \{x_i = V(v_i)\}\)&lt;/span&gt; 형태로 적는다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;short-term-memory&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Short-term Memory&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;short-term memory는 &lt;strong&gt;fixed-length temporary buffer&lt;/strong&gt;다. 최근에 본 프레임 token들을 저장한다. 식 (2)에서 short-term memory &lt;span class=&quot;math inline&quot;&gt;\(S\)&lt;/span&gt;는 최근 여러 sliding window의 frame token을 합친 구조다.&lt;/li&gt;
&lt;li&gt;update 방식은 &lt;strong&gt;FIFO queue&lt;/strong&gt;다. 새 token이 들어와 capacity에 도달하면, 현재 short-term memory를 memory consolidation module로 넘기고 short-term memory를 비운다. consolidation 결과는
&lt;ul&gt;
&lt;li&gt;long-term memory를 augment하고&lt;/li&gt;
&lt;li&gt;다음 short-term memory의 initialization에도 쓰인다. 이 initialization은 서로 다른 sliding window 사이 정보 전달을 위한 장치다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;long-term-memory와-memory-consolidation&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Long-term Memory와 Memory Consolidation&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;핵심 아이디어는 &lt;strong&gt;비디오의 temporal redundancy&lt;/strong&gt;를 이용하는 것이다. 인접 프레임은 시각적으로 거의 같을 때가 많으므로, short-term memory에서 long-term memory로 넘길 때 &lt;strong&gt;인접하고 유사한 프레임을 merge&lt;/strong&gt;한다.&lt;/li&gt;
&lt;li&gt;방법은 ToMe 스타일 merge를 따른다. 각 인접 프레임 쌍의 token embedding cosine similarity 평균을 계산하고, 가장 유사한 pair를 greedy하게 골라 &lt;strong&gt;weighted averaging&lt;/strong&gt;으로 합친다. 이 과정을 반복해 최종적으로 &lt;span class=&quot;math inline&quot;&gt;\(R_L\)&lt;/span&gt;개 frame 수준 representation만 남긴다. 식 (3)과 Algorithm 1이 이를 설명한다.&lt;/li&gt;
&lt;li&gt;이 과정은 &lt;strong&gt;parameter-free&lt;/strong&gt;라고 명시한다. 즉, 별도 학습되는 compression module이 아니라 similarity 기반 규칙으로 merge한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;

&lt;p&gt;매 프레임을 모두 기억하는 대신, 서로 거의 같은 장면은 합쳐서 저장하고, 변화가 큰 장면만 상대적으로 더 보존하는 방식이다. 그래서 long-term memory는 원래 영상의 dense sequence가 아니라 &lt;strong&gt;compressed event trace&lt;/strong&gt;에 가깝다.&lt;/p&gt;

&lt;/details&gt;
&lt;h2 id=&quot;extended-positional-encoding&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Extended Positional Encoding&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;long-term memory token 수가 pretrained model의 positional encoding 최대 길이를 넘기 때문에, positional encoding도 확장한다. BERT 방식 positional encoding을 기반으로, Su et al.의 &lt;strong&gt;hierarchically decomposed positional encoding&lt;/strong&gt;을 사용해 absolute positional encoding 길이를 &lt;span class=&quot;math inline&quot;&gt;\(n\)&lt;/span&gt;에서 &lt;span class=&quot;math inline&quot;&gt;\(n^2\)&lt;/span&gt;로 확장한다고 설명한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;inference-mode&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Inference Mode&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Global mode&lt;/strong&gt;는 전체 영상에 대한 질문응답이다. 이때 video representation &lt;span class=&quot;math inline&quot;&gt;\(V\)&lt;/span&gt;는 long-term memory &lt;span class=&quot;math inline&quot;&gt;\(L\)&lt;/span&gt;만 사용한다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Breakpoint mode&lt;/strong&gt;는 특정 시점에 대한 질문응답이다. 이때는 현재 시점 주변 문맥과 전역 문맥이 모두 필요하다고 보고, &lt;span class=&quot;math inline&quot;&gt;\(L\)&lt;/span&gt;, &lt;span class=&quot;math inline&quot;&gt;\(S\)&lt;/span&gt;, 그리고 current frame feature &lt;span class=&quot;math inline&quot;&gt;\(x_t\)&lt;/span&gt;를 함께 concatenation해서 representation &lt;span class=&quot;math inline&quot;&gt;\(V\)&lt;/span&gt;를 만든다.&lt;/li&gt;
&lt;li&gt;이후 &lt;span class=&quot;math inline&quot;&gt;\(V\)&lt;/span&gt;는 &lt;strong&gt;Q-former + linear projection&lt;/strong&gt;을 거쳐 LLM으로 들어가고, 식 (4) &lt;span class=&quot;math inline&quot;&gt;\(A = O(Q, P(V))\)&lt;/span&gt;로 답을 생성한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;benchmark와-실험-설정&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;Benchmark와 실험 설정&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;새 benchmark는 &lt;strong&gt;1K long videos&lt;/strong&gt;, &lt;strong&gt;1K dense captions&lt;/strong&gt;, &lt;strong&gt;13K 정도 QA pairs&lt;/strong&gt;로 구성된다. 평균 clip duration은 &lt;strong&gt;9.4분&lt;/strong&gt;, 평균 caption length는 &lt;strong&gt;121&lt;/strong&gt;, 평균 question length는 &lt;strong&gt;7.8&lt;/strong&gt;, 평균 answer length는 &lt;strong&gt;2.3&lt;/strong&gt;이다. 표 B2에 정리되어 있다.&lt;/li&gt;
&lt;li&gt;category는 documentary, animation, detective 등 15개 범주다. 90% 이상 비디오가 &lt;strong&gt;10K~12K frames&lt;/strong&gt; 범위에 있고, 14.6%는 12K frames를 넘는다.&lt;/li&gt;
&lt;li&gt;각 비디오에 대해
&lt;ul&gt;
&lt;li&gt;전체 비디오 dense caption 1개&lt;/li&gt;
&lt;li&gt;global mode QA 3개&lt;/li&gt;
&lt;li&gt;timestamp가 있는 breakpoint QA 10개 를 수동으로 만든다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;기본 hyperparameter는 supplementary에서 다음과 같이 제시된다.
&lt;ul&gt;
&lt;li&gt;sliding window size: &lt;strong&gt;16 frames&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;short-term memory: &lt;strong&gt;18 frames × 32 tokens per frame&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;long-term memory: &lt;strong&gt;256 frames&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;consolidation length: &lt;strong&gt;2&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;실험-결과&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;실험 결과&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;short video QA&lt;/strong&gt;에서도 성능이 나쁘지 않다. MSVD-QA, MSRVTT-QA, ActivityNet-QA에서 각각 accuracy 75.2, 52.7, 45.7을 기록한다. 특히 ActivityNet-QA에서는 baseline보다 높다.&lt;/li&gt;
&lt;li&gt;핵심인 &lt;strong&gt;long video QA&lt;/strong&gt;에서는 MovieChat-1K test set에서 global mode accuracy 62.3, score 3.23, breakpoint mode accuracy 48.3, score 2.57을 기록했다. baseline보다 더 많은 frame을 읽으면서 더 높은 성능을 냈다고 보고한다. 표 3에 따르면 이 방법은 &lt;strong&gt;2048 frames&lt;/strong&gt;를 사용하고, 비교 모델들은 32 또는 100 frames를 사용했다.&lt;/li&gt;
&lt;li&gt;supplementary의 상세 결과에서는 GPT-3.5, Claude, human blind rating 각각에 대해 별도 점수를 제시한다. 예를 들어 GPT-3.5 평가에서는 global mode accuracy 67.8, breakpoint mode accuracy 50.4였다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;generative performance&lt;/strong&gt;도 global mode와 breakpoint mode 모두 대체로 우세하다고 보고한다. global mode 평균 지표에서 CI, DO, CU, TU, CO 전반적으로 높은 편이다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ablation study&lt;/strong&gt;에서는 memory mechanism을 제거하면 성능이 크게 떨어진다. 예를 들어 long video QA에서 global mode accuracy가 &lt;strong&gt;67.8 → 51.4&lt;/strong&gt;, breakpoint mode accuracy가 &lt;strong&gt;50.4 → 38.2&lt;/strong&gt;로 감소한다.&lt;/li&gt;
&lt;li&gt;hyperparameter ablation은 memory buffer 길이와 consolidation 길이 사이에 trade-off가 있음을 보인다. memory buffer가 커지면 더 많은 정보를 보지만, compression이 지나치면 detail loss가 커진다. 저자들은 경험적으로 고른 설정이 적절하다고 주장한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 이 방법이 먹히는가&lt;/summary&gt;

&lt;p&gt;이 방법의 성능 논리는 단순하다. 긴 비디오에서 모든 frame을 equally important하게 다루지 않고, &lt;strong&gt;중복 frame은 압축하고, 문맥 연결에 필요한 정보만 장기 기억으로 보존&lt;/strong&gt;하기 때문에 더 긴 입력을 감당하면서 QA 성능을 유지할 수 있다는 것이다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;한계는-무엇인가&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;5) 한계는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;논문이 직접 적은 한계는 두 가지다.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Limited perception capacities&lt;/strong&gt;: 성능이 pretrained short video understanding model에 의해 제한된다. 즉, 앞단 visual understanding 자체가 약하면 전체 시스템도 그 한계를 그대로 가진다.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Inadequate Time Processing&lt;/strong&gt;: 긴 비디오 안 사건들의 duration proportion을 대략적으로만 추정할 수 있고, &lt;strong&gt;정밀한 temporal detail&lt;/strong&gt;은 부족하다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;추가로 읽히는 실질적 한계도 있다.
&lt;ul&gt;
&lt;li&gt;memory consolidation은 &lt;strong&gt;adjacent-frame similarity&lt;/strong&gt; 기반의 greedy merge라서, 의미적으로 중요한 장면이지만 시각적으로 비슷한 경우 과도하게 압축될 수 있다. 논문은 이를 장점으로 제시하지만, semantic importance를 직접 학습하는 구조는 아니다. 근거는 merge가 parameter-free cosine similarity 기반이라는 점이다.&lt;/li&gt;
&lt;li&gt;long video benchmark의 평가가 &lt;strong&gt;GPT-3.5, Claude, human blind rating&lt;/strong&gt; 평균에 크게 의존한다. 저자들도 LLM-assisted evaluation에서 yes/no와 score가 불일치하는 문제가 있어 &lt;strong&gt;manual filtering&lt;/strong&gt;을 추가했다고 적는다. 이것은 평가 프로토콜의 안정성이 완전히 자동화되어 있지 않다는 뜻이다.&lt;/li&gt;
&lt;li&gt;본문과 supplementary 사이에서 benchmark 규모 표기가 &lt;strong&gt;14K manual annotations&lt;/strong&gt;와 &lt;strong&gt;13K QA pairs&lt;/strong&gt;로 완전히 일치하지 않는다. 큰 오류라고 단정할 근거는 없지만, 데이터셋 기술은 다소 엄밀하지 않다.&lt;/li&gt;
&lt;li&gt;구조적으로는 &lt;strong&gt;compression trade-off&lt;/strong&gt;가 본질적이다. long-term memory를 더 작게 하면 세부 정보 손실이 커지고, 더 크게 하면 효율성이 떨어진다. ablation 결과도 이 trade-off를 보여준다.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;한계의 핵심&lt;/summary&gt;

&lt;p&gt;이 방법은 긴 비디오를 다룰 수 있게 해주지만, 그 대가로 &lt;strong&gt;정밀한 시간 정보와 세부 장면 정보 일부를 압축 과정에서 잃을 수 있다&lt;/strong&gt;. 즉, long-context coverage는 좋아졌지만, fine-grained temporal precision까지 완전히 해결한 것은 아니다.&lt;/p&gt;

&lt;/details&gt;
&lt;hr /&gt;
&lt;h2 id=&quot;전체-요약&quot;&gt;&lt;mark  style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%);background-repeat: no-repeat;-webkit-box-decoration-break: clone;box-decoration-break: clone;padding: 0 0.08em;&quot;&gt;전체 요약&lt;/mark&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;이 논문은 &lt;strong&gt;긴 비디오를 Video-LLM으로 이해할 때 생기는 memory/compute/temporal connection 문제&lt;/strong&gt;를 해결하려고 한다.&lt;/li&gt;
&lt;li&gt;핵심 방법은 &lt;strong&gt;short-term memory + long-term memory + memory consolidation&lt;/strong&gt;이다. short-term memory에 쌓인 dense frame token을 similarity 기반으로 merge해 sparse long-term memory로 바꾼다.&lt;/li&gt;
&lt;li&gt;global QA와 breakpoint QA를 분리해서 다루고, 새 benchmark까지 제안한다.&lt;/li&gt;
&lt;li&gt;실험에서는 long video QA와 generation에서 baseline보다 우수한 결과를 보였고, memory mechanism이 핵심이라는 ablation도 제시했다.&lt;/li&gt;
&lt;li&gt;다만 temporal precision, pretrained visual backbone 의존성, 평가 안정성 문제는 남아 있다.&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>딥러닝 논문/비전 딥러닝 논문</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/53</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/REVIEW-MovieChat-From-Dense-Token-to-Sparse-Memory-for-Long-Video-Understanding#entry53comment</comments>
      <pubDate>Mon, 9 Mar 2026 19:37:01 +0900</pubDate>
    </item>
    <item>
      <title>[REVIEW] Is Space-Time Attention All You Need for Video Understanding?</title>
      <link>https://allaboutdeeplearning.tistory.com/entry/REVIEW-Is-Space-Time-Attention-All-You-Need-for-Video-Understanding</link>
      <description>&lt;h2 id=&quot;어떤-문제를-해결하고-싶은가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;1) 어떤 문제를 해결하고 싶은가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;이 논문이 풀고자 하는 핵심 문제는 &lt;b&gt;video understanding에서 convolution 없이 self-attention만으로 충분한가&lt;/b&gt; 이다. 더 구체적으로는, 기존 video recognition이 주로 &lt;b&gt;2D/3D CNN&lt;/b&gt; 에 의존해 왔는데, 이 구조가 가진 한계를 넘어서 &lt;b&gt;space-time self-attention만으로도 경쟁력 있는 video model&lt;/b&gt; 을 만들 수 있는지를 묻는다.&lt;/li&gt;
&lt;li&gt;저자들이 문제로 보는 기존 CNN 기반 video model의 한계는 크게 세 가지다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;강한 inductive bias&lt;/b&gt;: local connectivity, translation equivariance 같은 bias가 small-data에서는 유리하지만, data가 충분히 큰 regime에서는 표현력을 과도하게 제한할 수 있다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;long-range dependency modeling의 한계&lt;/b&gt;: convolution은 기본적으로 local receptive field에 기반하므로, 멀리 떨어진 시공간 상호작용은 여러 layer를 거쳐 간접적으로만 포착한다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;긴 video / 고해상도 video에서의 높은 계산비용&lt;/b&gt;: deep 3D CNN은 training과 inference가 매우 비싸다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;따라서 이 논문의 문제 설정은 단순히 &amp;ldquo;video 분류 성능을 올리자&amp;rdquo;가 아니라, &lt;b&gt;global spatiotemporal dependency를 직접 다루면서도 scalable한 attention-based video architecture를 만들자&lt;/b&gt; 는 것이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이미지에서는 ViT가 &amp;ldquo;convolution 없이도 된다&amp;rdquo;는 것을 보여줬다. 그런데 video는 image보다 훨씬 어렵다. 공간축뿐 아니라 시간축까지 다뤄야 하고, token 수가 폭증하기 때문이다. 이 논문은 바로 그 지점에서, &lt;b&gt;video도 patch token으로 쪼개서 Transformer만으로 처리할 수 있는가&lt;/b&gt; 를 실험적으로 검증한다.&lt;/p&gt;
&lt;/details&gt;&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;video understanding에서는 어떤 행동이 무엇인지 판단하려면 &lt;b&gt;현재 frame의 물체 모양&lt;/b&gt; 뿐 아니라 &lt;b&gt;시간에 따른 변화&lt;/b&gt;, &lt;b&gt;먼 frame과의 관계&lt;/b&gt;, &lt;b&gt;긴 문맥(long-term context)&lt;/b&gt; 이 중요하다. CNN은 이런 관계를 local kernel의 누적으로 학습하지만, self-attention은 원리적으로 멀리 떨어진 위치끼리도 직접 비교할 수 있다. 따라서 이 질문은 단순 architecture 교체가 아니라, &lt;b&gt;video representation learning의 기본 연산자를 바꿀 수 있는가&lt;/b&gt; 에 대한 질문이다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;선행연구는-어땠는가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;2) 선행연구는 어땠는가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;video recognition의 주류는 오랫동안 &lt;b&gt;2D/3D convolution 기반 모델&lt;/b&gt; 이었다. 논문은 대표적으로 I3D, SlowFast 같은 모델을 비교 대상으로 둔다. 이들은 당시 video classification의 강력한 baseline 또는 SOTA였다.&lt;/li&gt;
&lt;li&gt;한편 self-attention은 NLP에서 Transformer 이후 long-range dependency를 잘 다루는 구조로 자리 잡았고, vision에서도 Non-local, Attention-augmented convolution, DETR, ViT 등으로 확장되었다. 다만 이들 중 많은 방법은
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;convolution 위에 attention을 얹거나&lt;/li&gt;
&lt;li&gt;image에서만 attention을 쓰거나&lt;/li&gt;
&lt;li&gt;pixel-level full attention 대신 local/sparse/axial attention으로 계산량을 줄이는 방식이었다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;video 쪽에서도 Transformer가 전혀 없었던 것은 아니다. 하지만 대부분은
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;convolutional feature map 위에 Transformer를 얹거나&lt;/li&gt;
&lt;li&gt;video-language task에서 text Transformer와 CNN을 결합하거나&lt;/li&gt;
&lt;li&gt;video generation에 Transformer를 쓰는 식이었다. 즉, &lt;b&gt;video recognition에서 self-attention을 유일한 building block으로 쓴 architecture는 거의 없었다&lt;/b&gt; 는 것이 저자들의 포지션이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;또 하나의 중요한 선행연구는 &lt;b&gt;ViT (Vision Transformer)&lt;/b&gt; 다. 이 논문은 ViT의 핵심 아이디어인 &amp;ldquo;image를 patch token sequence로 바꿔 Transformer encoder에 넣는다&amp;rdquo;를 video로 확장한다. 다만 video는 token 수가 &lt;span class=&quot;math inline&quot;&gt;\(N \times F\)&lt;/span&gt; 로 커지므로, image보다 훨씬 심각한 attention cost 문제가 생긴다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;선행연구의 한계 요약&lt;/summary&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;CNN video model&lt;/b&gt;: local receptive field 기반이라 long-range dependency를 직접 다루기 어렵다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;기존 attention video model&lt;/b&gt;: 대개 CNN 위에 attention을 추가하는 hybrid 구조였다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ViT류 pure attention model&lt;/b&gt;: image에서는 성공했지만, video에 그대로 적용하면 token 수 때문에 계산량이 너무 커진다.&lt;/li&gt;
&lt;li&gt;따라서 당시에는 &lt;b&gt;&amp;ldquo;pure space-time attention video model&amp;rdquo;의 성능과 효율성&lt;/b&gt; 이 명확히 검증되지 않았다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;이-논문에서-하는-새로운-기여는-무엇인가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;3) 이 논문에서 하는 새로운 기여는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;첫 번째 기여는 &lt;b&gt;TimeSformer&lt;/b&gt; 라는, &lt;b&gt;space-time self-attention만으로 구성된 convolution-free video architecture&lt;/b&gt; 를 제안한 것이다. video를 frame-level patch sequence로 바꾸고, 그 token들 위에서 Transformer encoder를 수행한다.&lt;/li&gt;
&lt;li&gt;두 번째 기여는 video에서 attention을 어떻게 계산할지에 대한 &lt;b&gt;여러 가지 space-time attention scheme을 체계적으로 비교&lt;/b&gt; 한 점이다. 논문은
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;Space attention (S)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Joint Space-Time attention (ST)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Divided Space-Time attention (T+S)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Sparse Local Global attention (L+G)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Axial attention (T+W+H)&lt;/b&gt; 의 다섯 가지를 비교한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;906&quot; data-origin-height=&quot;487&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/NVzKk/dJMcaioY6Dw/540aXpTBslqn7EsEvkNsXk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/NVzKk/dJMcaioY6Dw/540aXpTBslqn7EsEvkNsXk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/NVzKk/dJMcaioY6Dw/540aXpTBslqn7EsEvkNsXk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FNVzKk%2FdJMcaioY6Dw%2F540aXpTBslqn7EsEvkNsXk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;906&quot; height=&quot;487&quot; data-origin-width=&quot;906&quot; data-origin-height=&quot;487&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;세 번째 기여는 그 비교를 통해 &lt;b&gt;Divided Space-Time attention&lt;/b&gt; 이 가장 좋은 선택이라는 것을 보인 점이다. 즉, 하나의 block 안에서 &lt;b&gt;temporal attention을 먼저 적용하고, 그 다음 spatial attention을 따로 적용&lt;/b&gt; 하는 방식이 accuracy와 scalability 모두에서 가장 유리하다고 보였다. Table 1에서 Kinetics-400과 SSv2 모두 최고 정확도를 기록한다.&lt;/li&gt;
&lt;li&gt;네 번째 기여는 pure attention 구조임에도 주요 video benchmark에서 &lt;b&gt;당시 SOTA 수준 혹은 그 이상 성능&lt;/b&gt; 을 보였다는 점이다. Kinetics-400, Kinetics-600에서는 매우 강력했고, 긴 video를 다루는 HowTo100M에서도 강한 long-term modeling 성능을 보였다.&lt;/li&gt;
&lt;li&gt;다섯 번째 기여는 &lt;b&gt;효율성&lt;/b&gt; 이다. 저자들은 TimeSformer가 3D CNN 대비 training time과 inference cost 측면에서 유리하며, 특히 &lt;b&gt;긴 clip&lt;/b&gt; 이나 &lt;b&gt;고해상도 입력&lt;/b&gt; 에 더 잘 scale한다고 주장한다. Figure 3과 Table 2가 이를 뒷받침한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;novelty를 한 줄로 말하면&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 &lt;b&gt;video를 patch token sequence로 보고, convolution을 완전히 버린 pure Transformer를 video recognition에 성공적으로 적용한 초기 핵심 연구&lt;/b&gt; 라고 볼 수 있다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;연구-방법은-무엇인가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;4) 연구 방법은 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;전체-구조&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;전체 구조&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;입력 video clip은 &lt;span class=&quot;math inline&quot;&gt;\(X \in \mathbb{R}^{H \times W \times 3 \times F}\)&lt;/span&gt; 로 주어진다. 여기서 &lt;span class=&quot;math inline&quot;&gt;\(F\)&lt;/span&gt; 는 frame 수이고, 각 frame의 spatial size는 &lt;span class=&quot;math inline&quot;&gt;\(H \times W\)&lt;/span&gt; 이다.&lt;/li&gt;
&lt;li&gt;각 frame은 ViT처럼 &lt;b&gt;non-overlapping patch&lt;/b&gt; 로 나뉜다. patch size가 &lt;span class=&quot;math inline&quot;&gt;\(P \times P\)&lt;/span&gt; 이면, frame당 patch 수는 &lt;span class=&quot;math inline&quot;&gt;\(N = HW/P^2\)&lt;/span&gt; 이다. 각 patch는 flatten되어 vector가 되고, learnable linear projection으로 embedding된다. 여기에 &lt;b&gt;spatiotemporal positional embedding&lt;/b&gt; 이 더해진다.&lt;/li&gt;
&lt;li&gt;이렇게 얻은 token sequence는 standard Transformer encoder block들에 입력된다. block마다 query, key, value를 만들고, self-attention과 MLP, residual connection, LayerNorm을 적용한다. classification token도 BERT처럼 맨 앞에 추가된다. 최종 classification token representation으로 video class를 예측한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;image에서 &amp;ldquo;16&amp;times;16 patch 하나를 token 하나처럼 본다&amp;rdquo;는 ViT의 사고방식을, video에서는 &amp;ldquo;모든 frame의 patch들을 시간축까지 포함한 token sequence로 본다&amp;rdquo;로 일반화한 것이다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;patch-embedding과-positional-embedding&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(1) Patch embedding과 positional embedding&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;각 patch &lt;span class=&quot;math inline&quot;&gt;\(x_{(p,t)} \in \mathbb{R}^{3P^2}\)&lt;/span&gt; 는 learnable matrix &lt;span class=&quot;math inline&quot;&gt;\(E\)&lt;/span&gt; 로 embedding되어 &lt;span class=&quot;math inline&quot;&gt;\(z^{(0)}_{(p,t)} = E x_{(p,t)} + e^{pos}_{(p,t)}\)&lt;/span&gt; 형태가 된다. 여기서 &lt;span class=&quot;math inline&quot;&gt;\(e^{pos}_{(p,t)}\)&lt;/span&gt; 는 &lt;b&gt;learnable spatiotemporal positional embedding&lt;/b&gt; 이다.&lt;/li&gt;
&lt;li&gt;이 positional embedding은 매우 중요하다. Table 4에 따르면
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;positional embedding 없음: K400 75.4, SSv2 45.8&lt;/li&gt;
&lt;li&gt;space-only positional embedding: K400 77.8, SSv2 52.5&lt;/li&gt;
&lt;li&gt;&lt;b&gt;space-time positional embedding&lt;/b&gt;: K400 78.0, SSv2 59.5 로, 특히 temporal reasoning이 중요한 SSv2에서 space-time positional embedding의 효과가 크다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;왜 중요한가&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Transformer는 convolution처럼 위치 구조를 내장하고 있지 않다. 따라서 video에서는 &amp;ldquo;이 patch가 어느 frame의 어느 위치인지&amp;rdquo;를 positional embedding으로 알려줘야 한다. 이 논문 결과는 특히 &lt;b&gt;time positional information&lt;/b&gt; 이 temporally-heavy dataset에서 결정적임을 보여준다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;여러-attention-scheme-비교&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(2) 여러 attention scheme 비교&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;논문은 Figure 2에서 다섯 attention scheme을 비교한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;904&quot; data-origin-height=&quot;510&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bNIkWT/dJMcadOFOQX/0Vyjkbm58MfdtfMIkM1R4K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bNIkWT/dJMcadOFOQX/0Vyjkbm58MfdtfMIkM1R4K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bNIkWT/dJMcadOFOQX/0Vyjkbm58MfdtfMIkM1R4K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbNIkWT%2FdJMcadOFOQX%2F0Vyjkbm58MfdtfMIkM1R4K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;904&quot; height=&quot;510&quot; data-origin-width=&quot;904&quot; data-origin-height=&quot;510&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;Space attention (S)&lt;/b&gt; 는 frame 내부의 spatial patch들끼리만 attention을 한다. 계산량은 줄지만 temporal dependency를 직접 보지 못한다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Joint Space-Time attention (ST)&lt;/b&gt; 는 모든 space-time patch 쌍 사이에 attention을 한다. 가장 직접적이지만 token 수가 커질수록 비용이 매우 커진다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Divided Space-Time attention (T+S)&lt;/b&gt; 는 먼저 같은 spatial location을 따라 temporal attention을 수행하고, 그 결과를 다시 spatial attention에 넣는다. 즉, time과 space를 factorize한다. 이 방식은 patch당 comparison 수를 joint attention의 &lt;span class=&quot;math inline&quot;&gt;\((NF+1)\)&lt;/span&gt; 에서 대략 &lt;span class=&quot;math inline&quot;&gt;\((N+F+2)\)&lt;/span&gt; 수준으로 줄인다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Sparse Local Global (L+G)&lt;/b&gt; 는 local neighborhood attention과 sparse global attention을 섞는다.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Axial (T+W+H)&lt;/b&gt; 는 time, width, height 축을 순서대로 나눠 attention을 한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;핵심 아이디어&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;video에서 가장 큰 문제는 token 수가 많아 attention cost가 폭증한다는 것이다. 따라서 이 논문은 &amp;ldquo;attention을 포기하지 않되, 어떻게 factorize / sparse하게 계산할 것인가&amp;rdquo;를 architecture design의 중심에 둔다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;왜-divided-space-time-attention이-좋은가&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(3) 왜 Divided Space-Time attention이 좋은가&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Table 1 결과는 다음과 같다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;450&quot; data-origin-height=&quot;224&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bacsL1/dJMcadgTzZv/lQ1tfmmMpPJS6vr2rhvg50/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bacsL1/dJMcadgTzZv/lQ1tfmmMpPJS6vr2rhvg50/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bacsL1/dJMcadgTzZv/lQ1tfmmMpPJS6vr2rhvg50/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbacsL1%2FdJMcadgTzZv%2FlQ1tfmmMpPJS6vr2rhvg50%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;450&quot; height=&quot;224&quot; data-origin-width=&quot;450&quot; data-origin-height=&quot;224&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;즉, &lt;b&gt;Divided Space-Time attention이 accuracy 측면에서 가장 좋다&lt;/b&gt;. 저자들은 그 이유로 temporal attention과 spatial attention에 대해 &lt;b&gt;별도 parameterization&lt;/b&gt; 을 둠으로써 learning capacity가 커졌기 때문이라고 해석한다.&lt;/li&gt;
&lt;li&gt;또 Figure 3에 따르면, spatial resolution이 커지거나 input frame 수가 길어질수록 &lt;b&gt;joint attention의 FLOPs가 급격히 증가&lt;/b&gt; 하고 memory overflow도 발생하는 반면, divided attention은 훨씬 안정적으로 scale한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;703&quot; data-origin-height=&quot;491&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/zpS8O/dJMcag5LPtR/Yc0ApgVJNjtkGjrRey8rmK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/zpS8O/dJMcag5LPtR/Yc0ApgVJNjtkGjrRey8rmK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/zpS8O/dJMcag5LPtR/Yc0ApgVJNjtkGjrRey8rmK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FzpS8O%2FdJMcag5LPtR%2FYc0ApgVJNjtkGjrRey8rmK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;703&quot; height=&quot;491&quot; data-origin-width=&quot;703&quot; data-origin-height=&quot;491&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;추가 ablation으로, divided attention에서 &lt;b&gt;temporal &amp;rarr; spatial&lt;/b&gt; 순서가 &lt;b&gt;spatial &amp;rarr; temporal&lt;/b&gt; 순서보다 0.5% 정도 더 낫고, parallel space-time attention보다도 0.4% 더 낫다고 보고한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;직관적 의미&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;video 이해는 &amp;ldquo;먼저 같은 위치에서 시간 변화를 보고&amp;rdquo;, 그다음 &amp;ldquo;한 frame 안에서 공간 관계를 본다&amp;rdquo;는 분해가 잘 맞는다는 뜻이다. 즉, TimeSformer는 &lt;b&gt;time과 space를 한 번에 섞기보다, 분리해서 차례대로 처리하는 것이 더 효과적&lt;/b&gt; 임을 보여준다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h3 id=&quot;학습-세팅&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(4) 학습 세팅&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;기본 실험은 ViT-Base를 backbone으로 사용한다. patch size는 보통 &lt;b&gt;16&amp;times;16&lt;/b&gt;, 기본 입력 clip은 &lt;b&gt;8 &amp;times; 224 &amp;times; 224&lt;/b&gt; 이다. frame sampling rate는 1/32다.&lt;/li&gt;
&lt;li&gt;training은 15 epoch, initial learning rate 0.005, batch size 16, synchronized SGD over 32 GPUs로 수행한다. inference에서는 보통 video 중앙에서 temporal clip 하나를 뽑고, 3 spatial crop을 평균한다.&lt;/li&gt;
&lt;li&gt;모델 변형으로는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;TimeSformer&lt;/b&gt;: 8&amp;times;224&amp;times;224&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TimeSformer-HR&lt;/b&gt;: 16&amp;times;448&amp;times;448&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TimeSformer-L&lt;/b&gt;: 96&amp;times;224&amp;times;224 이 있다. 특히 TimeSformer-L은 long-range modeling을 위한 버전이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;실험-결과는-무엇을-보여주는가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;5) 실험 결과는 무엇을 보여주는가&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;d-cnn과-비교해도-경쟁력이-있다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(1) 3D CNN과 비교해도 경쟁력이 있다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Table 2에서 TimeSformer는 3D CNN 대비 training time과 inference cost에서 강점을 보인다.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;TimeSformer (ImageNet-21K pretrain)&lt;/b&gt;: K400 accuracy 78.0, inference 0.59 TFLOPs&lt;/li&gt;
&lt;li&gt;&lt;b&gt;SlowFast R50&lt;/b&gt;: 75.6, inference 1.97 TFLOPs&lt;/li&gt;
&lt;li&gt;&lt;b&gt;I3D R50&lt;/b&gt;: 73.4, inference 1.11 TFLOPs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;또 video training time도 훨씬 적다. TimeSformer는 K400에서 &lt;b&gt;416 Tesla V100 GPU hours&lt;/b&gt; 로 75.8% accuracy를 얻는데, 같은 ImageNet-1K pretraining 조건에서 SlowFast는 3840 GPU hours가 필요하고, I3D는 1440 GPU hours가 필요하다.&lt;/li&gt;
&lt;li&gt;즉, parameter 수는 TimeSformer가 더 많지만, attention factorization 덕분에 실제 inference/training efficiency는 더 좋다. 저자들은 이를 &amp;ldquo;large-capacity model을 상대적으로 낮은 cost로 학습할 수 있다&amp;rdquo;는 장점으로 본다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;kinetics-400-kinetics-600에서-매우-강하다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(2) Kinetics-400 / Kinetics-600에서 매우 강하다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Table 5의 Kinetics-400 결과에서
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;TimeSformer: 78.0&lt;/li&gt;
&lt;li&gt;TimeSformer-HR: 79.7&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TimeSformer-L: 80.7&lt;/b&gt; 이다. 이는 당시 강력한 CNN 계열 모델들과 동급이거나 상회하는 수치다. 특히 TimeSformer-L은 X3D-XXL 80.4, SlowFast 79.8보다 높다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Table 6의 Kinetics-600에서도
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;TimeSformer: 79.1&lt;/li&gt;
&lt;li&gt;TimeSformer-HR: 81.8&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TimeSformer-L: 82.2&lt;/b&gt; 로 prior method들을 넘어선다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;또 Figure 6에 따르면 TimeSformer-L은 inference 때 많은 temporal clip을 쓰지 않아도 높은 정확도를 낸다. 이는 한 clip 자체가 긴 temporal span을 덮기 때문이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;temporally-heavy-dataset에서는-완전한-우위는-아니다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(3) temporally-heavy dataset에서는 완전한 우위는 아니다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Something-Something-V2에서는
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;TimeSformer: 59.5&lt;/li&gt;
&lt;li&gt;TimeSformer-HR: 62.2&lt;/li&gt;
&lt;li&gt;TimeSformer-L: 62.4 이고, 당시 best CNN 계열은 65점대였다. 즉, &lt;b&gt;SSv2에서는 SOTA는 아니다&lt;/b&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;저자 해석은 이렇다. SSv2는 K400보다 temporal reasoning 요구가 크고, pure attention 모델이 이런 복잡한 temporal pattern을 학습하려면 더 많은 데이터가 필요하다. Figure 4에서도 SSv2에서는 학습 데이터가 충분히 많아졌을 때 TimeSformer가 경쟁력을 갖는 경향이 나온다.&lt;/li&gt;
&lt;li&gt;반면 Diving-48에서는 TimeSformer-L이 81.0으로 reproduced SlowFast 77.6을 넘는다. 즉, temporally-heavy라고 해서 항상 약한 것은 아니고, dataset 특성에 따라 다르다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;해석&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 &amp;ldquo;attention이 언제나 CNN보다 낫다&amp;rdquo;를 주장하지는 않는다. 오히려 &lt;b&gt;spatially-biased benchmark에서는 매우 강하고&lt;/b&gt;, &lt;b&gt;temporal reasoning이 복잡한 benchmark에서는 충분한 데이터와 긴 input이 중요하다&lt;/b&gt; 는 더 미묘한 결론을 보여준다.&lt;/p&gt;
&lt;/details&gt;
&lt;h3 id=&quot;long-term-video-modeling에서-특히-강하다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(4) long-term video modeling에서 특히 강하다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;HowTo100M long-term task classification에서 TimeSformer는 SlowFast보다 큰 폭으로 좋다. Table 8에 따르면 같은 clip coverage에서 TimeSformer가 SlowFast보다 &lt;b&gt;8&amp;ndash;11%p&lt;/b&gt; 높은 top-1 accuracy를 보인다. 예를 들어
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;SlowFast 96f: 51.2&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TimeSformer 96f: 62.6&lt;/b&gt; 이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;또 frame 수를 8 &amp;rarr; 32 &amp;rarr; 64 &amp;rarr; 96으로 늘릴수록 TimeSformer accuracy가 56.8 &amp;rarr; 61.2 &amp;rarr; 62.2 &amp;rarr; 62.6으로 올라간다. 즉, &lt;b&gt;더 긴 temporal context를 실제로 활용한다&lt;/b&gt; 는 증거다.&lt;/li&gt;
&lt;li&gt;저자들은 이를 근거로 TimeSformer가 &lt;b&gt;long-term dependency modeling에 특히 적합하다&lt;/b&gt; 고 결론짓는다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;추가-분석과-ablation은-무엇을-보여주는가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;6) 추가 분석과 ablation은 무엇을 보여주는가&lt;/mark&gt;&lt;/h2&gt;
&lt;h3 id=&quot;데이터-규모가-중요하다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(1) 데이터 규모가 중요하다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Figure 4에 따르면 K400에서는 학습 데이터가 25%, 50%, 75%, 100%로 늘어나는 모든 경우에 TimeSformer가 SlowFast와 I3D보다 좋다.&lt;/li&gt;
&lt;li&gt;하지만 SSv2에서는 75% 이상 데이터가 있어야 TimeSformer가 strongest model이 된다. 이는 pure attention model이 &lt;b&gt;복잡한 temporal pattern&lt;/b&gt; 을 배우기 위해 더 많은 data를 필요로 할 수 있음을 시사한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;token-수를-늘리면-성능이-좋아진다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(2) token 수를 늘리면 성능이 좋아진다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Figure 5는 spatial crop size를 키우거나 input frame 수를 늘리면 K400 accuracy가 올라감을 보여준다. 특히 frame 수 증가에 따라 꾸준한 gain이 관찰된다.&lt;/li&gt;
&lt;li&gt;이는 TimeSformer가 더 많은 token을 단순히 감당할 뿐 아니라, &lt;b&gt;실제로 그 추가 정보를 성능 향상으로 전환한다&lt;/b&gt; 는 뜻이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;pretraining이-매우-중요하다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(3) pretraining이 매우 중요하다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;TimeSformer는 scratch training이 어렵다. 논문은 ImageNet pretraining 없이 K400에서 학습하면 video-level accuracy가 64.8%에 그쳤다고 보고한다. 반면 ImageNet pretraining을 하면 훨씬 높아진다.&lt;/li&gt;
&lt;li&gt;또 Table 3에 따르면 K400에서는 &lt;b&gt;ImageNet-21K pretraining&lt;/b&gt; 이 ImageNet-1K보다 일관되게 좋다. 예를 들어 TimeSformer-L은 78.1 &amp;rarr; 80.7로 오른다. 반면 SSv2에서는 1K와 21K 차이가 거의 없다.&lt;/li&gt;
&lt;li&gt;저자 해석은 K400이 spatial scene bias가 강해 large-scale image pretraining의 수혜를 더 크게 받는다는 것이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;representation-quality도-좋아진다&quot; data-ke-size=&quot;size23&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,209,209,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;(4) representation quality도 좋아진다&lt;/mark&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;page 9 Figure 7의 attention visualization은 TimeSformer가 SSv2에서 relevant object/hand region에 attention을 두는 모습을 보여준다. 즉, 단순 classification score만 높은 것이 아니라, &lt;b&gt;spatiotemporal reasoning에 필요한 부분을 실제로 attend&lt;/b&gt; 한다.&lt;/li&gt;
&lt;li&gt;page 9 Figure 8의 t-SNE는 Divided Space-Time attention이 space-only attention이나 원래 ViT보다 &lt;b&gt;더 잘 분리된 semantic feature&lt;/b&gt; 를 학습함을 보여준다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;쉽게-설명하면-무엇을-했는가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;7) 쉽게 설명하면 무엇을 했는가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;image용 ViT는 사진 한 장을 patch token으로 바꿔 Transformer에 넣는다.&lt;/li&gt;
&lt;li&gt;이 논문은 그 아이디어를 video로 확장해서, &lt;b&gt;모든 frame의 patch를 한꺼번에 token sequence로 만들었다&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;그런데 video는 token 수가 너무 많아서 full attention을 그대로 쓰면 비용이 너무 크다.&lt;/li&gt;
&lt;li&gt;그래서 저자들은 &lt;b&gt;시간축 attention&lt;/b&gt; 과 &lt;b&gt;공간축 attention&lt;/b&gt; 을 나눠서 차례대로 적용하는 &lt;b&gt;Divided Space-Time attention&lt;/b&gt; 을 제안했다.&lt;/li&gt;
&lt;li&gt;이 방식은 계산량을 줄이면서도 성능이 제일 좋았고, 실제 benchmark에서도 3D CNN과 경쟁하거나 더 좋은 결과를 냈다.&lt;/li&gt;
&lt;li&gt;특히 긴 video를 보는 문제에서는 CNN보다 더 유리했다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;핵심 메시지&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 &amp;ldquo;video도 결국 patch token sequence로 보고 Transformer만으로 처리할 수 있다&amp;rdquo;를 보여준다. 다만 아무 attention이나 쓰면 되는 것이 아니라, &lt;b&gt;space와 time을 잘 분해한 attention design이 핵심&lt;/b&gt; 이다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;한계는-무엇인가&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;8) 한계는 무엇인가&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;첫 번째 한계는 &lt;b&gt;pretraining 의존성&lt;/b&gt; 이다. 논문 자체가 TimeSformer를 scratch로 학습하기 어렵다고 인정한다. ImageNet pretraining 없이 K400에서 성능이 크게 떨어졌다. 즉, 이 모델은 강한 data efficiency를 기본적으로 갖고 있다기보다, &lt;b&gt;대규모 image pretraining의 도움을 크게 받는 구조&lt;/b&gt; 라고 보는 편이 맞다.&lt;/li&gt;
&lt;li&gt;두 번째 한계는 &lt;b&gt;temporally-heavy benchmark에서 항상 SOTA는 아니라는 점&lt;/b&gt; 이다. SSv2에서는 당시 최고 성능 모델보다 낮다. 저자들도 pure attention design이 유망하다고는 하지만, temporal reasoning이 매우 복잡한 경우에는 아직 더 개선이 필요하다는 신호다.&lt;/li&gt;
&lt;li&gt;세 번째 한계는 &lt;b&gt;긴 clip과 고해상도 입력에서 여전히 메모리 제약이 존재&lt;/b&gt; 한다는 점이다. 논문은 joint attention보다 divided attention이 훨씬 낫다고 보였지만, 그래도 96 frame 이상은 GPU memory 때문에 실험하지 못했다고 적는다. 즉, TimeSformer가 scalable하긴 하지만 &lt;b&gt;무한히 긴 video까지 자유롭게 처리하는 수준은 아니다&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;네 번째 한계는 architecture가 아직 &lt;b&gt;classification 중심&lt;/b&gt; 이라는 점이다. 저자들이 conclusion에서 future work로 action localization, captioning, question-answering을 언급하는 것을 보면, 본 논문 시점에서는 주로 action recognition에 초점을 맞춘다.&lt;/li&gt;
&lt;li&gt;다섯 번째로, 논문 내 추가 ablation에서 ViT-Large가 오히려 Base보다 약 1% 나빴다. 이는 당시 dataset 규모가 더 큰 model capacity를 정당화할 만큼 충분하지 않았음을 시사한다. 즉, &lt;b&gt;attention model의 scaling law가 video에서 아직 충분히 성숙하지 않았다&lt;/b&gt; 는 해석도 가능하다. 다만 이 부분은 실험적 observation이지 이론적 분석은 아니다.&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;한계의 본질&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 pure attention video model의 가능성을 강하게 보여줬지만, 동시에 &lt;b&gt;좋은 pretraining&lt;/b&gt;, &lt;b&gt;적절한 attention factorization&lt;/b&gt;, &lt;b&gt;충분한 데이터&lt;/b&gt;, &lt;b&gt;GPU memory budget&lt;/b&gt; 이 여전히 중요하다는 것도 드러낸다. 즉, &amp;ldquo;attention만 쓰면 자동으로 다 해결된다&amp;rdquo;가 아니라, &lt;b&gt;잘 설계된 attention video model은 CNN의 강력한 대안이 될 수 있다&lt;/b&gt; 정도로 이해하는 것이 정확하다.&lt;/p&gt;
&lt;/details&gt;&lt;hr data-ke-style=&quot;style1&quot; /&gt;
&lt;h2 id=&quot;최종-정리&quot; data-ke-size=&quot;size26&quot;&gt;&lt;mark style=&quot;background: linear-gradient(transparent 70%, rgba(255,155,155,0.95) 70%); background-repeat: no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 0.08em;&quot;&gt;9) 최종 정리&lt;/mark&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;어떤 문제를 해결하고 싶은가&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;convolution 없이 &lt;b&gt;space-time self-attention만으로 video understanding이 가능한가&lt;/b&gt;, 그리고 그것이 CNN의 한계를 넘어설 수 있는가를 묻는다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;선행연구는 어땠는가&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;video recognition은 3D CNN이 주류였고, attention은 주로 CNN 위에 얹는 보조 수단이었다. ViT는 image에서는 성공했지만 video로의 직접 확장은 token cost 문제가 컸다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;이 논문에서 하는 새로운 기여는 무엇인가&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;pure attention video model &lt;b&gt;TimeSformer&lt;/b&gt; 제안&lt;/li&gt;
&lt;li&gt;다섯 가지 attention scheme 비교&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Divided Space-Time attention&lt;/b&gt; 이 accuracy와 scalability에서 최선임을 제시&lt;/li&gt;
&lt;li&gt;Kinetics, HowTo100M 등에서 강한 성능 입증&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;연구 방법은 무엇인가&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;video를 frame-level patch token sequence로 바꾸고, spatiotemporal positional embedding을 더한 뒤 Transformer encoder에 넣는다.&lt;/li&gt;
&lt;li&gt;attention은 특히 &lt;b&gt;temporal attention 후 spatial attention&lt;/b&gt; 을 적용하는 factorized block이 핵심이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;한계는 무엇인가&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;strong pretraining dependence&lt;/li&gt;
&lt;li&gt;temporally-heavy benchmark에서 완전한 우위는 아님&lt;/li&gt;
&lt;li&gt;긴 clip에서도 여전히 memory limit 존재&lt;/li&gt;
&lt;li&gt;당시에는 classification 중심 검증에 머뭄&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;details&gt;
&lt;summary&gt;한 문장 요약&lt;/summary&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;이 논문은 &lt;b&gt;video에서도 convolution을 버리고 pure Transformer로 갈 수 있다&lt;/b&gt; 는 것을 설득력 있게 보여준 대표 연구이며, 그 핵심은 &lt;b&gt;space-time attention을 그대로 쓰는 것이 아니라, temporal과 spatial attention을 분리한 Divided Space-Time design&lt;/b&gt; 에 있다.&lt;/p&gt;
&lt;/details&gt;</description>
      <category>딥러닝 논문/비전 딥러닝 논문</category>
      <author>서울대 경제학부 22학번 이지원</author>
      <guid isPermaLink="true">https://allaboutdeeplearning.tistory.com/52</guid>
      <comments>https://allaboutdeeplearning.tistory.com/entry/REVIEW-Is-Space-Time-Attention-All-You-Need-for-Video-Understanding#entry52comment</comments>
      <pubDate>Mon, 9 Mar 2026 17:39:48 +0900</pubDate>
    </item>
  </channel>
</rss>