논문 해설
Multimodal Pre-training Based on Graph Attention Network for Document Understanding
문서 이해를 위한 그래프 어텐션 네트워크 기반 멀티모달 pre-training
- 연구 문제 텍스트, 레이아웃, 이미지를 함께 다루는 문서 이해에서 기존 단어 단위 pre-training은 한계가 있어, GraphDoc은 의미 영역 단위 입력과 그래프 구조 어텐션으로 이 문제를 다룹니다.
- 연구 방법 GraphDoc은 OCR 영역의 텍스트 임베딩과 시각 임베딩을 게이트 융합 층으로 결합하고, 이웃 노드와 전역 노드에만 어텐션하는 그래프 어텐션 층을 쌓아 Masked Sentence Modeling으로 사전학습합니다.
- 주요 결과 FUNSD 절제 실험에서 pre-training과 그래프 어텐션 층을 포함한 T6는 F1 87.77을 기록했고, SROIE·CORD·RVL-CDIP에서도 보고된 비교 결과에서 강한 성능을 보였습니다.
문서 이해의 어려움과 기존 pre-training의 한계
문서는 텍스트, 시각 내용, 레이아웃이 함께 의미를 만들기 때문에 기계가 이해하기 어렵습니다. 기존 많은 BERT 계열 문서 pre-training 모델은 개별 단어를 입력 단위로 사용하며, 텍스트 중심 처리나 긴 입력 제약이라는 문제를 안고 있습니다. 이 논문은 단어 대신 텍스트 블록, 표, 제목 같은 의미 영역을 기본 입력으로 삼고, 레이블이 없는 문서 이미지에서 일반 표현을 배우는 방향을 다룹니다.

Fig. 1 . The example images of documents with different formats and layouts. The layout and visual content of different documents are markedly inconsistent.
원문 · CC BY 4.0 · Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang · Multimodal Pre-training Based on Graph Attention Network for Document Understanding · 원문 그림 인용 · 원본 PDF 2쪽에서 그림 영역을 추출했습니다.또한 Transformer의 자기 어텐션은 모든 입력 요소가 서로를 참조하므로 계산량이 입력 개수 n에 대해 O(n²)로 커집니다. 저자들은 문서에서 한 영역이 주변 문맥에 더 크게 의존한다는 점을 강한 귀납 편향으로 보고, 이 구조를 어텐션에 직접 넣는 방법을 제안합니다.
GraphDoc의 입력과 전체 구성
GraphDoc은 문서 이미지에 OCR을 적용해 얻은 n개의 의미 영역을 입력으로 받습니다. 각 영역은 bounding box, 텍스트 문장, 이미지 특징을 함께 가지며, 텍스트 인코더와 시각 인코더가 각각 문장 임베딩과 시각 임베딩을 만듭니다. 이후 게이트 융합 층과 그래프 어텐션 층을 N개 블록으로 쌓아 모든 영역의 다중모달 문맥 표현을 생성합니다.

Fig. 2 . An illustration of the multimodal framework of GraphDoc. Given a document image with OCR results, we first extract the corresponding textual and visual embedding for each text region using the textual encoder and the visual encoder, respectively. Then, we apply the well-designed graph attention layer to encode the multimodal representations for each region. The model is pre-trained via the Masked Sentence Modeling (MSM) task.
원문 · CC BY 4.0 · Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang · Multimodal Pre-training Based on Graph Attention Network for Document Understanding · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.pre-training은 Masked Sentence Modeling으로 수행합니다. 텍스트 인코더에서 Sentence-BERT는 pre-training 상태로 쓰이며 pre-training 중에는 파라미터가 갱신되지 않습니다. 시각 백본은 PubLayNet으로 먼저 사전학습된 Swin Transformer와 FPN을 사용하며, 논문은 이 백본을 GraphDoc과 함께 end-to-end로 공동 학습한다고 설명합니다.
텍스트 인코더와 2D 레이아웃 임베딩
텍스트 인코더는 좌표를 [0, 512] 범위의 정수로 정규화하고, x축과 y축 특징을 각각 임베딩 층으로 처리합니다. 각 영역의 2D 레이아웃 임베딩 l_i는 네 꼭짓점 좌표 중 일부와 너비·높이를 연결해 만듭니다. 문장 임베딩은 s_i = Proj(SentenceEmb(t_i)) + l_i로 구성되며, 여기서 SentenceEmb는 Sentence-BERT, Proj는 선형 투영입니다.
시각 인코더는 문서 이미지를 512×512로 리사이즈한 뒤 FPN의 P2 특징 맵에서 RoIAlign으로 영역 특징을 뽑습니다. 이 영역 특징을 선형 투영하고 같은 레이아웃 임베딩을 더해 v_i를 구성합니다. 따라서 텍스트와 시각 경로는 같은 위치 정보를 공유하며, 레이아웃 임베딩은 두 모달리티를 영역 단위로 묶는 역할을 합니다.
게이트 융합 층
게이트 융합 층은 각 영역의 시각 임베딩 v_i와 이전 층의 은닉 표현 h_i^(l-1)을 연결한 뒤, 시그모이드 게이트 z_i^l로 두 정보의 비중을 정합니다. 출력 m_i^l은 (1−z_i^l)h_i^(l-1) + z_i^l v_i로 계산되며, 그래프 어텐션 층이 이 결과를 입력으로 받습니다. 이 구조는 시각 정보를 각 층에 다시 접근 가능하게 만들어 잔차 연결과 비슷한 역할을 합니다.
저자들은 시각 의존성이 그래프 어텐션 층마다 다를 수 있다고 보고 이 설계를 택했습니다. 이는 저자들의 설계 동기이며, 이 논문에서는 잔차 연결 수를 바꾼 실험으로 그 효과를 확인합니다.
그래프 어텐션 층과 마스크드 어텐션
그래프 어텐션 층은 각 입력 노드가 자신의 이웃 집합 N(i)과 전역 노드에만 어텐션을 수행하도록 바꾼 층입니다. 어텐션 점수는 e_ij = (W_q m_i)^T (W_k m_j)에 2D 상대 위치 편향을 더해 계산합니다. 상대 위치는 네 방향의 좌표 차이로 나타내고, 학습 가능한 행렬 W_tl, W_tr, W_br, W_bl을 거쳐 어텐션 점수에 더합니다.

Fig. 5 . An illustration of the graph attention layer. The {n1− n7} represent different input nodes of the layer. G is the global node, which assists each node to capture the global information of the document. Graph attention mechanism employed on {n1, n4, n7} is visualized. {n1, n4, n7} only attend to their neighborhood nodes and a global node G.
원문 · CC BY 4.0 · Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang · Multimodal Pre-training Based on Graph Attention Network for Document Understanding · 원문 그림 인용 · 원본 PDF 5쪽에서 그림 영역을 추출했습니다.이웃 집합은 유클리드 거리 기준으로 자기 자신을 포함한 상위 k개 노드입니다. 이 집합 밖의 노드 쌍에는 어텐션 점수를 계산하지 않으며, 이를 masked attention이라고 부릅니다. 이웃 노드와 전역 노드의 가중합을 출력하고 잔차·층 정규화·FFN을 거쳐 h_i^l을 얻습니다. 따라서 그래프 어텐션은 전체 노드 간 어텐션을 제한하여 문서의 지역 문맥을 우선 반영하는 방식입니다.

Fig. 8 . Attention visualization results on the FUNSD dataset. The A/B series refers to the visualization of GAT/Transformer, respectively. The gradation of color of each text node indicates varied attention weight from the chosen text node (emphasized with a red bounding box). The global node is attached to the left side of each document image. Maps from the ground-truth label to the system predicted label are annotated near the target area. The green text indicates correct predictions, while red indicates incorrect predictions.
원문 · CC BY 4.0 · Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang · Multimodal Pre-training Based on Graph Attention Network for Document Understanding · 원문 그림 인용 · 원본 PDF 10쪽에서 그림 영역을 추출했습니다.Masked Sentence Modeling pre-training
pre-training 과제는 Masked Sentence Modeling입니다. 각 문장은 독립적으로 무작위 마스킹되며, 해당 문장의 레이아웃 정보는 보존됩니다. 마스킹된 문장은 특수 기호 [MASK]로 대체되고, 모델은 마스킹되지 않은 문장 임베딩 S와 시각 임베딩 V를 이용해 마스킹된 문장 임베딩을 예측합니다.
손실은 예측값과 실제 문장 임베딩의 차이에 smooth L1을 적용해 계산합니다. 구현 설명에서 마스킹 비율은 BERT 설정을 따라 입력 문장의 15%이며, 그중 80%는 [MASK], 10%는 다른 문서의 무작위 문장, 10%는 원래 문장을 유지합니다. pre-training 코퍼스는 RVL-CDIP 학습 세트의 32만 장 문서 이미지입니다.
FUNSD 절제 실험과 구성요소의 기여
FUNSD의 엔티티 레이블링 F1으로 구성요소를 하나씩 바꾼 T1부터 T6까지를 비교합니다. 완전한 시스템 T6은 F1 87.77을 기록합니다. pre-training을 제거한 T5는 80.66으로 낮아지며, 이는 이 설정에서 pre-training이 성능에 기여함을 보여 줍니다. 시각 인코더를 제거한 T1은 86.36, 시각 백본을 고정한 T2는 86.13으로 나타났습니다.
그래프 어텐션 층을 원래 Transformer로 바꾼 T3는 85.33, 그래프 어텐션을 사용한 T4는 86.56입니다. 상대 위치 인코딩 제거 설정인 T4와 T6의 비교에서 T6가 더 높습니다. 게이트 융합을 덧셈 또는 연결로 바꾼 실험에서는 각각 86.23, 83.79였으며 게이트 융합이 87.77로 가장 높았습니다. 이 절제 결과는 FUNSD와 이 논문의 설정에 한정됩니다.
top-k와 잔차 연결 수 변화
top-k 실험은 시스템 T6에서 k를 16, 24, 36, 48, 60, 256으로 바꾸어 FUNSD에서 평가합니다. k=36일 때 F1은 87.77로 가장 높고, k=16에서는 85.68로 낮습니다. 저자들은 k가 너무 작으면 각 노드의 수용 영역이 제한되어 성능이 떨어진다고 해석합니다. k=256은 전역 연결에 가까운 설정으로 86.87을 기록했습니다.
잔차 연결 실험은 시각 정보를 전달하는 GAT 층 수를 1, 3, 6, 9, 12로 바꾸며, 12개 설정에서 87.77로 가장 높습니다. 이 결과는 잔차 연결을 더 많은 층에 두는 설정이 FUNSD에서 유리했다는 것을 보여 주지만, 다른 데이터셋의 최적 설정으로 일반화하지는 않습니다.
주요 데이터셋의 비교 결과
FUNSD, SROIE, CORD, RVL-CDIP 네 데이터셋에서 GraphDoc을 평가합니다. FUNSD 양식 이해 과제에서는 엔티티 단위 F1을 사용하며, 같은 Text+Layout+Image 계열 비교에서 GraphDoc이 우수하다고 보고합니다. 영수증 이해 과제에서 GraphDoc은 SROIE F1 98.45, CORD F1 96.93을 보고합니다. 문서 분류 과제에서는 RVL-CDIP 정확도 96.02를 기록합니다.

Fig. 9 . Visualization results on downstream tasks. Samples 1-2/3-4/5-6 are from the FUNSD/CORD/SROIE dataset, and the A/B series refers to the visualization of GraphDoc/LayoutLMv2 systems, respectively. The green shaded area in each image represents the correct classification results, while the red parts are predicted wrongly. Maps from the ground-truth label to the system predicted label are annotated near the wrongly classified area. Best viewed in color.
원문 · CC BY 4.0 · Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang · Multimodal Pre-training Based on Graph Attention Network for Document Understanding · 원문 그림 인용 · 원본 PDF 11쪽에서 그림 영역을 추출했습니다.표 V의 비교 값은 저자들이 사용한 각 선행 연구의 보고 값과 자체 측정이 섞여 있습니다. LayoutLMv2의 pre-training 시간이 500시간이고 GraphDoc은 10시간이라는 비용 비교도 있으며, 이는 서로 다른 하드웨어와 설정에서 얻은 원문 보고값입니다. 또한 GraphDoc-ResNet-50은 공정 비교를 위한 별도 백본 설정입니다.
실패 사례와 적용 범위
저자들은 FUNSD의 대표 실패 사례를 세 유형으로 분석합니다. 첫째는 같은 의미 역할을 하는 제목이 서로 다르게 레이블된 구조 중첩 문제이고, 둘째는 표 형태 문서에서 첫 행과 첫 열 중 어느 쪽이 핵심 영역인지 구분하기 어려운 문제입니다. 셋째는 정답 레이블 자체가 잘못된 경우입니다. 이 분석은 정성적 사례 분석이며 전체 오류율을 측정한 것은 아닙니다.

Fig. 10 . Some representative failure cases of GraphDoc model on the FUNSD dataset. The gradation of color of each text node indicates varied attention weight from the chosen text node (emphasized with a red bounding box). Maps from the ground-truth label to the system predicted label are annotated near the wrongly classified area. Best viewed in color.
원문 · CC BY 4.0 · Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang · Multimodal Pre-training Based on Graph Attention Network for Document Understanding · 원문 그림 인용 · 원본 PDF 12쪽에서 그림 영역을 추출했습니다.또한 본 결과는 OCR 영역 검출과 공개 데이터셋의 레이블 품질에 의존합니다. 논문은 레이블 모호성과 표 구조 처리의 어려움을 남은 과제로 제시합니다.
논문 정보
- 저자
- Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang
- 학회·저널
- arXiv · 프리프린트
- 최초 공개일
- 2022년 3월 25일
- 등록일
- 2026년 11월 6일
- 수정일
- 2022년 10월 23일
- 버전
- v2
- arXiv
- 2203.13530
- 분류
- cs.CV
- 원문 이용 조건
- CC BY 4.0
- 제공 범위
- 논문 정보, 해설, 허용된 원문 그림
AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.
초록
Document intelligence as a relatively new research topic supports many business applications. Its main task is to automatically read, understand, and analyze documents. However, due to the diversity of formats (invoices, reports, forms, etc.) and layouts in documents, it is difficult to make machines understand documents. In this paper, we present the GraphDoc, a multimodal graph attention-based model for various document understanding tasks. GraphDoc is pre-trained in a multimodal framework by utilizing text, layout, and image information simultaneously. In a document, a text block relies heavily on its surrounding contexts, accordingly we inject the graph structure into the attention mechanism to form a graph attention layer so that each input node can only attend to its neighborhoods. The input nodes of each graph attention layer are composed of textual, visual, and positional features from semantically meaningful regions in a document image. We do the multimodal feature fusion of each node by the gate fusion layer. The contextualization between each node is modeled by the graph attention layer. GraphDoc learns a generic representation from only 320k unlabeled documents via the Masked Sentence Modeling task. Extensive experimental results on the publicly available datasets show that GraphDoc achieves state-of-the-art performance, which demonstrates the effectiveness of our proposed method. The code is available at https://github.com/ZZR8066/GraphDoc.
원문 인용
Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, Jianshu Zhang (2022). Multimodal Pre-training Based on Graph Attention Network for Document Understanding. arXiv:2203.13530v2. https://arxiv.org/abs/2203.13530v2
BibTeX
@misc{zhang2022multimodal,
title = {{Multimodal Pre-training Based on Graph Attention Network for Document Understanding}},
author = {Zhenrong Zhang and Jiefeng Ma and Jun Du and Licheng Wang and Jianshu Zhang},
year = {2022},
eprint = {2203.13530},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2203.13530v2}
}