SlowGuess/NAACL_2022_OCR huggingface dataset:
Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018a. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227-2237, New Orleans, Louisiana. Association for Computational Linguistics.
Matthew E. Peters, Mark Neumann, Luke Zettlemoyer, and Wen-tau Yih. 2018b. Dissecting contextual word embeddings: Architecture and representation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1499-1509, Brussels, Belgium. Association for Computational Linguistics.
Fabio Petroni, Tim Rocttäschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. 2019. Language models as knowledge bases? In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2463-2473, Hong Kong, China. Association for Computational Linguistics.
Tiago Pimentel, Naomi Saphra, Adina Williams, and Ryan Cotterell. 2020a. Pareto probing: Trading off accuracy for complexity. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 3138-3153, Online. Association for Computational Linguistics.
Tiago Pimentel, Josef Valvoda, Rowan Hall Maudslay, Ran Zmigrod, Adina Williams, and Ryan Cotterell. 2020b. Information-theoretic probing for linguistic structure. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4609-4622, Online. Association for Computational Linguistics.
Guanghui Qin and Jason Eisner. 2021. Learning how to ask: Querying LMs with mixtures of soft prompts. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5203-5212, Online. Association for Computational Linguistics.
Alec Radford and Karthik Narasimhan. 2018. Improving language understanding by generative pretraining. Website.
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. Github Repository.
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1-67.
Abhilasha Ravichander, Yonatan Belinkov, and Eduard Hovy. 2021. Probing the probing paradigm: Does probing accuracy entail task relevance? In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 3363-3377, Online. Association for Computational Linguistics.
Sylvestre-Alvise Rebuffi, Hakan Bilen, and Andrea Vedaldi. 2017. Learning multiple visual domains with residual adapters. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc.
Abdelrhman Saleh, Tovly Deutsch, Stephen Casper, Yonatan Belinkov, and Stuart Shieber. 2020. Probing neural dialog models for conversational understanding. In Proceedings of the 2nd Workshop on Natural Language Processing for Conversational AI, pages 132-143, Online. Association for Computational Linguistics.
Timo Schick and Hinrich Schütze. 2021a. Exploiting cloze-questions for few-shot text classification and natural language inference. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 255–269, Online. Association for Computational Linguistics.
Timo Schick and Hinrich Schütze. 2021b. It's not just size that matters: Small language models are also few-shot learners. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2339-2352, Online. Association for Computational Linguistics.
Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. 2020. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4222-4235, Online. Association for Computational Linguistics.
Ian Tenney, Dipanjan Das, and Ellie Pavlick. 2019a. BERT rediscovers the classical NLP pipeline. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4593-4601, Florence, Italy. Association for Computational Linguistics.
Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R. Thomas McCoy, Najoung Kim, Benjamin Van Durme, Sam Bowman, Dipanjan Das, and Ellie Pavlick. 2019b. What do you learn from context? Probing for sentence structure in contextualized word representations. In 7th International Conference on Learning Representations.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all
you need. In Advances in Neural Information Processing Systems, volume 30.
Sara Veldhoen, Dieuwke Hupkes, and Willem H. Zuidema. 2016. Diagnostic classifiers revealing how neural networks process hierarchical structure. In Proceedings of the NeurIPS Workshop on Cognitive Computation: Integrating Neural and Symbolic Approaches.
Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. 2019. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5797-5808, Florence, Italy. Association for Computational Linguistics.
Elena Voita and Ivan Titov. 2020. Information-theoretic probing with minimum description length. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 183-196, Online. Association for Computational Linguistics.
Ralph Weischedel, Martha Palmer, Mitchell Marcus, Eduard Hovy, Sameer Pradhan, Lance Ramshaw, Nianwen Xue, Ann Taylor, Jeff Kaufman, Michelle Franchini, Mohammed El-Bachouti, Robert Belvin, and Ann Houston. 2013. OntoNotes Release 5.0.
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics.
Kelly Zhang and Samuel Bowman. 2018. Language modeling teaches you more than translation does: Lessons learned through auxiliary syntactic task analysis. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 359-361, Brussels, Belgium. Association for Computational Linguistics.
Zexuan Zhong, Dan Friedman, and Danqi Chen. 2021. Factual probing is [MASK]: Learning vs. learning to recall. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5017-5033, Online. Association for Computational Linguistics.
Yichu Zhou and Vivek Srikumar. 2021. DirectProbe: Studying representations without classifiers. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages
5070-5083, Online. Association for Computational Linguistics.
A Prefix Tuning
A.1 Background: Transformer
Recall that in a Transformer-based causal language model (Vaswani et al., 2017; Radford et al., 2019), each layer consists of two sub-layers: a multi-head self-attention mechanism and a fully connected feed-forward network. Each sub-layer is short-circuited with a residual connection, followed by layer normalization. Now we zoom in on the self-attention mechanism. For the sake of illustration, we assume there is only one head in each sub-layer. In self-attention, each activation vector  $\mathbf{a}_i^{(\ell)}$  is first linearly projected into three vectors: query  $\mathbf{q}_i^{(\ell)} = W_q^{(\ell)}\mathbf{a}_i^{(\ell)} \in \mathbb{R}^d$ , key  $\mathbf{k}_i^{(\ell)} = W_k^{(\ell)}\mathbf{a}_i^{(\ell)} \in \mathbb{R}^d$ , and value  $\mathbf{v}_i^{(\ell)} = W_v^{(\ell)}\mathbf{a}_i^{(\ell)} \in \mathbb{R}^d$ . Then we compute the output  $\mathbf{z}_i^{(\ell)}$  as the sum of values weighted by a compatibility score between query and key.
$$
\mathbf {z} _ {i} ^ {(\ell)} = \sum_ {j = 0} ^ {i} \operatorname {s o f t m a x} \left(\frac {\mathbf {q} _ {i} ^ {(\ell) ^ {\top}} \mathbf {k} _ {j} ^ {(\ell)}}{\sqrt {d}}\right) _ {j} \mathbf {v} _ {j} ^ {(\ell)} \tag {7}
$$
The upper bound  $i$  in the summand makes sure it can not attend to subsequent positions, and thereby the prediction for the next token at position  $i + 1$  can only depend on the tokens at positions up to  $i$ . We abstract the feed-forward sub-layer, residual connections, and layer normalizations with a function  $f$  and so we have
$$
\mathbf {a} _ {i} ^ {(\ell + 1)} = f \left(\mathbf {a} _ {i} ^ {(\ell)}, \mathbf {z} _ {i} ^ {(\ell)}\right) \tag {8}
$$
A.2 Prefix Tuning
Prefix tuning prepends the pattern  $\pmb{p}$  a prefix of length  $T$ , which we index from  $-T$  to  $-1$ . Then (7) becomes
$$
\widetilde {\mathbf {z}} _ {i} ^ {(\ell)} = \sum_ {j = - T} ^ {i} \operatorname {s o f t m a x} \left(\frac {\mathbf {q} _ {i} ^ {(\ell) ^ {\top}} \mathbf {k} _ {j} ^ {(\ell)}}{\sqrt {d}}\right) _ {j} \mathbf {v} _ {j} ^ {(\ell)} \tag {9}
$$
and the layer activations are modified accordingly:
$$
\widetilde {\mathbf {a}} _ {i} ^ {(\ell + 1)} = f \left(\widetilde {\mathbf {a}} _ {i} ^ {(\ell)}, \widetilde {\mathbf {z}} _ {i} ^ {(\ell)}\right) \tag {10}
$$
The  $0^{\mathrm{th}}$  layer is left unchanged:  $\widetilde{\mathbf{a}}_i^{(0)} = \mathbf{a}_i^{(0)}$ . Note that we never compute activations  $\mathbf{a}_i^{(\ell)}$  for the prefix  $(i < 0)$ , so we do not need queries  $\mathbf{q}_i^{(\ell)}$  for them, and the key-value pairs  $\mathbf{k}_i^{(\ell)}, \mathbf{v}_i^{(\ell)}$  cannot be obtained through projection from  $\mathbf{a}_i^{(\ell)}$ . Instead, they are learned directly. During training, only  $\mathbf{k}_i^{(\ell)}, \mathbf{v}_i^{(\ell)}$  for prefix are learned while the parameters of the language model are frozen. During inference, the modified activations are now used:
$$
\widetilde {p} \left(w _ {| \boldsymbol {p} | + 1} \mid \boldsymbol {w} _ {<   | \boldsymbol {p} | + 1}\right) = \operatorname {s o f t m a x} \left(W \widetilde {\mathbf {a}} _ {| \boldsymbol {p} |} ^ {(L)}\right) \tag {11}
$$
$$
\widehat {y} = \underset {y ^ {\prime} \in \mathcal {Y}} {\operatorname {a r g m a x}} \widetilde {p} \left(\boldsymbol {w} _ {| \boldsymbol {p} | + 1} = \mathrm {v b} \left(y ^ {\prime}\right) \mid \boldsymbol {w} _ {<   | \boldsymbol {p} |}\right) \tag {12}
$$