Elamur Research

K-Adapter: Infusing Knowledge into Pre-Trained Models with Adapters

Paper · 2020 · Ruize Wang, Duyu Tang, Nan Duan et al.

Summary

Large pre-trained encoders such as BERT and RoBERTa capture surface patterns well but hold limited factual and linguistic knowledge. Earlier work added that knowledge by retraining all model weights. Each new round of training then risks erasing what was learned before, and the different knowledge types end up mixed in one representation. K-Adapter avoids this by freezing RoBERTa and attaching a separate small network, called an adapter, for each knowledge type. Each adapter reads hidden states from chosen intermediate layers of the frozen model.

Two adapters are trained independently:

  • a factual adapter, trained on Wikipedia sentences aligned with Wikidata triplets through a relation prediction objective;
  • a linguistic adapter, trained to predict dependency relations on web text labelled by an off-the-shelf dependency parser.

The adapters are evaluated on relation classification, entity typing and question answering. Each adapter alone beats RoBERTa, and using both together helps further. The combined model sets state-of-the-art results on most benchmarks. This shows that knowledge can be added one module at a time without retraining or damaging the base model.

Key points

  • The backbone is RoBERTa LARGE (24 layers, hidden size 1024, 16 heads, 355M parameters), kept frozen throughout knowledge infusion.
  • Each adapter layer has N = 2 transformer layers (hidden size 768, 12 heads) between a down-projection and an up-projection, with a skip-connection around them.
  • Adapter layers plug in at RoBERTa layers {0, 11, 23}, and each adapter model has about 42M trainable, randomly initialised parameters.
  • Six datasets across three knowledge-driven tasks were used, with state-of-the-art results on five. On TACRED, K-Adapter beats both RoBERTa and a RoBERTa+multitask baseline trained on the same knowledge.
  • On LAMA cloze probes with no fine-tuning, K-Adapter ranks correct objects higher than RoBERTa, for example Malayalam, infection and Canada.

Interesting ideas

  • I1. Keep the shared backbone frozen and give each knowledge source its own plug-in module, so adding a source never overwrites the others and each source's effect can be measured on its own.
  • I2. The side network reads hidden states from several depths of the frozen model and concatenates them with its own running state, so it can draw on both shallow and deep features cheaply.
  • I3. Predicting dependency relations is used as a pre-training task to push syntactic knowledge into a representation, with automatic parser output as the supervision.
  • I4. The comparison includes a multitask baseline that sees the same knowledge but trains it jointly, which separates the benefit of the knowledge itself from the benefit of the modular design.
  • I5. The case study looks at near misses, where the wrong label barely outscored the true one, and shows that added knowledge flips exactly those decisions.

For Mova

How these ideas could serve Mova, our small open language model — its files, stages and tests:

  • I1 (world): compiled knowledge layers such as VerbNet classes, WordNet ontology and Wikidata facts could be built as independent modules over a fixed core, so a new source can be added or removed without retraining or re-checking the rest.
  • I2 (tree): gparse could keep its transformer encoder fixed and train a small side module on early, middle and late layers for arc labels or UD dialect conversion, which keeps training light.
  • I3 (learn): silver UD trees agreed by several witness parsers could serve as the training signal for a syntax-aware module, rather than requiring hand-annotated treebanks.
  • I4 (learn): when evaluating any new knowledge source, Mova should run a same-data, different-architecture control alongside its negative controls, so the source of each gain is clear.
  • I5 (answer): logging the margin between the top answer and the correct one on school tests would show which errors a specific knowledge module is likely to fix.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

 Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksArtificial Intelligence · 18,805 worksArts and Humanities · 17,959 worksLanguage and Linguistics · 17,789 works

 Concepts 1Key ideas and methods explained on our concept pages.Fine-tuning · 27 works

Cite

Cite as Ruize Wang, Duyu Tang, Nan Duan, Zhongyu Wei, Xuanjing Huang, Jianshu ji, Guihong Cao, Daxin Jiang and Ming Zhou. 2020. K-Adapter: Infusing Knowledge into Pre-Trained Models with Adapters. arXiv:2002.01808.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2002.01808 · arXiv 2002.01808

@misc{wang2020k,
  title = {{K-Adapter: Infusing Knowledge into Pre-Trained Models with Adapters}},
  author = {Ruize Wang, Duyu Tang, Nan Duan, Zhongyu Wei, Xuanjing Huang, Jianshu ji, Guihong Cao, Daxin Jiang and Ming Zhou},
  year = {2020},
  doi = {10.48550/arxiv.2002.01808},
  eprint = {2002.01808},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2002.01808}
}

References

41 references, from the paper's own bibliography.

  1. Livio Baldini Soares, Nicholas FitzGerald, Jeffrey Ling, and Tom Kwiatkowski. 2019. Matching the Blanks: Distributional Similarity for Relation Learning. In ACL, pages 2895–2905. our card
  2. Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. In NIPS, pages 2787–2795. our card
  3. Christian Buck, Jannis Bulian, Massimiliano Ciaramita, Andrea Gesmundo, Neil Houlsby, Wojciech Gajewski, and Wei Wang. 2018. Ask the Right Questions: Active Question Reformulation with Reinforcement Learning. In ICLR. OpenAlex ↗ · Scholar ↗
  4. Eunsol Choi, Omer Levy, Yejin Choi, and Luke Zettlemoyer. 2018. Ultra-fine entity typing. In ACL, pages 87–96. OpenAlex ↗ · Scholar ↗
  5. Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. 2019. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL, pages 2978–2988. OpenAlex ↗ · Scholar ↗
  6. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, pages 4171–4186. our card
  7. Bhuwan Dhingra, Kathryn Mazaitis, and William W Cohen. 2017. Quasar: Datasets for question answering by search and reading. In arXiv preprint arXiv:1707.03904. OpenAlex ↗ · Scholar ↗
  8. Matthew Dunn, Levent Sagun, Mike Higgins, V. Ugur Güney, Volkan Cirik, and Kyunghyun Cho. 2017. SearchQA: A New Q&A Dataset Augmented with Context from a Search Engine. In ArXiv preprint arXiv:1704.05179. our card
  9. Hady ElSahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon S. Hare, Frédérique Laforest, and Elena Simperl. 2018. T-REx: A Large Scale Alignment of Natural Language with Knowledge Base Triples. In LREC. our card
  10. Philip Gage. 1994. A new algorithm for data compression. The C Users Journal, 12(2):23–38. OpenAlex ↗ · Scholar ↗
  11. Bin He, Di Zhou, Jinghui Xiao, Qun Liu, Nicholas Jing Yuan, Tong Xu, et al. 2019. Integrating Graph Contextualized Knowledge into Pre-trained Language Models. In arXiv preprint arXiv:1912.00147. OpenAlex ↗ · Scholar ↗
  12. Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. 2019. Parameter-Efficient Transfer Learning for NLP. In ICML, pages 2790–2799. our card
  13. Lifu Huang, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2019. Cosmos QA: Machine reading comprehension with contextual commonsense reasoning. In EMNLP, pages 2391–2401. our card
  14. Nora Kassner and Hinrich Schütze. 2019. Negated LAMA: Birds cannot fly. arXiv preprint arXiv:1911.03343. OpenAlex ↗ · Scholar ↗
  15. James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, and et al. 2017. Overcoming catastrophic forgetting in neural networks (https://doi.org/10.1073/pnas.1611835114). Proceedings of the National Academy of Sciences, 114(13):3521–3526. our card
  16. Anne Lauscher, Ivan Vulić, Edoardo Maria Ponti, Anna Korhonen, and Goran Glavaš. 2019. Informing unsupervised pretraining with external linguistic knowledge. arXiv preprint arXiv:1909.02339. OpenAlex ↗ · Scholar ↗
  17. Yoav Levine, Barak Lenz, Or Dagan, Dan Padnos, Or Sharir, Shai Shalev-Shwartz, Amnon Shashua, and Yoav Shoham. 2019. Sensebert: Driving some sense into bert. arXiv preprint arXiv:1908.05646. our card
  18. Yankai Lin, Haozhe Ji, Zhiyuan Liu, and Maosong Sun. 2018. Denoising distantly supervised open-domain question answering. In ACL, pages 1736–1745. our card
  19. Xiao Ling, Sameer Singh, and Daniel S. Weld. 2015. Design challenges for entity linking. TACL, 3:315–328. OpenAlex ↗ · Scholar ↗
  20. Xiao Ling and Daniel S. Weld. 2012. Fine-grained entity recognition. In Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence, July 22-26, 2012, Toronto, Ontario, Canada. AAAI Press. OpenAlex ↗ · Scholar ↗
  21. Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. our card
  22. Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In NAACL, pages 2227–2237. our card
  23. Matthew E Peters, Mark Neumann, IV Logan, L Robert, Roy Schwartz, Vidur Joshi, Sameer Singh, and Noah A Smith. 2019. Knowledge enhanced contextual word representations. In EMNLP, pages 43–54. our card
  24. Fabio Petroni, Tim Rocktäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. 2019. Language Models as Knowledge Bases? In EMNLP, pages 2463–2473. our card
  25. Nina Poerner, Ulli Waltinger, and Hinrich Schütze. 2019. BERT is Not a Knowledge Base (Yet): Factual Knowledge vs. Name-Based Reasoning in Unsupervised QA. arXiv preprint arXiv:1911.03681. OpenAlex ↗ · Scholar ↗
  26. Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training. OpenAI Blog. OpenAlex ↗ · Scholar ↗
  27. Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. OpenAI Blog, 1(8). OpenAlex ↗ · Scholar ↗
  28. Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683. our card
  29. Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. 2016. Bidirectional Attention Flow for Machine Comprehension. ArXiv, abs/1611.01603. our card
  30. Sonse Shimaoka, Pontus Stenetorp, Kentaro Inui, and Sebastian Riedel. 2016. An attentive neural architecture for fine-grained entity type classification. In Proceedings of the 5th Workshop on Automated Knowledge Base Construction(AKBC), pages 69–74. OpenAlex ↗ · Scholar ↗
  31. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NeurIPS, pages 5998–6008. our card
  32. Shuohang Wang, Mo Yu, Xiaoxiao Guo, Zhiguo Wang, Tim Klinger, Wei Zhang, Shiyu Chang, Gerald Tesauro, Bowen Zhou, and Jing Jiang. 2017a. Reinforced reader-ranker for open-domain question answering. arXiv preprint arXiv:1709.00023. our card
  33. Shuohang Wang, Mo Yu, Jing Jiang, Wei Zhang, Xiaoxiao Guo, Shiyu Chang, Zhiguo Wang, Tim Klinger, Gerald Tesauro, and Murray Campbell. 2018. Evidence aggregation for answer re-ranking in open-domain question answering. In ICLR. our card
  34. Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. 2017b. Gated self-matching networks for reading comprehension and question answering. In ACL, pages 189–198. our card
  35. Xiaozhi Wang, Tianyu Gao, Zhaocheng Zhu, Zhiyuan Liu, Juanzi Li, and Jian Tang. 2019. KEPLER: A Unified Model for Knowledge Embedding and Pre-trained Language Representation. arXiv preprint arXiv:1911.06136. OpenAlex ↗ · Scholar ↗
  36. Wenhan Xiong, Jingfei Du, William Yang Wang, and Veselin Stoyanov. 2020. Pretrained Encyclopedia: Weakly Supervised Knowledge-Pretrained Language Model. In ICLR. our card
  37. Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. 2019. XLNet: Generalized Autoregressive Pretraining for Language Understanding. arXiv preprint arXiv:1906.08237. our card
  38. Yuhao Zhang, Peng Qi, and Christopher D. Manning. 2018. Graph Convolution over Pruned Dependency Trees Improves Relation Extraction. In EMNLP, pages 2205–2215. our card
  39. Yuhao Zhang, Victor Zhong, Danqi Chen, Gabor Angeli, and Christopher D. Manning. 2017. Position-aware Attention and Supervised Data Improve Slot Filling. In EMNLP, pages 35–45. OpenAlex ↗ · Scholar ↗
  40. Zhengyan Zhang, Xu Han, Zhiyuan Liu, Xin Jiang, Maosong Sun, and Qun Liu. 2019. ERNIE: Enhanced Language Representation with Informative Entities. In ACL, pages 1441–1451. OpenAlex ↗ · Scholar ↗
  41. Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. 2015. Aligning Books and Movies: Towards Story-Like Visual Explanations by Watching Movies and Reading Books. In ICCV, pages 19–27. our card

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/wang-2020-k-adapter-infusing-knowledge-pre/