Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
1684 lines (1545 loc) · 93.5 KB
/
Copy pathindex.html
File metadata and controls
1684 lines (1545 loc) · 93.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="guide-version" content="2026.04">
<title>RAG 완전 가이드 — Retrieval-Augmented Generation</title>
<link rel="alternate" hreflang="en" href="en/" />
<link rel="alternate" hreflang="ko" href="./" />
<link rel="canonical" href="https://desty.github.io/rag-guide/" />
<meta name="description" content="RAG(Retrieval-Augmented Generation) 완전 가이드. LLM의 한계를 검색으로 보강하는 기술의 개념, 진화, 실전 적용을 다룹니다.">
<meta property="og:title" content="RAG 완전 가이드 — Retrieval-Augmented Generation">
<meta property="og:description" content="Naive RAG에서 Agentic RAG까지. 아키텍처 다이어그램, 최신 논문, 실전 가이드.">
<meta property="og:type" content="article">
<link rel="stylesheet" href="common/base.css">
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<!-- Google Analytics (GA4) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4L031NBC3Z"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-4L031NBC3Z');
</script>
</head>
<body>
<!-- ====== NAV ====== -->
<nav class="nav" id="nav">
<div class="nav-inner">
<a href="#hero" class="nav-logo">RAG<span class="accent">Guide</span></a>
<button class="nav-toggle" id="navToggle" aria-label="메뉴 열기">
<span></span><span></span><span></span>
</button>
<ul class="nav-links" id="navLinks">
<li><a href="#what-is-rag">개념</a></li>
<li><a href="#naive-rag">Naive</a></li>
<li><a href="#advanced-rag">Advanced</a></li>
<li><a href="#modular-rag">Modular</a></li>
<li><a href="#agentic-rag">Agentic</a></li>
<li><a href="#evaluation">평가</a></li>
<li><a href="#best-practices">실전</a></li>
<li><a href="#papers">논문</a></li>
</ul>
<a href="en/" class="lang-switch" title="English">EN</a>
</div>
</nav>
<!-- ====== HERO ====== -->
<header class="hero" id="hero">
<div class="hero-bg-grid"></div>
<div class="container hero-content">
<div class="hero-badge">Retrieval-Augmented Generation</div>
<h1 class="hero-title">
RAG<br><span class="gradient-text">완전 가이드</span>
</h1>
<p class="hero-subtitle">
LLM이 <strong>오픈북 시험</strong>을 보게 하는 기술.<br>
검색으로 지식을 보강해서, 더 정확하고 신뢰할 수 있는 AI 응답을 만듭니다.
</p>
<div class="hero-stats">
<div class="stat">
<span class="stat-number">1,200+</span>
<span class="stat-label">2024년 RAG 논문 수</span>
</div>
<div class="stat">
<span class="stat-number">도메인별</span>
<span class="stat-label">검색 개선 효과는 자체 평가로 측정</span>
</div>
<div class="stat">
<span class="stat-number">3세대</span>
<span class="stat-label">Naive → Advanced → Modular</span>
</div>
</div>
<div style="display:flex;gap:16px;flex-wrap:wrap;justify-content:center;">
<a href="#what-is-rag" class="hero-cta">
<span>시작하기</span>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 5v14M5 12l7 7 7-7"/></svg>
</a>
<a href="expert/" class="hero-cta" style="background:rgba(99,102,241,0.15);border:1px solid rgba(99,102,241,0.3);box-shadow:none;">
<span>전문가 가이드 →</span>
</a>
</div>
</div>
</header>
<!-- ====== WHY RAG ====== -->
<section class="section" id="why-rag">
<div class="container">
<div class="section-label">WHY RAG?</div>
<h2 class="section-title">왜 RAG가 필요한가?</h2>
<p class="section-desc">LLM은 강력하지만, 혼자서는 해결하기 어려운 근본적인 한계가 있습니다.</p>
<div class="problem-cards">
<div class="problem-card reveal">
<div class="problem-icon">
<svg viewBox="0 0 48 48" fill="none"><circle cx="24" cy="24" r="20" stroke="currentColor" stroke-width="2"/><path d="M24 14v12" stroke="currentColor" stroke-width="3" stroke-linecap="round"/><circle cx="24" cy="34" r="2" fill="currentColor"/></svg>
</div>
<h3>할루시네이션</h3>
<p>학습 데이터에 없는 내용도 <strong>그럴듯하게 지어냅니다</strong>. 사실 확인 없이 자신감 있게 틀린 답을 생성하는 것이 LLM의 가장 큰 약점입니다.</p>
</div>
<div class="problem-card reveal">
<div class="problem-icon">
<svg viewBox="0 0 48 48" fill="none"><rect x="8" y="8" width="32" height="32" rx="4" stroke="currentColor" stroke-width="2"/><path d="M16 18h16M16 24h10M16 30h13" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><line x1="36" y1="8" x2="36" y2="40" stroke="currentColor" stroke-width="2" stroke-dasharray="3 3"/></svg>
</div>
<h3>지식 단절</h3>
<p>학습 데이터의 <strong>컷오프 날짜</strong> 이후의 정보를 모릅니다. 어제 나온 뉴스, 최신 API 변경사항, 실시간 데이터에 접근할 수 없습니다.</p>
</div>
<div class="problem-card reveal">
<div class="problem-icon">
<svg viewBox="0 0 48 48" fill="none"><path d="M24 6l4 8 9 1-7 6 2 9-8-4-8 4 2-9-7-6 9-1z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="M14 38h20" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M18 42h12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
</div>
<h3>도메인 지식 부족</h3>
<p>회사 내부 문서, 의료/법률 전문 지식 등 <strong>비공개 데이터</strong>에 대해서는 답변할 수 없습니다. 파인튜닝은 비용과 시간이 큽니다.</p>
</div>
<div class="problem-card reveal">
<div class="problem-icon">
<svg viewBox="0 0 48 48" fill="none"><circle cx="24" cy="24" r="18" stroke="currentColor" stroke-width="2"/><path d="M24 14v10l7 7" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"/></svg>
</div>
<h3>출처 불투명</h3>
<p>답변의 <strong>근거를 제시하지 못합니다</strong>. "어디서 이 정보를 가져왔나요?"에 답할 수 없어서, 신뢰성 검증이 어렵습니다.</p>
</div>
</div>
<div class="solution-banner reveal">
<div class="solution-icon">
<svg viewBox="0 0 48 48" fill="none"><path d="M24 4l6 12 13 2-9 9 2 13-12-6-12 6 2-13-9-9 13-2z" fill="url(#starGrad)"/><defs><linearGradient id="starGrad" x1="4" y1="4" x2="44" y2="44"><stop offset="0%" stop-color="#a78bfa"/><stop offset="100%" stop-color="#6366f1"/></linearGradient></defs></svg>
</div>
<div class="solution-text">
<h3>RAG = 이 모든 문제의 해결책</h3>
<p>외부 지식을 <strong>실시간으로 검색</strong>해서 LLM에 전달하면 — 할루시네이션이 줄고, 최신 정보를 반영하며, 출처까지 제공할 수 있습니다.</p>
</div>
</div>
</div>
</section>
<!-- ====== WHAT IS RAG ====== -->
<section class="section section-dark" id="what-is-rag">
<div class="container">
<div class="section-label">CONCEPT</div>
<h2 class="section-title">RAG란 무엇인가?</h2>
<p class="section-desc">
<strong>Retrieval-Augmented Generation</strong> — "검색으로 보강된 생성".<br>
LLM이 답변을 만들기 전에 관련 문서를 검색해서 참고하는 방식입니다.
</p>
<!-- 핵심 비유 -->
<div class="analogy-box reveal">
<div class="analogy-left">
<div class="analogy-emoji">📝</div>
<h4>일반 LLM</h4>
<p>클로즈드북 시험<br><span class="muted">머릿속 기억에만 의존</span></p>
</div>
<div class="analogy-vs">VS</div>
<div class="analogy-right">
<div class="analogy-emoji">📖</div>
<h4>RAG</h4>
<p>오픈북 시험<br><span class="muted">참고 자료를 보면서 답변</span></p>
</div>
</div>
<!-- 핵심 파이프라인 다이어그램 -->
<div class="pipeline-section reveal">
<h3 class="subsection-title">핵심 파이프라인</h3>
<div class="pipeline">
<div class="pipeline-step">
<div class="step-icon query-icon">Q</div>
<div class="step-label">Query</div>
<div class="step-desc">사용자 질문</div>
</div>
<div class="pipeline-arrow">
<svg viewBox="0 0 40 24"><path d="M0 12h32M24 4l8 8-8 8" stroke="currentColor" stroke-width="2" fill="none"/></svg>
</div>
<div class="pipeline-step">
<div class="step-icon retrieve-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
</div>
<div class="step-label">Retrieve</div>
<div class="step-desc">관련 문서 검색</div>
</div>
<div class="pipeline-arrow">
<svg viewBox="0 0 40 24"><path d="M0 12h32M24 4l8 8-8 8" stroke="currentColor" stroke-width="2" fill="none"/></svg>
</div>
<div class="pipeline-step">
<div class="step-icon augment-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="3"/><path d="M12 8v8M8 12h8"/></svg>
</div>
<div class="step-label">Augment</div>
<div class="step-desc">프롬프트에 삽입</div>
</div>
<div class="pipeline-arrow">
<svg viewBox="0 0 40 24"><path d="M0 12h32M24 4l8 8-8 8" stroke="currentColor" stroke-width="2" fill="none"/></svg>
</div>
<div class="pipeline-step">
<div class="step-icon generate-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 3v18M3 12l9 9 9-9"/></svg>
</div>
<div class="step-label">Generate</div>
<div class="step-desc">LLM 응답 생성</div>
</div>
</div>
</div>
<!-- 핵심 개념 3개 -->
<div class="concept-grid reveal">
<div class="concept-card">
<div class="concept-number">01</div>
<h4>임베딩 (Embedding)</h4>
<p>텍스트를 <strong>숫자 벡터</strong>로 변환하는 것. "고양이"와 "cat"은 의미가 비슷하므로 벡터 공간에서 가까이 위치합니다. 이를 통해 키워드가 아닌 <em>의미 기반 검색</em>이 가능해집니다.</p>
<div class="concept-visual embedding-visual">
<div class="vector-point" style="--x:20%;--y:30%;" data-label="고양이">
<span>고양이</span>
</div>
<div class="vector-point" style="--x:25%;--y:25%;" data-label="cat">
<span>cat</span>
</div>
<div class="vector-point" style="--x:70%;--y:60%;" data-label="자동차">
<span>자동차</span>
</div>
<div class="vector-point" style="--x:75%;--y:55%;" data-label="car">
<span>car</span>
</div>
<div class="vector-point" style="--x:22%;--y:40%;" data-label="강아지">
<span>강아지</span>
</div>
</div>
</div>
<div class="concept-card">
<div class="concept-number">02</div>
<h4>벡터 데이터베이스</h4>
<p>임베딩 벡터를 저장하고, <strong>유사도 검색</strong>을 빠르게 수행하는 특수 DB. 질문의 벡터와 가장 가까운 문서 벡터를 찾아 반환합니다.</p>
<div class="concept-visual db-visual">
<div class="db-icon-large">
<svg viewBox="0 0 64 64" fill="none">
<ellipse cx="32" cy="16" rx="24" ry="8" stroke="currentColor" stroke-width="2"/>
<path d="M8 16v16c0 4.4 10.7 8 24 8s24-3.6 24-8V16" stroke="currentColor" stroke-width="2"/>
<path d="M8 32v16c0 4.4 10.7 8 24 8s24-3.6 24-8V32" stroke="currentColor" stroke-width="2"/>
<ellipse cx="32" cy="32" rx="24" ry="8" stroke="currentColor" stroke-width="1" stroke-dasharray="4 4"/>
</svg>
</div>
<div class="db-examples">Pinecone, Weaviate, Chroma, Qdrant, pgvector</div>
</div>
</div>
<div class="concept-card">
<div class="concept-number">03</div>
<h4>시맨틱 검색</h4>
<p>키워드 매칭이 아닌 <strong>의미의 유사성</strong>으로 검색. "연봉 인상 방법"으로 검색하면 "급여 협상 전략"도 찾을 수 있습니다. 코사인 유사도로 벡터 간 거리를 측정합니다.</p>
<div class="concept-visual search-visual">
<div class="search-demo">
<div class="search-query">"연봉 인상 방법"</div>
<div class="search-results">
<div class="search-result match-high">급여 협상 전략 <span>0.92</span></div>
<div class="search-result match-mid">보상 체계 가이드 <span>0.85</span></div>
<div class="search-result match-low">회사 복리후생 <span>0.61</span></div>
</div>
</div>
</div>
</div>
</div>
<div class="paper-ref reveal">
<span class="paper-tag">원본 논문</span>
<strong>Lewis et al. (2020)</strong> — "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks"
<p>RAG-Sequence와 RAG-Token 두 가지 변형을 제안. DPR(Dense Passage Retrieval)로 검색하고 BART로 생성. NeurIPS 2020에서 발표되어 RAG 연구의 시작점이 되었습니다.</p>
</div>
</div>
</section>
<!-- ====== EVOLUTION OVERVIEW ====== -->
<section class="section" id="evolution">
<div class="container">
<div class="section-label">EVOLUTION</div>
<h2 class="section-title">RAG의 진화</h2>
<p class="section-desc">RAG는 3세대에 걸쳐 발전해 왔습니다. 각 세대가 이전의 한계를 어떻게 극복하는지 살펴봅니다.</p>
<div class="evolution-timeline reveal">
<div class="evo-item evo-naive">
<div class="evo-marker"></div>
<div class="evo-content">
<div class="evo-year">2020~2022</div>
<h3>Naive RAG</h3>
<p>고정된 파이프라인. Query → Retrieve → Generate. 단순하지만 한계가 명확합니다.</p>
<code>Query → Retrieve → Generate</code>
</div>
</div>
<div class="evo-item evo-advanced">
<div class="evo-marker"></div>
<div class="evo-content">
<div class="evo-year">2023~2024</div>
<h3>Advanced RAG</h3>
<p>검색 전/중/후를 최적화. 쿼리 리라이팅, 하이브리드 검색, 리랭킹 등을 추가합니다.</p>
<code>Query 최적화 → Hybrid Retrieve → Rerank → Generate</code>
</div>
</div>
<div class="evo-item evo-modular">
<div class="evo-marker"></div>
<div class="evo-content">
<div class="evo-year">2024~</div>
<h3>Modular RAG</h3>
<p>모듈 단위 조합. 라우터, 평가기, 반복 검색 등을 태스크에 맞게 동적으로 구성합니다.</p>
<code>Router → [동적 모듈 조합] → 자체 평가 → 반복/완료</code>
</div>
</div>
</div>
</div>
</section>
<!-- ====== NAIVE RAG ====== -->
<section class="section section-dark" id="naive-rag">
<div class="container">
<div class="section-label">STAGE 1</div>
<h2 class="section-title">Naive RAG</h2>
<p class="section-desc">가장 기본적인 "Retrieve → Read" 파이프라인. RAG의 출발점이지만, 한계가 분명합니다.</p>
<!-- Naive RAG 아키텍처 다이어그램 -->
<div class="arch-diagram reveal">
<svg class="arch-svg" viewBox="0 0 960 520" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="naiveGrad1" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#a78bfa" stop-opacity="0.2"/>
<stop offset="100%" stop-color="#6366f1" stop-opacity="0.1"/>
</linearGradient>
<linearGradient id="naiveGrad2" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#22d3ee" stop-opacity="0.2"/>
<stop offset="100%" stop-color="#6366f1" stop-opacity="0.1"/>
</linearGradient>
<linearGradient id="arrowGrad" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#a78bfa"/>
<stop offset="100%" stop-color="#6366f1"/>
</linearGradient>
<marker id="arrowHead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#a78bfa"/>
</marker>
<filter id="glow">
<feGaussianBlur stdDeviation="3" result="blur"/>
<feMerge><feMergeNode in="blur"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
</defs>
<!-- 배경 영역: Indexing Phase -->
<rect x="20" y="20" width="440" height="480" rx="16" fill="url(#naiveGrad1)" stroke="#a78bfa" stroke-opacity="0.2" stroke-width="1"/>
<text x="40" y="52" fill="#a78bfa" font-size="12" font-weight="600" font-family="monospace" letter-spacing="2">INDEXING PHASE (오프라인)</text>
<!-- 배경 영역: Query Phase -->
<rect x="500" y="20" width="440" height="480" rx="16" fill="url(#naiveGrad2)" stroke="#22d3ee" stroke-opacity="0.2" stroke-width="1"/>
<text x="520" y="52" fill="#22d3ee" font-size="12" font-weight="600" font-family="monospace" letter-spacing="2">QUERY PHASE (온라인)</text>
<!-- ===== INDEXING: Documents ===== -->
<rect x="60" y="80" width="160" height="64" rx="10" fill="#1e1e2a" stroke="#a78bfa" stroke-width="1.5"/>
<text x="140" y="106" text-anchor="middle" fill="#e8e8ed" font-size="14" font-weight="700">Documents</text>
<text x="140" y="126" text-anchor="middle" fill="#9898a8" font-size="11">PDF, DB, Web, API</text>
<!-- Arrow: Documents → Chunking -->
<line x1="140" y1="144" x2="140" y2="178" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- INDEXING: Chunking -->
<rect x="60" y="180" width="160" height="64" rx="10" fill="#1e1e2a" stroke="#a78bfa" stroke-width="1.5"/>
<text x="140" y="206" text-anchor="middle" fill="#e8e8ed" font-size="14" font-weight="700">Chunking</text>
<text x="140" y="226" text-anchor="middle" fill="#9898a8" font-size="11">고정 크기 분할</text>
<!-- Chunk 시각화 -->
<rect x="260" y="186" width="60" height="18" rx="4" fill="#a78bfa" fill-opacity="0.25" stroke="#a78bfa" stroke-width="1"/>
<text x="290" y="199" text-anchor="middle" fill="#a78bfa" font-size="9" font-weight="500">Chunk 1</text>
<rect x="260" y="208" width="60" height="18" rx="4" fill="#a78bfa" fill-opacity="0.15" stroke="#a78bfa" stroke-width="1"/>
<text x="290" y="221" text-anchor="middle" fill="#a78bfa" font-size="9" font-weight="500">Chunk 2</text>
<rect x="260" y="230" width="60" height="18" rx="4" fill="#a78bfa" fill-opacity="0.1" stroke="#a78bfa" stroke-width="1"/>
<text x="290" y="243" text-anchor="middle" fill="#a78bfa" font-size="9" font-weight="500">Chunk N</text>
<line x1="220" y1="212" x2="256" y2="212" stroke="#a78bfa" stroke-width="1" stroke-dasharray="4 3"/>
<!-- Arrow: Chunking → Embedding -->
<line x1="140" y1="244" x2="140" y2="278" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- INDEXING: Embedding Model -->
<rect x="60" y="280" width="160" height="64" rx="10" fill="#1e1e2a" stroke="#a78bfa" stroke-width="1.5"/>
<text x="140" y="306" text-anchor="middle" fill="#e8e8ed" font-size="14" font-weight="700">Embedding Model</text>
<text x="140" y="326" text-anchor="middle" fill="#9898a8" font-size="11">텍스트 → 벡터 변환</text>
<!-- 벡터 시각화 -->
<rect x="260" y="290" width="140" height="40" rx="6" fill="#16161f" stroke="#a78bfa" stroke-opacity="0.3" stroke-width="1"/>
<text x="270" y="310" fill="#a78bfa" font-size="9" font-family="monospace">[0.12, -0.45, 0.78,</text>
<text x="270" y="322" fill="#a78bfa" font-size="9" font-family="monospace"> 0.33, -0.91, ...]</text>
<line x1="220" y1="312" x2="256" y2="310" stroke="#a78bfa" stroke-width="1" stroke-dasharray="4 3"/>
<!-- Arrow: Embedding → Vector DB -->
<line x1="140" y1="344" x2="140" y2="378" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- INDEXING: Vector DB -->
<rect x="60" y="380" width="160" height="80" rx="10" fill="#1e1e2a" stroke="#a78bfa" stroke-width="2"/>
<ellipse cx="140" cy="400" rx="60" ry="12" fill="none" stroke="#a78bfa" stroke-width="1.5"/>
<path d="M80 400 v30 c0 6.6 26.9 12 60 12 s60-5.4 60-12 v-30" fill="none" stroke="#a78bfa" stroke-width="1.5"/>
<ellipse cx="140" cy="430" rx="60" ry="12" fill="none" stroke="#a78bfa" stroke-width="1" stroke-dasharray="4 3"/>
<text x="140" y="455" text-anchor="middle" fill="#a78bfa" font-size="12" font-weight="600">Vector DB</text>
<!-- ===== QUERY PHASE ===== -->
<!-- User Query -->
<rect x="540" y="80" width="160" height="64" rx="10" fill="#1e1e2a" stroke="#22d3ee" stroke-width="1.5"/>
<circle cx="570" cy="112" r="16" fill="#22d3ee" fill-opacity="0.15" stroke="#22d3ee" stroke-width="1.5"/>
<text x="570" y="117" text-anchor="middle" fill="#22d3ee" font-size="14" font-weight="800">?</text>
<text x="650" y="106" text-anchor="middle" fill="#e8e8ed" font-size="14" font-weight="700">User Query</text>
<text x="650" y="126" text-anchor="middle" fill="#9898a8" font-size="11">사용자 질문 입력</text>
<!-- Arrow: Query → Embed Query -->
<line x1="620" y1="144" x2="620" y2="178" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- Embed Query -->
<rect x="540" y="180" width="160" height="50" rx="10" fill="#1e1e2a" stroke="#22d3ee" stroke-width="1.5"/>
<text x="620" y="206" text-anchor="middle" fill="#e8e8ed" font-size="13" font-weight="600">Query Embedding</text>
<text x="620" y="222" text-anchor="middle" fill="#9898a8" font-size="10">질문도 벡터로 변환</text>
<!-- Arrow: Embed → Similarity Search -->
<line x1="620" y1="230" x2="620" y2="268" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- Similarity Search (connects to Vector DB) -->
<rect x="540" y="270" width="160" height="64" rx="10" fill="#1e1e2a" stroke="#6366f1" stroke-width="2" filter="url(#glow)"/>
<text x="620" y="296" text-anchor="middle" fill="#e8e8ed" font-size="14" font-weight="700">Similarity Search</text>
<text x="620" y="316" text-anchor="middle" fill="#9898a8" font-size="11">코사인 유사도 Top-K</text>
<!-- Connection: Vector DB ←→ Similarity Search -->
<path d="M220 420 Q 380 420 380 302 Q 380 302 536 302" fill="none" stroke="#6366f1" stroke-width="1.5" stroke-dasharray="6 4" marker-end="url(#arrowHead)"/>
<text x="380" y="370" text-anchor="middle" fill="#6366f1" font-size="10" font-weight="500">벡터 검색</text>
<!-- Arrow: Search → Prompt -->
<line x1="620" y1="334" x2="620" y2="368" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- Prompt Assembly -->
<rect x="540" y="370" width="160" height="50" rx="10" fill="#1e1e2a" stroke="#34d399" stroke-width="1.5"/>
<text x="620" y="394" text-anchor="middle" fill="#e8e8ed" font-size="13" font-weight="600">Prompt + Context</text>
<text x="620" y="410" text-anchor="middle" fill="#9898a8" font-size="10">질문 + 검색 문서 결합</text>
<!-- Arrow: Prompt → LLM -->
<line x1="700" y1="395" x2="760" y2="395" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- LLM -->
<rect x="762" y="360" width="150" height="70" rx="14" fill="#1e1e2a" stroke="#fb923c" stroke-width="2"/>
<text x="837" y="390" text-anchor="middle" fill="#fb923c" font-size="22" font-weight="800">LLM</text>
<text x="837" y="415" text-anchor="middle" fill="#9898a8" font-size="10">응답 생성</text>
<!-- Arrow: LLM → Response -->
<line x1="837" y1="430" x2="837" y2="468" stroke="#fb923c" stroke-width="1.5" marker-end="url(#arrowHead)"/>
<!-- Response -->
<rect x="762" y="470" width="150" height="24" rx="6" fill="#fb923c" fill-opacity="0.15" stroke="#fb923c" stroke-width="1"/>
<text x="837" y="487" text-anchor="middle" fill="#fb923c" font-size="12" font-weight="600">Response (답변)</text>
</svg>
</div>
<!-- 한계점 -->
<h3 class="subsection-title reveal">Naive RAG의 한계</h3>
<div class="limit-cards reveal">
<div class="limit-card">
<div class="limit-number">01</div>
<h4>Garbage In, Garbage Out</h4>
<p>검색 품질이 낮으면 응답도 함께 망가집니다. 관련 없는 문서가 검색되면 LLM은 그걸 기반으로 엉뚱한 답을 만듭니다.</p>
</div>
<div class="limit-card">
<div class="limit-number">02</div>
<h4>단순한 청킹</h4>
<p>고정 크기로 문서를 자르면 문맥이 잘리거나, 하나의 청크에 여러 주제가 섞여 노이즈가 됩니다.</p>
</div>
<div class="limit-card">
<div class="limit-number">03</div>
<h4>무분별한 전달</h4>
<p>검색된 문서가 질문과 관련 없어도 그대로 LLM에 전달합니다. 필터링이나 품질 평가가 없습니다.</p>
</div>
<div class="limit-card">
<div class="limit-number">04</div>
<h4>중복/상충 미처리</h4>
<p>중복 문서, 서로 모순되는 정보에 대한 처리 로직이 없어서 LLM이 혼란에 빠질 수 있습니다.</p>
</div>
</div>
</div>
</section>
<!-- ====== ADVANCED RAG ====== -->
<section class="section" id="advanced-rag">
<div class="container">
<div class="section-label">STAGE 2</div>
<h2 class="section-title">Advanced RAG</h2>
<p class="section-desc">Naive RAG의 한계를 검색 <strong>전/중/후</strong> 각 단계에서 체계적으로 보완합니다.</p>
<!-- Advanced RAG 아키텍처 다이어그램 -->
<div class="arch-diagram reveal">
<svg class="arch-svg" viewBox="0 0 960 490" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="advGrad" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#a78bfa" stop-opacity="0.08"/>
<stop offset="50%" stop-color="#6366f1" stop-opacity="0.12"/>
<stop offset="100%" stop-color="#22d3ee" stop-opacity="0.08"/>
</linearGradient>
<marker id="ah2" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#a78bfa"/>
</marker>
<marker id="ah3" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#22d3ee"/>
</marker>
<marker id="ah4" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#34d399"/>
</marker>
</defs>
<rect x="0" y="0" width="960" height="490" rx="16" fill="url(#advGrad)"/>
<!-- Phase Labels -->
<rect x="32" y="15" width="200" height="26" rx="6" fill="#a78bfa" fill-opacity="0.15"/>
<text x="132" y="33" text-anchor="middle" fill="#a78bfa" font-size="11" font-weight="700" letter-spacing="1">PRE-RETRIEVAL</text>
<rect x="295" y="15" width="200" height="26" rx="6" fill="#6366f1" fill-opacity="0.15"/>
<text x="395" y="33" text-anchor="middle" fill="#6366f1" font-size="11" font-weight="700" letter-spacing="1">RETRIEVAL</text>
<rect x="590" y="15" width="200" height="26" rx="6" fill="#22d3ee" fill-opacity="0.15"/>
<text x="690" y="33" text-anchor="middle" fill="#22d3ee" font-size="11" font-weight="700" letter-spacing="1">POST-RETRIEVAL</text>
<rect x="830" y="15" width="110" height="26" rx="6" fill="#fb923c" fill-opacity="0.15"/>
<text x="885" y="33" text-anchor="middle" fill="#fb923c" font-size="11" font-weight="700" letter-spacing="1">GENERATE</text>
<!-- ===== PRE-RETRIEVAL ===== -->
<!-- User Query -->
<rect x="40" y="70" width="170" height="50" rx="10" fill="#1e1e2a" stroke="#a78bfa" stroke-width="1.5"/>
<text x="125" y="92" text-anchor="middle" fill="#e8e8ed" font-size="13" font-weight="700">User Query</text>
<text x="125" y="108" text-anchor="middle" fill="#9898a8" font-size="10">원본 질문</text>
<!-- Arrow down -->
<line x1="125" y1="120" x2="125" y2="148" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#ah2)"/>
<!-- Query Rewriting -->
<rect x="40" y="150" width="170" height="50" rx="10" fill="#1e1e2a" stroke="#a78bfa" stroke-width="1.5"/>
<text x="125" y="172" text-anchor="middle" fill="#a78bfa" font-size="12" font-weight="700">Query Rewriting</text>
<text x="125" y="189" text-anchor="middle" fill="#9898a8" font-size="10">질문 최적화 / 분해</text>
<!-- Branch: HyDE -->
<line x1="125" y1="200" x2="70" y2="228" stroke="#a78bfa" stroke-width="1" stroke-dasharray="4 3"/>
<rect x="20" y="230" width="100" height="36" rx="6" fill="#16161f" stroke="#a78bfa" stroke-opacity="0.5" stroke-width="1"/>
<text x="70" y="252" text-anchor="middle" fill="#a78bfa" font-size="10" font-weight="500">HyDE</text>
<!-- Branch: Multi-Query -->
<line x1="125" y1="200" x2="180" y2="228" stroke="#a78bfa" stroke-width="1" stroke-dasharray="4 3"/>
<rect x="130" y="230" width="100" height="36" rx="6" fill="#16161f" stroke="#a78bfa" stroke-opacity="0.5" stroke-width="1"/>
<text x="180" y="252" text-anchor="middle" fill="#a78bfa" font-size="10" font-weight="500">Multi-Query</text>
<!-- Optimized queries merge -->
<line x1="70" y1="266" x2="125" y2="290" stroke="#a78bfa" stroke-width="1"/>
<line x1="180" y1="266" x2="125" y2="290" stroke="#a78bfa" stroke-width="1"/>
<!-- Optimized Query -->
<rect x="55" y="290" width="140" height="40" rx="8" fill="#a78bfa" fill-opacity="0.12" stroke="#a78bfa" stroke-width="1.5"/>
<text x="125" y="315" text-anchor="middle" fill="#a78bfa" font-size="12" font-weight="600">Optimized Query</text>
<!-- Arrow to Retrieval -->
<line x1="195" y1="310" x2="290" y2="310" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#ah2)"/>
<!-- ===== RETRIEVAL ===== -->
<!-- Hybrid Search Box -->
<rect x="295" y="60" width="200" height="300" rx="12" fill="#16161f" stroke="#6366f1" stroke-width="1.5"/>
<text x="395" y="88" text-anchor="middle" fill="#6366f1" font-size="13" font-weight="700">Hybrid Search</text>
<!-- Dense -->
<rect x="315" y="105" width="160" height="45" rx="8" fill="#1e1e2a" stroke="#a78bfa" stroke-opacity="0.5" stroke-width="1"/>
<text x="395" y="125" text-anchor="middle" fill="#a78bfa" font-size="11" font-weight="600">Dense (Vector)</text>
<text x="395" y="142" text-anchor="middle" fill="#9898a8" font-size="9">시맨틱 유사도</text>
<!-- Sparse -->
<rect x="315" y="160" width="160" height="45" rx="8" fill="#1e1e2a" stroke="#fb923c" stroke-opacity="0.5" stroke-width="1"/>
<text x="395" y="180" text-anchor="middle" fill="#fb923c" font-size="11" font-weight="600">Sparse (BM25)</text>
<text x="395" y="197" text-anchor="middle" fill="#9898a8" font-size="9">키워드 매칭</text>
<!-- RRF -->
<rect x="340" y="220" width="110" height="36" rx="8" fill="#6366f1" fill-opacity="0.2" stroke="#6366f1" stroke-width="1.5"/>
<text x="395" y="242" text-anchor="middle" fill="#6366f1" font-size="11" font-weight="700">RRF 결합</text>
<!-- Results -->
<rect x="330" y="272" width="130" height="36" rx="6" fill="#1e1e2a" stroke="#6366f1" stroke-opacity="0.5" stroke-width="1"/>
<text x="395" y="294" text-anchor="middle" fill="#e8e8ed" font-size="11" font-weight="500">Top-K 문서</text>
<!-- merge lines -->
<line x1="395" y1="150" x2="395" y2="158" stroke="#6366f1" stroke-width="1" stroke-dasharray="3 2"/>
<line x1="395" y1="205" x2="395" y2="218" stroke="#6366f1" stroke-width="1.5"/>
<line x1="395" y1="256" x2="395" y2="270" stroke="#6366f1" stroke-width="1.5"/>
<!-- Vector DB on the side -->
<rect x="310" y="370" width="170" height="50" rx="10" fill="#1e1e2a" stroke="#6366f1" stroke-width="1.5"/>
<text x="395" y="395" text-anchor="middle" fill="#6366f1" font-size="12" font-weight="600">Vector DB + BM25 Index</text>
<text x="395" y="412" text-anchor="middle" fill="#9898a8" font-size="9">멀티 인덱스 전략</text>
<line x1="395" y1="360" x2="395" y2="368" stroke="#6366f1" stroke-width="1" stroke-dasharray="4 3"/>
<!-- Arrow to Post-Retrieval -->
<line x1="497" y1="290" x2="578" y2="290" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#ah3)"/>
<!-- ===== POST-RETRIEVAL ===== -->
<!-- Reranker -->
<rect x="582" y="60" width="200" height="300" rx="12" fill="#16161f" stroke="#22d3ee" stroke-width="1.5"/>
<text x="682" y="88" text-anchor="middle" fill="#22d3ee" font-size="13" font-weight="700">Post-Processing</text>
<rect x="602" y="105" width="160" height="50" rx="8" fill="#1e1e2a" stroke="#22d3ee" stroke-opacity="0.6" stroke-width="1.5"/>
<text x="682" y="127" text-anchor="middle" fill="#22d3ee" font-size="12" font-weight="700">Reranker</text>
<text x="682" y="145" text-anchor="middle" fill="#9898a8" font-size="9">Cross-Encoder 재순위화</text>
<line x1="682" y1="155" x2="682" y2="170" stroke="#22d3ee" stroke-width="1"/>
<!-- Compression -->
<rect x="602" y="172" width="160" height="44" rx="8" fill="#1e1e2a" stroke="#22d3ee" stroke-opacity="0.4" stroke-width="1"/>
<text x="682" y="194" text-anchor="middle" fill="#22d3ee" font-size="11" font-weight="600">Compression</text>
<text x="682" y="209" text-anchor="middle" fill="#9898a8" font-size="9">관련 부분만 추출</text>
<line x1="682" y1="216" x2="682" y2="230" stroke="#22d3ee" stroke-width="1"/>
<!-- Dedup -->
<rect x="602" y="232" width="160" height="44" rx="8" fill="#1e1e2a" stroke="#22d3ee" stroke-opacity="0.4" stroke-width="1"/>
<text x="682" y="254" text-anchor="middle" fill="#22d3ee" font-size="11" font-weight="600">Dedup & Filter</text>
<text x="682" y="269" text-anchor="middle" fill="#9898a8" font-size="9">중복 제거, MMR</text>
<!-- Refined Context -->
<rect x="612" y="296" width="140" height="36" rx="6" fill="#22d3ee" fill-opacity="0.12" stroke="#22d3ee" stroke-width="1.5"/>
<text x="682" y="318" text-anchor="middle" fill="#22d3ee" font-size="11" font-weight="600">Refined Context</text>
<line x1="682" y1="276" x2="682" y2="294" stroke="#22d3ee" stroke-width="1"/>
<!-- Arrow to Generate -->
<line x1="784" y1="314" x2="825" y2="314" stroke="#34d399" stroke-width="1.5" marker-end="url(#ah4)"/>
<!-- ===== GENERATE ===== -->
<rect x="828" y="70" width="112" height="290" rx="12" fill="#16161f" stroke="#fb923c" stroke-width="1.5"/>
<!-- Prompt -->
<rect x="843" y="95" width="82" height="50" rx="8" fill="#1e1e2a" stroke="#34d399" stroke-opacity="0.5" stroke-width="1"/>
<text x="884" y="117" text-anchor="middle" fill="#34d399" font-size="10" font-weight="600">Prompt</text>
<text x="884" y="135" text-anchor="middle" fill="#9898a8" font-size="8">Q + Context</text>
<line x1="884" y1="145" x2="884" y2="165" stroke="#fb923c" stroke-width="1.5"/>
<!-- LLM -->
<rect x="843" y="168" width="82" height="60" rx="10" fill="#fb923c" fill-opacity="0.12" stroke="#fb923c" stroke-width="2"/>
<text x="884" y="198" text-anchor="middle" fill="#fb923c" font-size="18" font-weight="800">LLM</text>
<text x="884" y="218" text-anchor="middle" fill="#9898a8" font-size="8">생성</text>
<line x1="884" y1="228" x2="884" y2="248" stroke="#fb923c" stroke-width="1.5"/>
<!-- Response -->
<rect x="843" y="250" width="82" height="36" rx="6" fill="#fb923c" fill-opacity="0.15" stroke="#fb923c" stroke-width="1"/>
<text x="884" y="272" text-anchor="middle" fill="#fb923c" font-size="11" font-weight="600">Response</text>
<!-- 하단 범례 -->
<rect x="320" y="450" width="12" height="12" rx="3" fill="#a78bfa"/>
<text x="338" y="461" fill="#9898a8" font-size="10">쿼리 최적화</text>
<rect x="440" y="450" width="12" height="12" rx="3" fill="#6366f1"/>
<text x="458" y="461" fill="#9898a8" font-size="10">하이브리드 검색</text>
<rect x="570" y="450" width="12" height="12" rx="3" fill="#22d3ee"/>
<text x="588" y="461" fill="#9898a8" font-size="10">후처리 (Rerank + 압축)</text>
</svg>
</div>
<!-- 3단계 탭 -->
<div class="adv-tabs reveal">
<div class="tab-buttons">
<button class="tab-btn active" data-tab="pre">
<span class="tab-number">1</span>
Pre-Retrieval
</button>
<button class="tab-btn" data-tab="retrieval">
<span class="tab-number">2</span>
Retrieval
</button>
<button class="tab-btn" data-tab="post">
<span class="tab-number">3</span>
Post-Retrieval
</button>
</div>
<!-- Pre-Retrieval -->
<div class="tab-content active" id="tab-pre">
<div class="technique-grid">
<div class="technique-card">
<h4>Query Rewriting</h4>
<p>사용자 질문을 검색에 유리한 형태로 변환합니다. 구어체 → 검색 쿼리, 복합 질문 → 단일 질문 분리 등.</p>
<div class="technique-example">
<div class="example-before">"우리 회사 휴가 어떻게 쓰는 거야?"</div>
<div class="example-arrow">→</div>
<div class="example-after">"연차 휴가 사용 절차 및 규정"</div>
</div>
</div>
<div class="technique-card">
<h4>HyDE <span class="paper-badge">Gao et al., 2022</span></h4>
<p><strong>Hypothetical Document Embeddings</strong> — LLM이 먼저 가상의 답변을 생성하고, 그 답변의 임베딩으로 검색합니다. 질문보다 답변이 문서와 더 유사하다는 통찰.</p>
<div class="technique-flow">
<span class="flow-step">질문</span>
<span class="flow-arrow">→</span>
<span class="flow-step highlight">가상 답변 생성</span>
<span class="flow-arrow">→</span>
<span class="flow-step">답변 임베딩으로 검색</span>
</div>
</div>
<div class="technique-card">
<h4>Query Expansion</h4>
<p>하나의 질문을 여러 관점에서 확장해서 검색 범위를 넓힙니다. Multi-Query, Sub-Question Decomposition 등의 기법이 있습니다.</p>
</div>
<div class="technique-card">
<h4>청킹 전략 고도화</h4>
<p>고정 크기가 아닌 의미 단위로 문서를 분할합니다.</p>
<div class="chunk-comparison">
<div class="chunk-type">
<strong>Recursive</strong>
<span class="chunk-desc">구분자 계층으로 재귀 분할. 강한 기본선이지만 자체 평가 필요</span>
</div>
<div class="chunk-type">
<strong>Semantic</strong>
<span class="chunk-desc">의미 변화 지점에서 분할. 높은 재현율</span>
</div>
<div class="chunk-type">
<strong>Parent-Child</strong>
<span class="chunk-desc">작은 청크로 검색, 큰 청크로 컨텍스트 제공</span>
</div>
<div class="chunk-type">
<strong>Sentence Window</strong>
<span class="chunk-desc">문장 단위 검색 + 주변 문장 포함</span>
</div>
</div>
</div>
<div class="technique-card">
<h4>Contextual Retrieval <span class="paper-badge">Anthropic, 2024</span></h4>
<p>각 청크에 <strong>문서 수준의 맥락을 접두사로 추가</strong>한 뒤 임베딩합니다. "이 청크는 2024년 매출 보고서의 3분기 실적 섹션에서 발췌한 내용입니다" 같은 맥락 정보를 붙여서 검색 정확도를 크게 향상시킵니다.</p>
</div>
<div class="technique-card">
<h4>메타데이터 태깅</h4>
<p>문서에 날짜, 출처, 카테고리, 작성자 등 부가 정보를 부착합니다. 필터링과 결합하면 검색 정밀도가 크게 올라갑니다.</p>
</div>
</div>
</div>
<!-- Retrieval -->
<div class="tab-content" id="tab-retrieval">
<div class="technique-grid">
<div class="technique-card technique-featured">
<h4>하이브리드 검색</h4>
<p>Dense(벡터) 검색과 Sparse(BM25 키워드) 검색을 <strong>결합</strong>합니다. 의미 유사성 + 키워드 정확성을 동시에 잡아 가장 안정적인 성능을 제공합니다.</p>
<div class="hybrid-visual">
<div class="hybrid-side">
<div class="hybrid-label">Dense (벡터)</div>
<div class="hybrid-bar dense-bar"></div>
<span class="hybrid-desc">의미 유사성 기반</span>
</div>
<div class="hybrid-plus">+</div>
<div class="hybrid-side">
<div class="hybrid-label">Sparse (BM25)</div>
<div class="hybrid-bar sparse-bar"></div>
<span class="hybrid-desc">키워드 매칭 기반</span>
</div>
<div class="hybrid-equals">=</div>
<div class="hybrid-side">
<div class="hybrid-label">Hybrid</div>
<div class="hybrid-bar hybrid-bar-result"></div>
<span class="hybrid-desc">최적의 검색 결과</span>
</div>
</div>
</div>
<div class="technique-card">
<h4>Fine-tuned Embedding</h4>
<p>도메인 특화 데이터로 임베딩 모델을 추가 학습합니다. 개선 폭은 데이터와 평가 방식에 따라 크게 달라지므로 실제 도메인 평가셋에서 일반 모델과 비교해야 합니다.</p>
</div>
<div class="technique-card">
<h4>Multi-Index 전략</h4>
<p>요약 인덱스, 원문 인덱스, 메타데이터 인덱스 등을 <strong>계층화</strong>합니다. 요약으로 먼저 관련 문서를 좁히고, 원문에서 세부 정보를 가져오는 방식.</p>
</div>
<div class="technique-card">
<h4>Late Interaction (ColBERT)</h4>
<p><strong>토큰별 임베딩</strong>을 저장하고 MaxSim 연산으로 유사도를 계산합니다. Bi-Encoder의 속도와 Cross-Encoder의 정확도 사이에서 좋은 균형을 잡습니다. ColPali/ColQwen은 이를 멀티모달로 확장.</p>
</div>
</div>
</div>
<!-- Post-Retrieval -->
<div class="tab-content" id="tab-post">
<div class="technique-grid">
<div class="technique-card technique-featured">
<h4>Reranker (재순위화)</h4>
<p>검색 결과를 <strong>Cross-Encoder</strong>로 다시 평가해서 순위를 재조정합니다. 질문-문서 쌍을 함께 보기 때문에 더 정밀한 관련성 판단이 가능합니다.</p>
<div class="rerank-visual">
<div class="rerank-before">
<div class="rerank-label">검색 결과 (Before)</div>
<div class="rerank-item">문서 A <span class="score">0.82</span></div>
<div class="rerank-item">문서 B <span class="score">0.79</span></div>
<div class="rerank-item highlight-bad">문서 C <span class="score">0.77</span></div>
<div class="rerank-item">문서 D <span class="score">0.75</span></div>
</div>
<div class="rerank-arrow">
<svg viewBox="0 0 48 24"><path d="M4 12h32M28 4l8 8-8 8" stroke="currentColor" stroke-width="2" fill="none"/></svg>
<span>Rerank</span>
</div>
<div class="rerank-after">
<div class="rerank-label">재순위 (After)</div>
<div class="rerank-item highlight-good">문서 C <span class="score">0.95</span></div>
<div class="rerank-item">문서 A <span class="score">0.88</span></div>
<div class="rerank-item">문서 D <span class="score">0.72</span></div>
<div class="rerank-item">문서 B <span class="score">0.45</span></div>
</div>
</div>
<p class="technique-note">Cohere Rerank, bge-reranker, FlashRank 등을 후보로 두고 도입 전후의 MAP·nDCG·지연시간을 함께 측정하세요.</p>
</div>
<div class="technique-card">
<h4>문서 압축 (Compression)</h4>
<p>검색된 문서에서 <strong>관련 있는 부분만 추출</strong>해서 컨텍스트 윈도우를 절약합니다. LongLLMLingua 등의 방식으로 핵심 문장만 남깁니다.</p>
</div>
<div class="technique-card">
<h4>중복 제거 및 필터링</h4>
<p>유사도 임계값, MMR(Maximal Marginal Relevance) 등으로 중복 문서를 제거하고 다양성을 확보합니다.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- ====== MODULAR RAG ====== -->
<section class="section section-dark" id="modular-rag">
<div class="container">
<div class="section-label">STAGE 3</div>
<h2 class="section-title">Modular RAG</h2>
<p class="section-desc">
파이프라인을 고정된 순서가 아닌 <strong>모듈 단위</strong>로 분리해서 태스크에 맞게 조합하는 패러다임입니다.
</p>
<!-- Modular RAG 아키텍처 다이어그램 -->
<div class="arch-diagram reveal">
<svg class="arch-svg" viewBox="0 0 960 480" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="modGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#a78bfa" stop-opacity="0.06"/>
<stop offset="100%" stop-color="#22d3ee" stop-opacity="0.06"/>
</linearGradient>
<marker id="mah" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#a78bfa"/>
</marker>
<marker id="mahG" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#34d399"/>
</marker>
<marker id="mahR" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#f87171"/>
</marker>
<marker id="mahO" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#fb923c"/>
</marker>
</defs>
<rect x="0" y="0" width="960" height="480" rx="16" fill="url(#modGrad)"/>
<!-- User Query -->
<rect x="40" y="200" width="120" height="60" rx="10" fill="#1e1e2a" stroke="#a78bfa" stroke-width="2"/>
<text x="100" y="226" text-anchor="middle" fill="#e8e8ed" font-size="13" font-weight="700">Query</text>
<text x="100" y="244" text-anchor="middle" fill="#9898a8" font-size="10">사용자 질문</text>
<!-- Arrow to Router -->
<line x1="160" y1="230" x2="208" y2="230" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#mah)"/>
<!-- ROUTER — central hub -->
<rect x="212" y="180" width="130" height="100" rx="14" fill="#a78bfa" fill-opacity="0.12" stroke="#a78bfa" stroke-width="2"/>
<text x="277" y="218" text-anchor="middle" fill="#a78bfa" font-size="16" font-weight="800">Router</text>
<text x="277" y="240" text-anchor="middle" fill="#9898a8" font-size="10">질문 유형 판단</text>
<text x="277" y="255" text-anchor="middle" fill="#9898a8" font-size="10">경로 결정</text>
<!-- Path 1: Simple → Direct LLM (top) -->
<path d="M277 180 Q 277 120 370 120" fill="none" stroke="#34d399" stroke-width="1.5" stroke-dasharray="6 3" marker-end="url(#mahG)"/>
<rect x="374" y="96" width="140" height="48" rx="8" fill="#1e1e2a" stroke="#34d399" stroke-width="1.5"/>
<text x="444" y="117" text-anchor="middle" fill="#34d399" font-size="11" font-weight="700">Direct LLM</text>
<text x="444" y="134" text-anchor="middle" fill="#9898a8" font-size="9">검색 불필요 → 바로 생성</text>
<text x="338" y="110" fill="#34d399" font-size="9" font-weight="600">단순 질문</text>
<!-- Path 2: Normal → Retrieve → Generate (middle) -->
<line x1="342" y1="220" x2="373" y2="220" stroke="#6366f1" stroke-width="1.5" marker-end="url(#mah)"/>
<!-- Retrieval Module -->
<rect x="376" y="186" width="130" height="68" rx="10" fill="#1e1e2a" stroke="#6366f1" stroke-width="1.5"/>
<text x="441" y="212" text-anchor="middle" fill="#6366f1" font-size="12" font-weight="700">Retrieval</text>
<text x="441" y="230" text-anchor="middle" fill="#9898a8" font-size="9">Multi-Source 검색</text>
<text x="441" y="244" text-anchor="middle" fill="#9898a8" font-size="9">Vector / Web / SQL</text>
<!-- Arrow to Judge -->
<line x1="506" y1="220" x2="543" y2="220" stroke="#6366f1" stroke-width="1.5" marker-end="url(#mah)"/>
<!-- Judge Module -->
<rect x="546" y="180" width="120" height="80" rx="10" fill="#fb923c" fill-opacity="0.1" stroke="#fb923c" stroke-width="2"/>
<text x="606" y="210" text-anchor="middle" fill="#fb923c" font-size="14" font-weight="800">Judge</text>
<text x="606" y="228" text-anchor="middle" fill="#9898a8" font-size="9">충분한가?</text>
<text x="606" y="244" text-anchor="middle" fill="#9898a8" font-size="9">품질 평가</text>
<!-- Judge → Sufficient → Generate -->
<line x1="666" y1="210" x2="718" y2="210" stroke="#34d399" stroke-width="1.5" marker-end="url(#mahG)"/>
<text x="692" y="200" fill="#34d399" font-size="9" font-weight="600">충분</text>
<!-- Judge → Insufficient → Re-Retrieve (loop back) -->
<path d="M606 260 Q 606 310 441 310 Q 441 310 441 258" fill="none" stroke="#f87171" stroke-width="1.5" stroke-dasharray="6 3" marker-end="url(#mahR)"/>
<text x="530" y="304" fill="#f87171" font-size="9" font-weight="600">부족 → 재검색</text>
<!-- Judge → Ambiguous → Web Search -->
<path d="M606 260 Q 606 350 520 370" fill="none" stroke="#fb923c" stroke-width="1.5" stroke-dasharray="6 3" marker-end="url(#mahO)"/>
<rect x="416" y="358" width="110" height="40" rx="8" fill="#1e1e2a" stroke="#fb923c" stroke-opacity="0.6" stroke-width="1"/>
<text x="471" y="378" text-anchor="middle" fill="#fb923c" font-size="10" font-weight="600">Web Search</text>
<text x="471" y="392" text-anchor="middle" fill="#9898a8" font-size="8">보조 소스</text>
<text x="580" y="356" fill="#fb923c" font-size="9" font-weight="600">모호</text>
<!-- Generate Module -->
<rect x="722" y="176" width="120" height="68" rx="10" fill="#1e1e2a" stroke="#34d399" stroke-width="2"/>
<text x="782" y="204" text-anchor="middle" fill="#34d399" font-size="14" font-weight="700">Generate</text>
<text x="782" y="224" text-anchor="middle" fill="#9898a8" font-size="9">LLM 응답 생성</text>
<text x="782" y="238" text-anchor="middle" fill="#9898a8" font-size="9">+ 출처 첨부</text>
<!-- Generate → Self-Evaluate -->
<line x1="842" y1="210" x2="868" y2="210" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#mah)"/>
<!-- Self-Evaluate -->
<rect x="872" y="172" width="68" height="76" rx="10" fill="#22d3ee" fill-opacity="0.1" stroke="#22d3ee" stroke-width="1.5"/>
<text x="906" y="200" text-anchor="middle" fill="#22d3ee" font-size="10" font-weight="700">Self</text>
<text x="906" y="214" text-anchor="middle" fill="#22d3ee" font-size="10" font-weight="700">Eval</text>
<text x="906" y="238" text-anchor="middle" fill="#9898a8" font-size="8">품질 OK?</text>
<!-- Self-Eval → Output (pass) -->
<line x1="906" y1="248" x2="906" y2="300" stroke="#34d399" stroke-width="1.5" marker-end="url(#mahG)"/>
<rect x="856" y="304" width="100" height="36" rx="8" fill="#34d399" fill-opacity="0.15" stroke="#34d399" stroke-width="1.5"/>
<text x="906" y="326" text-anchor="middle" fill="#34d399" font-size="12" font-weight="700">Response</text>
<!-- Self-Eval → loop back (fail) -->
<path d="M872 220 Q 830 280 782 248" fill="none" stroke="#f87171" stroke-width="1.5" stroke-dasharray="5 3" marker-end="url(#mahR)"/>
<text x="824" y="275" fill="#f87171" font-size="8" font-weight="600">재생성</text>
<!-- Path 3: Complex → Multi-step (bottom) -->
<path d="M277 280 Q 277 370 374 408" fill="none" stroke="#f472b6" stroke-width="1.5" stroke-dasharray="6 3"/>
<text x="290" y="355" fill="#f472b6" font-size="9" font-weight="600">복잡 질문</text>
<!-- Multi-step Reasoning -->
<rect x="376" y="420" width="200" height="44" rx="8" fill="#1e1e2a" stroke="#f472b6" stroke-width="1.5"/>
<text x="476" y="442" text-anchor="middle" fill="#f472b6" font-size="11" font-weight="700">Iterative Retrieval + Memory</text>
<text x="476" y="458" text-anchor="middle" fill="#9898a8" font-size="9">멀티스텝 검색-생성 반복</text>
<!-- Multi-step → Judge -->
<path d="M576 442 Q 640 442 640 310 Q 640 260 606 260" fill="none" stroke="#f472b6" stroke-width="1" stroke-dasharray="4 3"/>
<!-- 하단 범례 -->
<line x1="40" y1="455" x2="60" y2="455" stroke="#34d399" stroke-width="2"/>
<text x="66" y="459" fill="#9898a8" font-size="9">통과 경로</text>
<line x1="140" y1="455" x2="160" y2="455" stroke="#f87171" stroke-width="2" stroke-dasharray="5 3"/>
<text x="166" y="459" fill="#9898a8" font-size="9">재시도 루프</text>
<line x1="250" y1="455" x2="270" y2="455" stroke="#fb923c" stroke-width="2" stroke-dasharray="5 3"/>
<text x="276" y="459" fill="#9898a8" font-size="9">보정 경로</text>
</svg>
</div>
<!-- 모듈 그리드 -->
<div class="module-grid reveal">
<div class="module-card module-router">
<div class="module-icon">🔀</div>
<h4>Router</h4>
<p>질문 유형을 판단해서 검색이 필요한지, 어떤 소스를 쓸지 결정합니다. 단순 질문은 바로 LLM 생성으로.</p>
</div>
<div class="module-card module-judge">
<div class="module-icon">⚖️</div>
<h4>Judge / Critic</h4>
<p>검색 결과가 충분한지 평가합니다. 부족하면 재검색을 트리거하거나 다른 소스로 전환합니다.</p>
</div>
<div class="module-card module-adaptive">
<div class="module-icon">🧠</div>
<h4>Adaptive Retrieval</h4>
<p>LLM이 스스로 "지금 검색이 필요한 시점인가?"를 판단합니다. 불필요한 검색을 줄여 효율성을 높입니다.</p>
</div>
<div class="module-card module-multi">
<div class="module-icon">🔗</div>
<h4>Multi-Source</h4>
<p>벡터 DB, 웹 검색, SQL DB, API 등 여러 소스를 동적으로 선택합니다.</p>
</div>
<div class="module-card module-iterative">
<div class="module-icon">🔄</div>
<h4>Iterative Retrieval</h4>
<p>한 번이 아니라 여러 차례 검색-생성을 반복하며 답변을 정제합니다.</p>
</div>
<div class="module-card module-memory">
<div class="module-icon">💾</div>
<h4>Memory</h4>
<p>이전 대화나 검색 이력을 활용해서 맥락을 유지합니다.</p>
</div>
</div>
<!-- 대표 패턴 -->
<h3 class="subsection-title reveal">대표 구현 패턴</h3>
<div class="pattern-cards reveal">
<!-- Self-RAG -->
<div class="pattern-card">
<div class="pattern-header">
<h4>Self-RAG</h4>
<span class="paper-badge">Asai et al., ICLR 2024</span>
</div>
<p>LLM이 <strong>Reflection Token</strong>으로 검색 필요 여부, 문서 관련성, 응답 품질을 <em>자체 판단</em>합니다.</p>
<div class="pattern-flow">
<div class="pf-step">질문 입력</div>
<div class="pf-arrow">→</div>
<div class="pf-step pf-decision">[Retrieve] 토큰?</div>
<div class="pf-branch">
<div class="pf-yes">
<span class="pf-label">Yes</span>
<div class="pf-step">검색 수행</div>
<div class="pf-arrow">→</div>
<div class="pf-step pf-decision">[IsRel] 관련?</div>
<div class="pf-arrow">→</div>
<div class="pf-step">생성</div>
<div class="pf-arrow">→</div>
<div class="pf-step pf-decision">[IsSup] 근거?</div>
</div>