Skip to main content
QUICK REVIEW

[논문 리뷰] Transformer-Patcher: One Mistake worth One Neuron

Zeyu Huang, Yikang Shen|arXiv (Cornell University)|2023. 01. 24.
Software Engineering ResearchComputer Science인용 수 10
한 줄 요약

Transformer-Patcher를 도입하여 마지막 FFN 층에 소수의 뉴런을 추가하고 학습시킴으로써 순차적으로 트랜스포머 모델을 수정하고, 고신뢰도와 국소성을 바탕으로 오류를 지속적으로 수정할 수 있게 한다.

ABSTRACT

Large Transformer-based Pretrained Language Models (PLMs) dominate almost all Natural Language Processing (NLP) tasks. Nevertheless, they still make mistakes from time to time. For a model deployed in an industrial environment, fixing these mistakes quickly and robustly is vital to improve user experiences. Previous works formalize such problems as Model Editing (ME) and mostly focus on fixing one mistake. However, the one-mistake-fixing scenario is not an accurate abstraction of the real-world challenge. In the deployment of AI services, there are ever-emerging mistakes, and the same mistake may recur if not corrected in time. Thus a preferable solution is to rectify the mistakes as soon as they appear nonstop. Therefore, we extend the existing ME into Sequential Model Editing (SME) to help develop more practical editing methods. Our study shows that most current ME methods could yield unsatisfying results in this scenario. We then introduce Transformer-Patcher, a novel model editor that can shift the behavior of transformer-based models by simply adding and training a few neurons in the last Feed-Forward Network layer. Experimental results on both classification and generation tasks show that Transformer-Patcher can successively correct up to thousands of errors (Reliability) and generalize to their equivalent inputs (Generality) while retaining the model's accuracy on irrelevant inputs (Locality). Our method outperforms previous fine-tuning and HyperNetwork-based methods and achieves state-of-the-art performance for Sequential Model Editing (SME). The code is available at https://github.com/ZeroYuHuang/Transformer-Patcher.

연구 동기 및 목표

  • 배포된 트랜스포머에서 모델의 실수를 연속적이고 온라인으로 수정해야 하는 필요성을 동기 부여한다(순차적 모델 편집).
  • 신뢰성, 일반화, 국소성을 평가하는 지표를 갖춘 표준 SME 파이프라인을 정의한다.
  • 원래 매개변수를 바꾸지 않고 마지막 FFN 층에 학습 가능한 뉴런(패치)을 추가하는 Transformer-Patcher를 제안한다.
  • 분류 및 생성 태스크에서 SME의 효과를 입증하고 베이스라인과 비교한다.
  • 현실 세계 배치에서 패치 기반 편집의 효율성과 확장성에 대해 논의한다.

제안 방법

  • Reliability, Generality, Locality라는 세 가지 요구사항으로 순차적 모델 편집(SME)을 형식화한다.
  • 원래 매개변수를 고정하고 마지막 FFN 층에 소수의 학습 가능한 뉴런(패치)을 추가하는 Transformer-Patcher를 소개한다.
  • 패치를 FFN 출력을 조정하는 패치 키 k_p, 패치 값 v_p, FFN 출력을 조정하는 스칼라 바이어스 b_p를 가지는 키-값 메모리로 정의한다.
  • 편집 손실 l_e와 활성화 손실 l_a, 국소성을 강제하는 메모리 손실 l_m의 결합으로 패치를 학습한다.
  • 메모리 손실은 이전 질의의 메모리 M을 사용하여 관련 없는 입력에서 패치 활성화를 제약하는 두 가지 구성요소 l_m1 및 l_m2를 포함한다.
  • 표준 SME 평가 파이프라인과 5가지 지표: 성공률(Success Rate), 일반화율(Generalization Rate), 편집 유지율(Edit Retain Rate), 학습 유지율(Training Retain Rate), 테스트 유지율(Test Retain Rate)을 제공한다.

실험 결과

연구 질문

  • RQ1패치 기반 편집기가 이전 수정들을 잊지 않고 Transformer 모델에 순차적으로 수정 작업을 얼마나 잘 수행할 수 있는가?
  • RQ2Transformer-Patcher가 수천 번의 수정에서도 높은 신뢰성과 일반화를 달성하면서 국소성을 유지할 수 있는가?
  • RQ3SME 설정에서 Transformer-Patcher는 미세조정(fine-tuning) 및 HyperNetwork 기반 편집기와 어떻게 비교되는가?
  • RQ4패치 위치와 메모리 크기가 편집 효과와 일반화에 어떤 영향을 미치는가?

주요 결과

  • Transformer-Patcher는 작업 전반에서 SR ≈ 1 및 ER ≈ 1을 달성하고, 거의 완벽한 TrainR 및 TestR을 보이며 수천 번의 수정이 가능하다.
  • FEVER 및 zsRE 전반에서 Transformer-Patcher는 SME 지표에서 미세조정 및 HyperNetwork 기반 편집기보다 우수하게 나타난다.
  • 메모리 손실은 국소성과 전체 성능 유지에 결정적이며, 제거 시 큰 감소가 나타난다.
  • 마지막 FFN 층의 패치가 하위 층의 패치보다 일반화와 편집 효율성에 더 우수하다.
  • 메모리 크기 변화(5k–40k)에 대해 방법은 견고하며, 성능 변화가 미미하다.
  • 편집 속도는 실용적이며(FC 7.1초, QA V100에서 18.9초) 수천 번의 편집으로 확장 가능하다.

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.