# A Unified Understanding of Deep NLP Models for Text Classification

텍스트 분류를 위한 딥 NLP 모델의 통합적 이해

Zhen Li, Xiting Wang, Weikai Yang, Jing Wu, Zhengyan Zhang, Zhiyuan Liu 외 3명 · arXiv · 2022년 6월 19일

- **연구 문제** 서로 다른 딥 NLP 분류 모델을 하나의 기준으로 이해하기 어려워, 상호정보량 기반 측정과 다중 수준 시각화를 결합한 DeepNLPVis를 제안합니다.
- **연구 방법** 각 계층의 단어 표현과 최종 예측 사이의 상호정보량을 섭동 기반 근사로 계산하고, 선택한 두 클래스의 정규화 점수로 반복 분석합니다.
- **주요 결과** SST-2 감성 분류에서 BERT 어댑터 추가 후 테스트 정확도가 93.23%에서 93.92%로 올라갔고, ELMo+LSTM은 지식 증류 후 88.53%에서 89.33%로 올라갔습니다.

## 연구 문제와 배경

텍스트 분류에 쓰이는 딥 NLP 모델은 CNN, LSTM, Transformer 계열로 빠르게 발전해 왔지만, 모델이 복잡해질수록 개발자가 학습을 이해하고 문제를 디버깅하기 어려워집니다. 기존 시각화 도구는 RNN이나 어텐션처럼 특정 모델 구조에 맞춰져 있어, 모델 선택을 제한하지 않으면서 서로 다른 모델을 하나의 기준으로 이해하는 방법이 부족합니다. 이 논문은 이 공백을 다루기 위해 상호정보량 기반 측정과 다중 수준 시각화를 결합한 DeepNLPVis를 제안합니다. 저자들은 모델 개발자 설문과 다섯 명의 전문가 인터뷰로 요구사항을 정리했습니다.

## 상호정보량 기반 해석과 정규화 클래스 간 분석

제안 방법은 각 계층의 단어 표현 h(l)(wi)가 최종 예측 s에 얼마나 많은 정보를 전달하는지를 상호정보량 MI(h(l)(wi);s)로 측정합니다. 이 값은 표현에 가우시안 잡음을 더했을 때 예측 점수가 바뀌는 크기로 근사하며, 변화의 절댓값은 단어 기여도를, 부호는 극성을 나타냅니다. 사용자는 혼동 행렬에서 두 클래스 Cp와 Cq를 고르고, 나머지 클래스의 영향을 제거하기 위해 s = sp/(sp + sq)로 정규화합니다. 여기서 분모는 선택한 두 클래스의 원래 예측 점수 합입니다. 이 정규화된 점수를 기준으로 두 클래스 사이의 분석을 반복합니다. 구 단위 정보는 문맥 벡터 c(l)ij = MI(wj, h(l)(wi))를 계산한 뒤 agglomerative clustering으로 인접 문맥 벡터를 묶어 추출하며, 비인접 단어 관계는 계층 l과 l+1 사이의 상호정보량으로 정량화합니다.

![Figure 3: The analysis of multi-class classiﬁcation is achieved by an iterative between-class analysis](https://refivu.com/papers/b997b876-1da5-412e-b061-305960e3137e/figures/figure-59d96ad2e8f0ee8fa88554e7e2f97287.png?thumb=512)

**Fig. 3** : The analysis of multi-class classiﬁcation is achieved by an iterative between-class analysis.

[원문](https://arxiv.org/abs/2206.09355v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Zhen Li, Xiting Wang, Weikai Yang, Jing Wu, Zhengyan Zhang, Zhiyuan Liu, Maosong Sun, Hui Zhang, Shixia Liu · A Unified Understanding of Deep NLP Models for Text Classification · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

## 다중 수준 시각화 설계

시각화는 코퍼스 수준, 샘플 수준, 단어 수준의 세 단계로 구성됩니다. 코퍼스 수준에서는 혼동 행렬 기반의 클래스 뷰와, 예측 점수 축과 one-dimensional t-SNE 투영을 결합한 분포 뷰를 제공합니다. 샘플 수준에서는 샘플 목록과 계층별 정보 흐름을 보여 주며, 정보 흐름은 단어 선의 굵기와 색으로 기여도와 극성을 표시하고, 곡선으로 비인접 단어 관계를 표시합니다. 단어 수준에서는 계층별 기여도 백분위를 보여 주는 단어 기여도 뷰와, 같은 단어의 문맥 군집을 보여 주는 단어 문맥 뷰를 제공합니다. 정보 흐름의 배치는 안정성과 가독성을 함께 고려한 제약 최적화 문제로 정식화되며, 원문은 α = 0.4, β = 5를 구현 값으로 보고합니다.

![Figure 2: The analysis workﬂow supported by three coordinated visualizations at different levels](https://refivu.com/papers/b997b876-1da5-412e-b061-305960e3137e/figures/figure-7e15e5d4996973dfb69107fcfe128925.png?thumb=512)

**Fig. 2** : The analysis workﬂow supported by three coordinated visualizations at different levels.

[원문](https://arxiv.org/abs/2206.09355v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Zhen Li, Xiting Wang, Weikai Yang, Jing Wu, Zhengyan Zhang, Zhiyuan Liu, Maosong Sun, Hui Zhang, Shixia Liu · A Unified Understanding of Deep NLP Models for Text Classification · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

## 감성 분류 사례 연구

첫 번째 사례는 SST-2 감성 분류에서 BERT를 분석하는 것입니다. 원문은 GLUE SST-2 분할에서 학습 67,349개, 검증 872개, 테스트 1,821개 샘플을 사용했고, BERT의 테스트 정확도는 93.23%입니다. 분포 뷰와 단어 기여도 뷰를 통해 깊은 계층일수록 감성 단어가 기여도가 커진다는 관찰을 얻었고, 'care'는 문맥에 따라 부정 문맥에 더 많이 쓰인다는 해석을 제시합니다. 오분류 분석에서는 'superficial'의 상충 레이블과 'dvd'의 단축 상관을 발견해 데이터를 수정했습니다. 이후 BERT의 마지막 4개 계층에 어댑터 모듈을 삽입하고 원래 파라미터를 고정하여 어댑터만 학습했으며, 테스트 정확도는 93.23%에서 93.92%로 올라갔습니다.

이 결과는 이 사례의 BERT와 SST-2 설정에서 얻은 것입니다.

![Figure 6: The analysis of the BERT model on sentiment classiﬁcation](https://refivu.com/papers/b997b876-1da5-412e-b061-305960e3137e/figures/figure-f73017375eabbb45d00b5beb10d9cc02.png?thumb=512)

**Fig. 6** : The analysis of the BERT model on sentiment classiﬁcation.

[원문](https://arxiv.org/abs/2206.09355v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Zhen Li, Xiting Wang, Weikai Yang, Jing Wu, Zhengyan Zhang, Zhiyuan Liu, Maosong Sun, Hui Zhang, Shixia Liu · A Unified Understanding of Deep NLP Models for Text Classification · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

## 모델 비교와 지식 증류

두 번째 비교에서는 같은 SST-2 데이터셋에서 12계층 BERT와 ELMo를 입력으로 쓰는 4계층 Bi-LSTM을 비교했습니다. ELMo+LSTM은 학습 정확도 98.28%, 테스트 정확도 88.53%를 보였고, 분포 뷰에서 더 많은 오분류 샘플과 희귀 감성 단어가 나타났습니다. 'deceptively'는 양의 샘플이 많은 단축 상관으로 해석되었고, 정보 흐름에서는 ELMo+LSTM의 정보 전달이 더 국소적이었습니다. 이후 BERT를 교사로, ELMo+LSTM을 학생으로 하여 출력 간 KL 발산을 줄이는 지식 증류를 적용했으며, 테스트 정확도는 88.53%에서 89.33%로 증가했습니다.

## 다중 클래스 뉴스 분류 사례

세 번째 사례는 AG News 부분 집합으로 네 개 클래스를 분류하는 BERT 모델입니다. 원문은 각 클래스에 학습 샘플 30,000개와 테스트 샘플 1,900개를 두었고 테스트 정확도는 94.79%라고 보고합니다. 혼동 행렬에서 business와 sci/tech의 혼동이 가장 커서 두 클래스를 선택했고, 기술 관련 단어가 많은 business 샘플이 sci/tech 쪽에 가까운 것으로 나타났습니다. 'google'은 여러 계층에서 중요하게 작동했으며, 한 샘플에서 sci/tech 경향이 계층을 거쳐 \[CLS\]로 전달되어 오분류에 기여했습니다.

![Figure 10: DeepNLPVis for analyzing the BERT model on news classiﬁcation: (a) class view for showing the overall model performance; (b) distribution view for i…](https://refivu.com/papers/b997b876-1da5-412e-b061-305960e3137e/figures/figure-253dfd6b8ccb28b647676b71a8af56ff.png?thumb=512)

**Fig. 10** : DeepNLPVis for analyzing the BERT model on news classiﬁcation: (a) class view for showing the overall model performance; (b) distribution view for identifying samples and words of interest; (c) word contribution of selected samples; (d) sample list; (e) information ﬂow for analyzing a sample by its intra- and inter-word information.

[원문](https://arxiv.org/abs/2206.09355v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Zhen Li, Xiting Wang, Weikai Yang, Jing Wu, Zhengyan Zhang, Zhiyuan Liu, Maosong Sun, Hui Zhang, Shixia Liu · A Unified Understanding of Deep NLP Models for Text Classification · 원문 그림 인용 · 원본 PDF 11쪽에서 그림 영역을 추출했습니다.

## 적용 범위와 한계

원문은 프로토타입이 문장 쌍 입력을 지원하지만 문장 내부와 문장 간 관계를 구별하지 못한다고 밝힙니다. 또한 GPT-3처럼 계층 수와 샘플 길이가 큰 모델에서는 정보 흐름이 복잡해져 확장성 문제가 생길 수 있으며, 원문은 대표 샘플과 대표 단어를 고르는 방향을 향후 과제로 제시합니다. 이 연구의 실험은 텍스트 분류 중심이므로 요약이나 번역 같은 다른 과제에 대한 결론은 원문에서 검증되지 않았습니다.

## 논문 정보

- **저자**: Zhen Li, Xiting Wang, Weikai Yang, Jing Wu, Zhengyan Zhang, Zhiyuan Liu, Maosong Sun, Hui Zhang, Shixia Liu
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2022년 6월 19일
- **등록일**: 2026년 11월 6일
- **수정일**: 2022년 6월 19일
- **버전**: v1
- **arXiv**: 2206.09355
- **분류**: cs.CL · cs.LG
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2206.09355v1) · [원문 PDF ↗](https://arxiv.org/pdf/2206.09355v1)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

The rapid development of deep natural language processing (NLP) models for text classification has led to an urgent need for a unified understanding of these models proposed individually. Existing methods cannot meet the need for understanding different models in one framework due to the lack of a unified measure for explaining both low-level (e.g., words) and high-level (e.g., phrases) features. We have developed a visual analysis tool, DeepNLPVis, to enable a unified understanding of NLP models for text classification. The key idea is a mutual information-based measure, which provides quantitative explanations on how each layer of a model maintains the information of input words in a sample. We model the intra- and inter-word information at each layer measuring the importance of a word to the final prediction as well as the relationships between words, such as the formation of phrases. A multi-level visualization, which consists of a corpus-level, a sample-level, and a word-level visualization, supports the analysis from the overall training set to individual samples. Two case studies on classification tasks and comparison between models demonstrate that DeepNLPVis can help users effectively identify potential problems caused by samples and model architectures and then make informed improvements.

## 원문 인용

Zhen Li, Xiting Wang, Weikai Yang, Jing Wu, Zhengyan Zhang, Zhiyuan Liu, Maosong Sun, Hui Zhang, Shixia Liu (2022). A Unified Understanding of Deep NLP Models for Text Classification. arXiv:2206.09355v1. https://arxiv.org/abs/2206.09355v1

**BibTeX**

```
@misc{li2022unified,
  title = {{A Unified Understanding of Deep NLP Models for Text Classification}},
  author = {Zhen Li and Xiting Wang and Weikai Yang and Jing Wu and Zhengyan Zhang and Zhiyuan Liu and Maosong Sun and Hui Zhang and Shixia Liu},
  year = {2022},
  eprint = {2206.09355},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.09355v1}
}
```

## 이 논문의 용어

- [BERT](https://refivu.com/terms/45b639a1d317-bert)
- [KL divergence](https://refivu.com/terms/5f1dbea73907-kl-divergence)
- [Knowledge Distillation](https://refivu.com/terms/b8544f4ba83e-knowledge-distillation)
- [confusion matrix](https://refivu.com/terms/101b07f65787-confusion-matrix)
- [SST-2](https://refivu.com/terms/8904146eae2e-sst-2)
- [context vector](https://refivu.com/terms/48425b908472-context-vector)
- [AG News](https://refivu.com/terms/d980d6e0e126-ag-news)
- [agglomerative clustering](https://refivu.com/terms/ecf684417449-agglomerative-clustering)
- [adapter module](https://refivu.com/terms/a3f035534403-adapter-module)

## 다른 논문 해설

- [Universal Language Model Fine-tuning for Text Classification](https://refivu.com/papers/f2470a4a-1c9b-423c-8757-ba73cfe37b54-universal-language-model-fine-tuning-for-text-classification.md)
- [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://refivu.com/papers/13b055d5-7dcd-422f-b6d8-3704e3d48533-bart-denoising-sequence-to-sequence-pre-training-for.md)
- [Comparison of Machine Learning for Sentiment Analysis in Detecting Anxiety Based on Social Media Data](https://refivu.com/papers/8412f077-3170-4e67-bb2c-f3ad167c019c-comparison-of-machine-learning-for-sentiment-analysis-in.md)
- [PADA: Example-based Prompt Learning for on-the-fly Adaptation to Unseen Domains](https://refivu.com/papers/1c1edf58-9646-4fc9-9631-5ddd3c11e749-pada-example-based-prompt-learning-for-on-the.md)
- [A Review of the Trends and Challenges in Adopting Natural Language Processing Methods for Education Feedback Analysis](https://refivu.com/papers/3d712d32-d3ac-415c-b662-8b657081f4c6-a-review-of-the-trends-and-challenges-in.md)
- [Training Tips for the Transformer Model](https://refivu.com/papers/f2437599-de07-4bc9-b659-4823dff3be26-training-tips-for-the-transformer-model.md)
- [High-Dimensional Continuous Control Using Generalized Advantage Estimation](https://refivu.com/papers/95183c94-f386-4a6d-8fda-f7e55021273b-high-dimensional-continuous-control-using-generalized.md)
- [CURE: Simulation-Augmented Auto-Tuning in Robotics](https://refivu.com/papers/66d674da-e1cc-4ccd-a428-aafdbc8c8d97-cure-simulation-augmented-auto-tuning-in-robotics.md)
- [Generative Modeling by Estimating Gradients of the Data Distribution](https://refivu.com/papers/f3ef856d-6161-4eaa-b2c9-6a0c3f1ff432-generative-modeling-by-estimating-gradients-of-the-data.md)
- [An Overview of Machine Learning Techniques for Radiowave Propagation Modeling](https://refivu.com/papers/72927336-9eac-4004-8a72-f9a7a8d324b6-an-overview-of-machine-learning-techniques-for-radiowave.md)
- [Hyperspectral Image Super-Resolution via Dual-domain Network Based on Hybrid Convolution](https://refivu.com/papers/e8766082-2cfe-4ddb-ae9a-1e9132d32b73-hyperspectral-image-super-resolution-via-dual-domain-network.md)
- [Glow: Generative Flow with Invertible 1x1 Convolutions](https://refivu.com/papers/fb9c5b80-a221-4385-8910-2ae4413b604b-glow-generative-flow-with-invertible-1x1-convolutions.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/b997b876-1da5-412e-b061-305960e3137e-a-unified-understanding-of-deep-nlp-models-for)
