How to Query Language Models?
Not on the map. Why?
Abstract (arXiv)
Large pre-trained language models (LMs) are capable of not only recovering linguistic but also factual and commonsense knowledge. To access the knowledge stored in mask-based LMs, we can use cloze-style questions and let the model fill in the blank. The flexibility advantage over structured knowledge bases comes with the drawback of finding the right query for a certain information need. Inspired by human behavior to disambiguate a question, we propose to query LMs by example. To clarify the ambivalent question "Who does Neuer play for?", a successful strategy is to demonstrate the relation using another subject, e.g., "Ronaldo plays for Portugal. Who does Neuer play for?". We apply this approach of querying by example to the LAMA probe and obtain substantial improvements of up to 37.8% for BERT-large on the T-REx data when providing only 10 demonstrations--even outperforming a baseline that queries the model with up to 40 paraphrases of the question. The examples are provided through the model's context and thus require neither fine-tuning nor an additional forward pass. This suggests that LMs contain more factual and commonsense knowledge than previously assumed--if we query the model in the right way.
Key facts. Cited by 11 papers in the map (data through 7 Oct 2026). Builds on 27 of its 38 references that are in the map. First posted on arXiv 4 Aug 2021.
Builds on
27 of 38 references.
References · 27
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2013Efficient Estimation of Word Representations in Vector Spacecited by 4,346
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,115
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
- 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,772
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2020DeBERTa: Decoding-enhanced BERT with Disentangled Attentioncited by 2,157
- 2019Language Models as Knowledge Bases?cited by 1,922
- 2020Making Pre-trained Language Models Better Few-shot Learnerscited by 1,255
- 2016ConceptNet 5.5: An Open Multilingual Graph of General Knowledgecited by 1,065
- 2019How Can We Know What Language Models Know?cited by 953
15 more
- 2020Exploiting Cloze Questions for Few Shot Text Classification and Natural Language Inferencecited by 934
- 2020A Primer in BERTology: What we know about how BERT workscited by 807
- 2020How Much Knowledge Can You Pack Into the Parameters of a Language Model?cited by 713
- 2020It's Not Just Size That Matters: Small Language Models Are Also Few-Shot Learnerscited by 668
- 2019Generalizing from a Few Examples: A Survey on Few-Shot Learningcited by 462
- 2018TextWorld: A Learning Environment for Text-based Gamescited by 304
- 2020How Context Affects Language Models' Factual Predictionscited by 181
- 2019Do NLP Models Know Numbers? Probing Numeracy in Embeddingscited by 157
- 2020Birds have four legs?! NumerSense: Probing Numerical Commonsense Knowledge of Pre-trained Language Modelscited by 110
- 2019StructBERT: Incorporating Language Structures into Pre-training for Deep Language Understandingcited by 108
- 2019E-BERT: Efficient-Yet-Effective Entity Embeddings for BERTcited by 96
- 2020Retrospective Reader for Machine Reading Comprehensioncited by 86
- 2020Learning Dynamic Belief Graphs to Generalize on Text-Based Gamescited by 49
- 2020Text-based RL Agents with Commonsense Knowledge: New Challenges, Environments and Baselinescited by 37
- 2019LeDeepChef: Deep Reinforcement Learning Agent for Families of Text-Based Gamescited by 17
Built on by
Citing papers per year: 2021: 1; 2022: 4; 2023: 2; 2024: 3; 2025: 1.
11 papers.
- 2023Unifying Large Language Models and Knowledge Graphs: A Roadmapcited by 663
- 2022A Review on Language Models as Knowledge Basescited by 156
- 2021NSP-BERT: A Prompt-based Few-Shot Learner Through an Original Pre-training Task--Next Sentence Predictioncited by 23
- 2024The Factuality of Large Language Models in the Legal Domaincited by 10
- 2022Can Language Models Be Specific? How?cited by 8
- 2022A Survey on Knowledge-Enhanced Pre-trained Language Modelscited by 3
- 2023The Contribution of Knowledge in Visiolinguistic Learning: A Survey on Tasks and Challengescited by 2
- 2022MetaFill: Text Infilling for Meta-Path Generation on Heterogeneous Information Networkscited by 0
- 2024FairBelief -- Assessing Harmful Beliefs in Language Modelscited by 0
- 2024Towards Evaluating Large Language Models for Graph Query Generationcited by 0
- 2025Retrieval-Constrained Decoding Reveals Underestimated Parametric Knowledge in Language Modelscited by 0
- 2025Retrieval-Constrained Decoding Reveals Underestimated Parametric Knowledge in Language Models27 Sep 2025
- 2024Towards Evaluating Large Language Models for Graph Query Generation13 Nov 2024
- 2024The Factuality of Large Language Models in the Legal Domain18 Sep 2024
- 2024FairBelief -- Assessing Harmful Beliefs in Language Models27 Feb 2024
- 2023Unifying Large Language Models and Knowledge Graphs: A Roadmap14 Jun 2023
- 2023The Contribution of Knowledge in Visiolinguistic Learning: A Survey on Tasks and Challenges4 Mar 2023
- 2022A Survey on Knowledge-Enhanced Pre-trained Language Models27 Dec 2022
- 2022MetaFill: Text Infilling for Meta-Path Generation on Heterogeneous Information Networks14 Oct 2022
- 2022Can Language Models Be Specific? How?11 Oct 2022
- 2022A Review on Language Models as Knowledge Bases12 Apr 2022
- 2021NSP-BERT: A Prompt-based Few-Shot Learner Through an Original Pre-training Task--Next Sentence Prediction8 Sep 2021