MM-RAG (Multimodal RAG) (HE)

From Systems analysis Wiki
Jump to navigation Jump to search

MM-RAG (באנגלית: Multimodal Retrieval-Augmented Generation) — הוא הרחבה של הפרדיגמה הקלאסית RAG, שבה LLM משתמש למתן תשובות לא רק בטקסט, אלא גם בנתונים חזותיים (תמונות, תרשימים, טבלאות, גרפים). ה-retrieval המולטימודאלי מאפשר למצוא ולקשר ראיות בייצוגים שונים, תוך הפחתת סיכון ההזיות על ידי הישענות על מקורות חיצוניים עם עיגון מדויק לקטעי דפים ולאזורים (bounding boxes)[1][2].

MM-RAG שימושי במיוחד עבור מסמכים שבהם חלק משמעותי מהמשמעות מיוצג בצורה לא-טקסטואלית (פריסת עמוד, דיאגרמות, מבנה טבלאות). במקרים כאלה, RAG טקסטואלי קלאסי מאבד לעתים קרובות אלמנטים חשובים של ההקשר[3][4].

הקשר ובעיה הנפתרת

RAG קלאסי פועל עם קטעי טקסט ואינו רואה מבנים חזותיים (מיקום אלמנטים, כיתובי איורים, צירי גרפים). MM-RAG סוגר פערים אלה: הוא מחלץ אלמנטים מובנים (טקסט, טבלאות, תמונות עם קואורדינטות), מאנדקס אותם למרחב וקטורי ומשלב ראיות ממודאליות שונות[5][6].

ארכיטקטורת MM-RAG

צינור ה-MM-RAG מוסיף ל-RAG הקלאסי שלבי עיבוד נתונים חזותיים ויישור מודאליות: קליטה ← אינדוקסציה ← retrieval מולטימודאלי ← מיזוג ודירוג מחדש ← יצירה עם מעקב.

  1. איסוף ועיבוד מקדים (Ingestion). הקלט הוא קובצי PDF/סריקות/תמונות. מתבצעים OCR וניתוח פריסה של העמוד לשם חילוץ אזורים: פסקאות, כותרות, טבלאות, תמונות וקואורדינטותיהן. כלים אופייניים — מודלים מסדרת LayoutLM וספריות כלים LayoutParser; ולידציה ואימון מסתמכים לעתים קרובות על datasets כמו PubLayNet ו-DocLayNet[7][8][9].
  2. פילוח לאזורים. מחולצים אובייקטים חזותיים (דיאגרמות, טבלאות, איורים, כיתובים). לשם יציבות מוגברת נעשה שימוש במודלי OCR‑free (כגון Donut) או ב-pipelines משולבים של OCR+VLM[10].
  3. אינדוקסציה (Vector Index). קטעי טקסט ואלמנטים חזותיים (תמונות או תיאוריהן) מומרים לייצוגים וקטוריים ומוכנסים למסד נתונים וקטורי. לשם מרחב מאוחד text↔image נעשה שימוש ב-CLIP או SigLIP; לסביבות ייצור נוחים אינדקסים מולטימודאליים/מולטי-וקטוריים (אובייקט אחד — וקטורים מרובים)[6][11][12].
  4. Retrieval מולטימודאלי ודירוג מחדש. מתבצעת שילוב של חיפוש טקסטואלי וחזותי; מועמדים (פסקאות, טבלאות, תמונות/אזורים) מאוחדים ומדורגים מחדש על ידי מודל "כבד" יותר (cross‑encoder/LLM‑reranker) לשיפור הדיוק[13].
  5. אריזת הקשר ויצירה. הקטעים שנבחרו מוזנים ל-LLM/VLM. אם המודל מולטימודאלי (כגון GPT‑4V/4o), ניתן להזין תמונות ישירות; עם LLM טקסטואלי, התמונות ממירות מראש לתיאורים מפורטים[14][15].
  6. מעקב וציטוט. התשובה מלווה בציטוטים הניתנים ללחיצה עם עיגון לא רק למסמך/עמוד, אלא גם לאזור (קואורדינטות). הדבר מגביר את רמת ה-grounding ואת אמון המשתמשים[2].

הערכת איכות ומדדים

אפקטיביות MM‑RAG נמדדת ברמות החילוץ, ה-retrieval והיצירה.

  • איכות חילוץ נתונים חזותיים. דיוק OCR (WER/CER), איכות ניתוח פריסה (mAP/Precision/Recall) על אוספי DocLayNet/PubLayNet[8][7].
  • איכות ה-retrieval. מדדי אחזור מידע סטנדרטיים: Recall@K, Precision@K, MRR; עבור מולטימודאליות — בנפרד לפי מודאליות ובאיחוד.
  • איכות התשובה (end‑to‑end). מדדים אוטומטיים של faithfulness/groundedness והערכה אנושית. בפועל נעשה שימוש במסגרות RAGAS/TruLens/DeepEval[16].
  • Benchmarks.
    • DocVQA: שאלות על תמונות מסמכים[3].
    • TextVQA: שאלות הדורשות קריאת טקסט בתמונות[4].
    • InfographicVQA: שאלות על אינפוגרפיקות[17].
    • ChartQA: שאלות על דיאגרמות עם דרישה להיסק לוגי[18].
    • MMDocRAG: benchmark של Multimodal RAG עבור DocQA (מסמכים רב-עמודיים, שרשראות ראיות צולבות-מודאליות)[19].

טבלת השוואה של רכיבים

השוואה של רכיבים וגישות מרכזיות ב-MM‑RAG
רכיב אפשרויות מימוש יתרונות חסרונות / סיכונים מתי לבחור
OCR Tesseract / PaddleOCR / API מבוסס ענן מקומי — פרטיות ושליטה; ענן — דיוק גבוה מהקופסה. שגיאות בפריסה מורכבת; API — עלות ודרישות compliance. נתונים פרטיים — OCR מקומי; דיוק מרבי — ענן (אם מותר).
ניתוח פריסה כללים / מודל ML (LayoutLM, LayoutParser) כללים פשוטים לתבניות אחידות; ML — עמיד לגיוון. כללים נשברים בפריסות חדשות; ML דורש משאבים/נתונים. טפסים אחידים — כללים; קורפוס מגוון — ML.
וקטוריזציה (תמונות) CLIP / SigLIP / תיאורי OCR‑free (Donut/Pix2Struct) מרחב חביון משותף text↔image (CLIP/SigLIP); OCR‑free מסיר תלות ב-OCR. CLIP אינו קורא טקסט בתוך תמונות; תיאורים עלולים לסלף את המשמעות. CLIP/SigLIP — חיפוש מולטימודאלי בסיסי; OCR‑free לסריקות באיכות מורכבת.
מיזוג תוצאות מיון לפי ציון / מכסות לפי מודאליות / LLM‑reranker reranker משפר משמעותית את דיוק בחירת ההקשר. עלייה בזמן תגובה ובעלות. תרחישי high‑precision; שיטות פשוטות — ל-PoC.
מאגר/אינדקס וקטור יחיד / מולטי-וקטור (text+image) / היברידי (BM25+vector) מולטי-וקטור מכסה ייצוגים שונים של אותו אובייקט; היברידי מציל מילות מפתח/קודים. מורכבות הסכמה והעדכונים. מערכות ייצור עם נתונים מעורבים ו-SLA קפדניים.

הערות מעשיות

  • חיפוש היברידי (BM25 + וקטור) — סטנדרט de‑facto לשיפור היקף ודיוק על מונחים/קודים ספציפיים[20].
  • דירוג מחדש על ידי cross‑encoder/LLM חוסך tokens בכך שהוא מסנן מועמדים "זבל" לפני היצירה[13].
  • VLM‑retrievers מודרניים (כגון ColPali) מפגינים יתרונות על מסמכים עשירים חזותית הודות לאינדוקסציה ישירה של עמודים כתמונות[21].

ספרות

  • Lewis, P. et al. (2020). Retrieval‑Augmented Generation for Knowledge‑Intensive NLP Tasks. NeurIPS. arXiv:2005.11401.
  • Gao, L. et al. (2023). Precise Zero‑Shot Dense Retrieval without Relevance Labels (HyDE). ACL 2023. arXiv:2212.10496.
  • Mei, L., Mo, S., Yang, Z., Chen, C. (2025). A Survey of Multimodal Retrieval‑Augmented Generation. arXiv:2504.08748.
  • Abootorabi, M.M. et al. (2025). Ask in Any Modality: A Comprehensive Survey on Multimodal Retrieval‑Augmented Generation. Findings of ACL 2025. ACL Anthology.
  • Yu, S. et al. (2024). VisRAG: Vision‑based Retrieval‑augmented Generation on Multi‑modality Documents. arXiv:2410.10594.
  • Cho, J. et al. (2024). M3DocRAG: Multi‑modal Retrieval is What You Need for Multi‑document QA. arXiv:2411.04952.
  • Tanaka, R. et al. (2025). VDocRAG: Retrieval‑Augmented Generation over Visually‑Rich Documents. CVPR 2025. arXiv:2504.09795 • CVF Open Access.
  • Dong, K. et al. (2025). MMDocRAG: Benchmarking Retrieval‑Augmented Multimodal Generation for Document Question Answering. arXiv:2505.16470.
  • Wasserman, N. et al. (2025). REAL‑MM‑RAG: A Real‑World Multi‑Modal Retrieval Benchmark. arXiv:2502.12342.
  • Faysse, M. et al. (2024). ColPali: Efficient Document Retrieval with Vision Language Models. arXiv:2407.01449.
  • Radford, A. et al. (2021). Learning Transferable Visual Models From Natural Language Supervision (CLIP). ICML 2021. arXiv:2103.00020.
  • Tschannen, M. et al. (2025). SigLIP 2: Multilingual Vision‑Language Encoders with Improved Semantic Understanding, Localization, and Dense Features. arXiv:2502.14786.
  • Xu, Y. et al. (2020). LayoutLM: Pre‑training of Text and Layout for Document Image Understanding. KDD 2020. DOI • arXiv:1912.13318.
  • Huang, Y. et al. (2022). LayoutLMv3: Pre‑training for Document AI with Unified Text and Image Masking. arXiv:2204.08387.
  • Zhong, X., Tang, J., Jimeno‑Yepes, A.J. (2019). PubLayNet: Largest Dataset Ever for Document Layout Analysis. arXiv:1908.07836.
  • Pfitzmann, B. et al. (2022). DocLayNet: A Large Human‑Annotated Dataset for Document‑Layout Analysis. arXiv:2206.01062.
  • Kim, G. et al. (2021). OCR‑free Document Understanding Transformer (Donut). arXiv:2111.15664.
  • Shen, Z. et al. (2021). LayoutParser: A Unified Toolkit for Deep Learning Based Document Image Analysis. arXiv:2103.15348.
  • Singh, A. et al. (2019). Towards VQA Models That Can Read (TextVQA). CVPR 2019. arXiv:1904.08920.
  • Mathew, M. et al. (2021/2022). DocVQA / InfographicVQA: Datasets for VQA on Document Images and Infographics. WACV 2021 / WACV 2022. CVF • arXiv:2104.12756.
  • Masry, A. et al. (2022). ChartQA: A Benchmark for Question Answering about Charts with Visual and Logical Reasoning. Findings of ACL 2022. ACL • arXiv:2203.10244.
  • Liu, F. et al. (2022). DePlot: One‑shot Visual Language Reasoning by Plot‑to‑Table Translation. arXiv:2212.10505.
  • Wang, P. et al. (2024). Qwen2‑VL: Enhancing Vision‑Language Model's Capabilities in OCR and Chart QA. arXiv:2409.12191.
  • Es, S. et al. (2023). RAGAS: Automated Evaluation of Retrieval‑Augmented Generation. arXiv:2309.15217.

ראו גם

  • Retrieval-Augmented Generation
  • מסד נתונים וקטורי
  • Embedding
  • GraphRAG

הערות

  1. Lewis, P., Perez, E., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS. arXiv:2005.11401.
  2. 2.0 2.1 Yu, S. et al. (2024). VisRAG: Vision-based Retrieval-Augmented Generation on Multi-modality Documents. arXiv:2407.06437.
  3. 3.0 3.1 Mathew, M. et al. (2021). DocVQA: A Dataset for VQA on Document Images. WACV. arXiv:2007.00398.
  4. 4.0 4.1 Singh, A. et al. (2019). TextVQA: Towards VQA Models That Can Read. CVPR. arXiv:1904.08920.
  5. Xu, Y. et al. (2020). LayoutLM: Pre-training of Text and Layout for Document Image Understanding. KDD. DOI.
  6. 6.0 6.1 Radford, A. et al. (2021). Learning Transferable Visual Models From Natural Language Supervision (CLIP). ICML. arXiv:2103.00020.
  7. 7.0 7.1 Zhong, X., Tang, J., Yepes, A. J. (2019). PubLayNet: Largest Dataset for Document Layout Analysis. ICDAR. arXiv:1908.07836.
  8. 8.0 8.1 Pfitzmann, B. et al. (2022). DocLayNet: A Large Human‑Annotated Dataset for Document‑Layout Analysis. KDD. DOI / arXiv:2206.01062.
  9. Shen, Z. et al. (2021). LayoutParser: A Unified Toolkit for DL‑based Document Image Analysis. arXiv:2103.15348.
  10. Kim, G. et al. (2021). Donut: OCR‑free Document Understanding Transformer. arXiv:2111.15664.
  11. Zhai, X. et al. (2023). Sigmoid Loss for Language‑Image Pre‑Training (SigLIP). ICCV. arXiv:2303.15343.
  12. Milvus Docs. Multi‑Vector Hybrid Search. milvus.io/docs/multi-vector-search.md.
  13. 13.0 13.1 Cohere Docs. Rerank API. docs.cohere.com/reference/rerank.
  14. OpenAI. GPT‑4V(ision) System Card. (2023). PDF.
  15. OpenAI. Hello GPT‑4o. (2024). openai.com/index/hello-gpt-4o/.
  16. Es, S. et al. (2023). RAGAS: Automated Evaluation of Retrieval Augmented Generation. arXiv:2309.15217.
  17. Mathew, M. et al. (2021). InfographicVQA: Understanding Infographics via Question Answering. ICDAR. arXiv:2104.12756.
  18. Masry, A. et al. (2022). ChartQA: A Benchmark for Question Answering about Charts. ACL (Findings). arXiv:2103.16435.
  19. Dong, K. et al. (2025). Benchmarking Retrieval‑Augmented Multimodal Generation for Document QA (MMDocRAG). arXiv:2505.16470.
  20. Weaviate Docs. Hybrid search. docs.weaviate.io/.../hybrid-search.
  21. Faysse, M. et al. (2024). ColPali: Efficient Document Retrieval with Vision‑Language Models. arXiv:2407.01449.