text
stringlengths
5.52k
875k
Title: Overview of the TREC 2019 deep learning track: Summary: The Deep Learning Track is a new track for TREC 2019, with the goal of studying ad hoc ranking in a large data regime. It is the first track with large human-labeled training sets, introducing two sets corresponding to two tasks, each with rigorous TREC-style blind evaluation and reusable test sets. The document retrieval task has a corpus of 3.2 million documents with 367 thousand training queries, for which we generate a reusable test set of 43 queries. The passage retrieval task has a corpus of 8.8 million passages with 503 thousand training queries, for which we generate a reusable test set of 43 queries. This year 15 groups submitted a total of 75 runs, using various combinations of deep learning, transfer learning and traditional IR ranking methods. Deep learning runs significantly outperformed traditional IR runs. Possible explanations for this result are that we introduced large training data and we included deep models trained on such data in our judging pools, whereas some past studies did not have such training data or pooling. # OVERVIEW OF THE TREC 2019 DEEP LEARNING TRACK Nick Craswell1, Bhaskar Mitra1, Emine Yilmaz2, Daniel Campos1, and Ellen M. Voorhees3 1Microsoft AI & Research, {nickcr, bmitra, dacamp}@microsoft.com 2University College London, emine.yilmaz@ucl.ac.uk 3NIST, Ellen.Voorhees@nist.gov # ABSTRACT The Deep Learning Track is a new track for TREC 2019, with the goal of studying ad hoc ranking in a large data regime. It is the first track with large human-labeled training sets, introducing two sets corresponding to two tasks, each with rigorous TREC-style blind evaluation and reusable test sets. The document retrieval task has a corpus of 3.2 million documents with 367 thousand training queries, for which we generate a reusable test set of 43 queries. The passage retrieval task has a corpus of 8.8 million passages with 503 thousand training queries, for which we generate a reusable test set of 43 queries. This year 15 groups submitted a total of 75 runs, using various combinations of deep learning, transfer learning and traditional IR ranking methods. Deep learning runs significantly outperformed traditional IR runs. Possible explanations for this result are that we introduced large training data and we included deep models trained on such data in our judging pools, whereas some past studies did not have such training data or pooling. 1 # Introduction Deep learning methods, where a computational model learns an intricate representation of a large-scale dataset, have yielded dramatic improvements on the state of the art in speech recognition and computer vision. This has been fueled by the availability of large-scale datasets [LeCun et al., 2015] such as the ImageNet dataset [Deng et al., 2009] for computer vision and the Atari Arcade Learning Environment [Bellemare et al., 2013] for game playing. There has been significant interest in deep learning for ad-hoc ranking [Mitra and Craswell, 2018]. Work so far has largely been done with small data, proprietary data or synthetic data. With small data, there has been some discussion about whether deep learning methods really outperform strong traditional IR baselines [Yang et al., 2019a]. Using a proprietary set of document ranking data with 200,000 training queries [Mitra et al., 2017], a traditional IR baseline was beaten, but it was impossible for others to follow up on the work without a data release. Dietz et al. [2017] have a TREC task with enough training data to investigate such findings, but on synthetic rather than human-labeled data. Since significant questions remain about baselines and the required volume of human-labeled data, we argue that TREC is a good forum for studying such issues. When a large human-labeled dataset is made available, participants can investigate the role of data size by subsampling. Strong baselines are more than welcome at TREC and there is a blind one-shot evaluation to avoid overfitting. The TREC 2019 Deep Learning Track has two tasks: Document retrieval and passage retrieval. Each task has a dataset that is new to TREC, although the passage task is similar to the MS MARCO passage ranking leaderboard [Bajaj et al., 2016], but with a new test set in the TREC version with more comprehensive labeling. Both tasks are ad-hoc retrieval, meaning that there is a fixed document set, and the goal of the information retrieval system is to respond to each new query with results that would satisfy the querying user’s information need. Ad-hoc retrieval is a very common scenario in real-world search applications and in TREC. The main goals of the track are: 1) To provide large reusable datasets for training and evaluation of deep learning and traditional ranking methods in a large training data regime, 2) To perform a rigorous blind single-shot evaluation, where test labels don’t even exist until after all runs are submitted, to compare different ranking methods, and 3) To study this in both a traditional TREC setup with end-to-end retrieval and in a re-ranking setup that matches how some models may be deployed in practice. Comparing ad hoc retrieval methods in a large-data regime. The track should help us build our understanding of how retrieval methods can take advantage of large-scale data. It should also allow participants to compare various ranking methods such as: ML models vs. traditional IR—including pseudo-relevance feedback. • Deep learning vs. feature-based learning-to-rank (LTR) methods [Liu, 2009]. • Comparison of different deep learning architectures. • Comparison of different supervision approaches, such as fully supervised vs. semi-supervised vs. weakly supervised deep learning [Dehghani et al., 2017]. • Comparison of such models with all the training labels vs. using a subset of labels, to see how performance improves with more data. Comparing different methods for ad hoc search has always been a focus area at TREC, so our goal in this track is to continue that work. End-to-end retrieval vs. reranking. In real-world implementations of LTR methods, a common technique is to first retrieve the top-k documents for a query using relatively cheap “phase 1” ranker such as BM25, and then apply the full ML model to rerank the top-k documents in “phase 2”. This motivates us to offer two participation styles in the Deep Learning Track, which we also refer to as subtasks. One is to implement full end-to-end retrieval, perhaps by implementing both phase 1 and phase 2. This is interesting because a good implementation of phase 1 can enhance the end-to-end performance of the system, by enriching the candidate set for phase 2. It also encourages participants to consider alternatives to the two-phase approach, if it can improve efficiency and effectiveness. The other participation style is to only implement a top-k reranker. This approach is realistic in practice, in fact it is simply phase 2 of the end-to-end approach, for a fixed phase 1. This style of participation lowers the barrier to entry for participating groups who are interested in the LTR aspects of dealing with a large number of training queries, but are not interested in indexing a corpus or studying phase 1 issues. In this style of evaluation—sometimes referred to as telescoping [Matveeva et al., 2006]—participants are given the top-k results in both the training and test set. The interaction between deep learning models and traditional IR indexing data structures is also particularly interest- ing. Most applications of deep learning models in IR—with few exceptions e.g., [Boytsov et al., 2016, Zamani et al., 2018, Mitra et al., 2019, Nogueira et al., 2019]—have been constrained to the reranking setting. Encouraging future exploration of deep learning based ranking models under the full retrieval settings is an explicit goal of the Deep Learning Track. # 2 Task description The track has two tasks: Document retrieval and passage retrieval. Participants were allowed to submit up to three runs per task, although this was not strictly enforced. Participants were provided with an initial set of 200 test queries, then NIST later selected 43 queries during the pooling and judging process, based on budget constraints and with the goal of producing a reusable test collection. The same 200 queries were used for submissions in both tasks, while the selected 43 queries for each task were overlapping but not identical. The full judging process is described in Section 5. When submitting each run, participants also indicated what external data, pretrained models and other resources were used, as well as information on what style of model was used. Below we provide more detailed information about the document retrieval and passage retrieval tasks, as well as the datasets provided as part of these tasks. # 2.1 Document retrieval task The first task focuses on document retrieval—with two subtasks: (i) Full retrieval and (ii) top-100 reranking. In the full retrieval subtask, the runs are expected to rank documents based on their relevance to the query, where documents can be retrieved from the full document collection provided. This subtask models the end-to-end retrieval scenario. Note, although most full retrieval runs had 1000 results per query, the reranking runs had 100, so to make the AP and RR results more comparable across subtasks we truncated full retrieval runs by taking the top-100 results per 2 query by score. These truncated runs were used in the main results table for the task (only), not in the TREC Appendix or in Section 5. In the reranking subtask, participants were provided with an initial ranking of 100 documents, giving all participants the same starting point. The 100 were retrieved using Indri [Strohman et al., 2005] on the full corpus with Krovetz stemming and stopwords eliminated. Participants were expected to rerank the candidates w.r.t. their estimated rel- evance to the query. This is a common scenario in many real-world retrieval systems that employ a telescoping architecture [Matveeva et al., 2006, Wang et al., 2011]. The reranking subtask allows participants to focus on learning an effective relevance estimator, without the need for implementing an end-to-end retrieval system. It also makes the reranking runs more comparable, because they all rerank the same set of 100 candidates. For judging, NIST’s pooling was across both subtasks, and they also identified additional documents for judging via classifier. Further, for queries with many relevant documents, additional documents were judged. These steps were carried out to identify a sufficiently comprehensive set of relevant results, to allow reliable future dataset reuse. Judgments were on a four-point scale: [3] Perfectly relevant: Document is dedicated to the query, it is worthy of being a top result in a search engine. [2] Highly relevant: The content of this document provides substantial information on the query. [1] Relevant: Document provides some information relevant to the query, which may be minimal. [0] Irrelevant: Document does not provide any useful information about the query. # 2.2 Passage retrieval task Similar to the document retrieval task, the passage retrieval task includes (i) a full retrieval and (ii) a top-1000 reranking tasks. In the full retrieval subtask, given a query, the participants were expected to retrieve a ranked list of passages from the full collection based on their estimated likelihood of containing an answer to the question. Participants could submit up to 1000 passages per query for this end-to-end retrieval task. In the top-1000 reranking subtask, 1000 passages per query query were provided to participants, giving all participants the same starting point. The sets of 1000 were generated based on BM25 retrieval with no stemming as applied to the full collection. Participants were expected to rerank the 1000 passages based on their estimated likelihood of containing an answer to the query. In this subtask, we can compare different reranking methods based on the same initial set of 1000 candidates, with the same rationale as described for the document reranking subtask. For judging, NIST’s pooling was across both subtasks, and they also identified additional passages for judging via classifier. Further, for queries with many relevant passages, additional passages were judged. These steps were carried out to identify a sufficiently comprehensive set of relevant results, to allow reliable future dataset reuse. Judgments were on a four-point scale: [3] Perfectly relevant: The passage is dedicated to the query and contains the exact answer. [2] Highly relevant: The passage has some answer for the query, but the answer may be a bit unclear, or hidden amongst extraneous information. [1] Related: The passage seems related to the query but does not answer it. [0] Irrelevant: The passage has nothing to do with the query. # 3 Datasets Both tasks have large training sets based on human relevance assessments, derived from MS MARCO. These are sparse, with no negative labels and often only one positive label per query, analogous to some real-world training data such as click logs. In the case of passage retrieval, the positive label indicates that the passage contains an answer to a query. In the case of document retrieval, we transferred the passage-level label to the corresponding source document that contained the passage. We do this under the assumption that a document with a relevant passage is a relevant document, although we note that our document snapshot was generated at a different time from the passage dataset, so there can be some mismatch. Despite this, in this year’s document retrieval task machine learning models seem to benefit from using the labels, when evaluated using NIST’s non-sparse, non-transferred labels. This suggests the transferred document labels are meaningful for our TREC task. 3 # Table 1: Summary of statistics on TREC 2019 Deep Learning Track datasets. File description Collection Train queries Train qrels Validation queries Validation qrels Test queries Document retrieval dataset File size Number of records 22 GB 3, 213, 835 15 MB 367, 013 7.6 MB 384, 597 216 KB 5, 193 27 MB 519, 300 12 KB 200 Passage retrieval dataset Number of records 8, 841, 823 502, 940 532, 761 12, 665 59, 273 200 File size 2.9 GB 19.7 MB 10.1 MB 545 KB 1.1 MB 12 KB Table 2: Summary of statistics of runs for the two retrieval tasks at the TREC 2019 Deep Learning Track. Number of groups Number of total runs Number of runs w/ category: nnlm Number of runs w/ category: nn Number of runs w/ category: trad Number of runs w/ category: rerank Number of runs w/ category: fullrank 11 37 18 8 11 11 26 The passage corpus is the same as in MS MARCO passage retrieval leaderboard. The document corpus is newly released for use in TREC. Each document has three fields: (i) URL, (ii) title, and (iii) body text. Table 1 provides descriptive statistics for the datasets. More details about the datasets—including directions for download—is available on the TREC 2019 Deep Learning Track website1. Interested readers are also encouraged to refer to [Bajaj et al., 2016] for details on the original MS MARCO dataset. # 4 Results and analysis Submitted runs A total of 15 groups participated in the TREC 2019 Deep Learning Track, with an aggregate of 75 runs submitted across both tasks. Based run submission surveys, we classify each run into one of three categories: • nnlm: if the run employs large scale pre-trained neural language models, such as BERT [Devlin et al., 2018] or XLNet [Yang et al., 2019b] nn: if the run employs some form of neural network based approach—e.g., Duet [Mitra et al., 2017, Mitra and Craswell, 2019] or using word embeddings [Joulin et al., 2016]—but does not fall into the “nnlm” category • trad: if the run exclusively uses traditional IR methods like BM25 [Robertson et al., 2009] and RM3 [Abdul- Jaleel et al., 2004]. We placed 33 (44%) runs in the “nnlm” category (32 using BERT and one using XLNet), 20 (27%) in the “nn” category, and the remaining 22 (29%) in the “trad” category. We further categorize runs based on subtask: rerank: if the run reranks the provided top-k candidates, or • fullrank: if the run employs their own phase 1 retrieval system. We find that only 21 (28%) submissions fall under the “rerank” category—while the remaining 54 (72%) are “full- rank”. Table 2 breaks down the submissions by category and task. We also encouraged some participants to run strong traditional IR baselines, and submit them as additional runs under the “BASELINE” group. Baseline runs for document ranking were: bm25base BM25 [Robertson et al., 2009] with default parameters # 1https://microsoft.github.io/TREC-2019-Deep-Learning/ 4 bm25base_ax BM25+AX [Yang and Lin, 2019] with default parameters bm25base_prf BM25+PRF [Zeng and Sakai, 2019] with default parameters bm25base_rm3 BM25+RM3 [Yang et al., 2019a] with default parameters bm25tuned BM25 [Robertson et al., 2009] with tuned parameters bm25tuned_ax BM25+AX [Yang and Lin, 2019] with tuned parameters bm25tuned_prf BM25+PRF [Zeng and Sakai, 2019] with tuned parameters bm25tuned_rm3 BM25+RM3 [Yang et al., 2019a] with tuned parameters Baseline runs for passage ranking were: bm25base_ax_p BM25+AX [Yang and Lin, 2019] with default parameters bm25base_p BM25 [Robertson et al., 2009] with default parameters bm25base_prf_p BM25+PRF [Zeng and Sakai, 2019] with default parameters bm25base_rm3_p BM25+RM3 [Yang et al., 2019a] with default parameters bm25tuned_ax_p BM25+AX [Yang and Lin, 2019] with tuned parameters bm25tuned_p BM25 [Robertson et al., 2009] with tuned parameters bm25tuned_prf_p BM25+PRF [Zeng and Sakai, 2019] with tuned parameters bm25tuned_rm3_p BM25+RM3 [Yang et al., 2019a] with tuned parameters Overall results Our main metric in both tasks is Normalized Discounted Cumulative Gain (NDCG)—specifically, NDCG@10, since it makes use of our 4-level judgments and focuses on the first results that users will see. To analyse if any of the fullrank runs recall more relevant candidates in phase 1 compared to those provided for the reranking subtask, we also report Normalized Cumulative Gain (NCG) [Rosset et al., 2018] at rank 100 and 1000 for the document and passage ranking tasks, respectively. We choose to report NCG because it discriminates between recalling documents with different positive relevance grades and is a natural complement to NDCG, our main metric. Although NCG is not officially supported by trec_eval, we confirm that it correlates strongly with the recall metric for these analysed runs. The overall results are presented in Table 3 for document retrieval and Table 4 for passage retrieval. These tables include multiple metrics and run categories, which we now use in our analysis. Evaluation of deep learning and traditional ranking methods in a large training data regime An important goal of this track is to compare the performance of different types of model, using large human-labeled training sets, for the core IR task of ad-hoc search. Indeed this is the first time a TREC-style blind evaluation has been carried out to compare state-of-the-art neural and traditional IR methods. Figure 1a plots the NDCG@10 performance of the different runs for the document retrieval task, broken down by model type. In general, runs in the category “nnlm” outperform the “nn” runs, which outperform the “trad” runs. The best performing run of each category is indicated, with the best “nnlm” and “nn” models outperforming the best “trad” model by 29.4% and 14.8% respectively. The passage retrieval task reveals similar pattern. In Figure 1b, the gap between the best “nnlm” and “nn” runs and the best “trad” run is larger, at 37.4% and 23.7% respectively. One explanation for this could be that vocabulary mismatch between queries and relevant results is more likely in short text, so neural methods that can overcome such mismatch have a relatively greater advantage in passage retrieval. Another explanation could be that there is already a public leaderboard, albeit without test labels from NIST, for the passage task. Some TREC participants may have submitted neural models multiple times to the public leaderboard, and are well practiced for the passage ranking task. In query-level win-loss analysis for the document retrieval task (Figure 2) the best “nnlm” model outperforms the best “trad” run on 36 out of 43 test queries (i.e., 83.7%). Passage retrieval shows a similar pattern in Figure 3. Neither task has a large class of queries where the “nnlm” model performs worse, at least on this year’s data. However, more iterations of rigorous blind evaluation with strong “trad” baselines, plus more scrutiny of the benchmarking methods, would be required to convince us that this is true in general. Next, we analyze this year’s runs by representing each run as a vector of 43 NDCG@10 scores. In this vector space, two runs are similar if their NDCG vectors are similar, meaning they performed well and badly on the same queries. Using t-SNE [Maaten and Hinton, 2008] we then plot the runs in two dimensions, which gives us a visualization where similar runs will be closer together and dissimilar results further apart. This method of visualizing inter-model similarity was first proposed by Mitra et al. [2017] and we employ it to generate the plots in Figure 4. 5 Table 3: Document retrieval runs. RR (MS) is based on MS MARCO labels. All other metrics are based on NIST labels. run group subtask neural RR (MS) RR NDCG@10 NCG@100 AP IDST idst_bert_v3 IDST idst_bert_r1 IDST idst_bert_v2 IDST idst_bert_v1 IDST idst_bert_r2 h2oloo bm25exp_marcomb TU-Vienna TUW19-d3-re UCAS ucas_runid1 UCAS ucas_runid3 h2oloo bm25_marcomb h2oloo bm25exp_marco UCAS ucas_runid2 TU-Vienna TUW19-d2-re uogTr uogTrDNN6LM TU-Vienna TUW19-d1-re Microsoft ms_ensemble srchvrs srchvrs_run1 TU-Vienna TUW19-d2-f TU-Vienna TUW19-d3-f CMU dct_tp_bm25e2 srchvrs srchvrs_run2 BASELINE bm25tuned_rm3 CMU dct_qp_bm25e dct_tp_bm25e CMU uogTrDSSQE5LM uogTr TUW19-d1-f ms_duet uogTrDSS6pLM bm25tuned_prf bm25tuned_ax bm25base bm25base_rm3 runid1 bm25tuned bm25base_prf baseline bm25base_ax fullrank rerank fullrank fullrank rerank fullrank rerank rerank rerank fullrank fullrank rerank rerank fullrank rerank fullrank fullrank fullrank fullrank fullrank fullrank fullrank fullrank fullrank fullrank fullrank rerank fullrank fullrank fullrank fullrank fullrank rerank fullrank fullrank fullrank fullrank nnlm nnlm nnlm nnlm nnlm nnlm nn nnlm nnlm nnlm nnlm nnlm nn nnlm nn nn trad nn nn nn trad trad nn nn nnlm nn nn nnlm trad trad trad trad nnlm trad trad trad trad 0.4866 0.4889 0.4865 0.4874 0.4734 0.3518 0.4014 0.4422 0.4353 0.3591 0.3610 0.4315 0.3154 0.3187 0.3616 0.3725 0.3065 0.2886 0.3735 0.3402 0.3038 0.3396 0.3585 0.3530 0.3264 0.3190 0.2758 0.2803 0.3176 0.2889 0.2949 0.2405 0.3058 0.2930 0.2717 0.2795 0.2677 0.9612 0.9729 0.9612 0.9729 0.9729 0.8992 0.9457 0.9109 0.8992 0.9128 0.9031 0.9496 0.9147 0.8729 0.8915 0.8760 0.8715 0.8711 0.8929 0.8718 0.8715 0.8074 0.8915 0.8638 0.8895 0.8465 0.8101 0.8895 0.8005 0.7492 0.8046 0.7714 0.7811 0.8872 0.7774 0.8037 0.7424 0.7257 0.7189 0.7181 0.7175 0.7135 0.6456 0.6443 0.6437 0.6418 0.6403 0.6399 0.6350 0.6053 0.6046 0.5930 0.5784 0.5609 0.5596 0.5576 0.5544 0.5529 0.5485 0.5435 0.5424 0.5386 0.5383 0.5330 0.5323 0.5281 0.5245 0.5190 0.5169 0.5164 0.5140 0.5106 0.4823 0.4730 0.5800 0.5179 0.5947 0.5820 0.5179 0.6367 0.5179 0.5179 0.5179 0.6356 0.6191 0.5179 0.5179 0.5093 0.5179 0.4841 0.5599 0.4103 0.3045 0.4979 0.5572 0.5590 0.4924 0.4786 0.1839 0.2951 0.5179 0.1868 0.5576 0.5835 0.5170 0.5546 0.5179 0.5262 0.5303 0.5114 0.5148 # TU-Vienna Microsoft uogTr BASELINE BASELINE BASELINE BASELINE CCNU_IRGroup BASELINE BASELINE BITEM_DL BASELINE 0.3137 0.2915 0.3157 0.3119 0.2910 0.3190 0.2709 0.2642 0.2677 0.3229 0.3030 0.2526 0.2391 0.2488 0.2524 0.2369 0.2645 0.2050 0.1843 0.2244 0.2615 0.2700 0.2228 0.2098 0.1085 0.1647 0.2291 0.1129 0.2759 0.2816 0.2443 0.2772 0.2366 0.2318 0.2542 0.2168 0.2452 0.9 —%& nnim = nn 0.8 _% trad bestnnimrun YL o OE S07 8 ee oe 8 | = 0.6 best trad run 05 | | | 0.4 0.9 2% nnim = nn 0.8 best nnim run _% trad Segue nn nnn nnn nnn nn nnn nn nnn nnn nnn nn nnn nnn nn nnn enna naan ne o best nn run S074 |] } Itty) | tegeeeeee-- ee. 8 8 206 best trad run 05 | | 0.4 | I (a) Document retrieval task (b) Passage retrieval task Figure 1: NDCG@10 results, broken down by run type. Runs of type “nnlm”, meaning they use language models such as BERT, performed best on both tasks. Other neural network models “nn” and non-neural models “trad” had relatively lower performance this year. More iterations of evaluation and analysis would be needed to determine if this is a general result, but it is a strong start for the argument that deep learning methods may take over from traditional methods in IR applications. 6 # who # difference how long to hold bow in yoga exons definition biology formed the commonwealth of independent states what is the daily life of thai people what are the social determinants of health how many liberty ships were built in brunswick rsa definition key what types of food can you cook sous vide what can contour plowing reduce why did the us volunterilay enter ww1 what is the most popular food in switzerland what is an aml surveillance analyst how are some sharks warm blooded what is durable medical equipment consist of definition declaratory judgment causes of military suicide what is wifi vs bluetooth define visceral? cost of interior concrete flooring what is physical description of spruce axon terminals or synaptic knob definition tracheids are partof__ when was the salvation army founded hydrogen is a liquid below what temperature anthropological definition of environment what is theraderm used for right pelvic pain causes causes of left ventricular hypertrophy definition of a sigmet do goldfish grow is cdg airport in main paris how long is life cycle of flea Ips laws definition medicare's definition of mechanical ventilation example of monotonic function how to find the midsegment of a trapezoid types of dysarthria from cerebral palsy between a mcdouble and a double cheeseburger what is a active margin difference between rn and bsn what is famvir prescribed for who is robert gray how is the weather in jamaica o----¢ # oo #--2 0.0 0.2 0.4 0.6 NDCG@10 0.8 Figure 2: Comparison of the best “nnlm” and “trad” runs on individual test queries for the document retrieval task. Queries are sorted by difference in mean performance between “nnlm” and “trad”runs. Queries on which “nnlm” wins with large margin are at the top. 7 1.0 who is robert gray define visceral? difference between rn and bsn what is the most popular food in switzerland exons definition biology example of monotonic function what are the three percenters? how to find the midsegment of a trapezoid types of dysarthria from cerebral palsy formed the commonwealth of independent states medicare's definition of mechanical ventilation what is durable medical equipment consist of what can contour plowing reduce how are some sharks warm blooded what is a active margin do goldfish grow what types of food can you cook sous vide tracheids are partof__ what is physical description of spruce is cdg airport in main paris what is wifi vs bluetooth cost of interior concrete flooring Ips laws definition why did the us volunterilay enter ww1 what is the daily life of thai people definition of a sigmet definition declaratory judgment axon terminals or synaptic knob definition what is famvir prescribed for does legionella pneumophila cause pneumonia hydrogen is a liquid below what temperature causes of military suicide anthropological definition of environment between a mcdouble and a double cheeseburger what is an aml surveillance analyst what is theraderm used for right pelvic pain causes rsa definition key what are the social determinants of health how long is life cycle of flea when was the salvation army founded causes of left ventricular hypertrophy # who # difference @------------ ° @----------- + @--------- ° enn ----- =~ ° @n------- + o------- ° pe ° @n----- @------ ° en + O----- ° o----- ° o----- ° o----@ ———+---@ ied > oo +2 a o-2 o---0 o----2 how is the weather in jamaica ----- 2 0.0 0.2 0.4 0.6 NDCG@10 0.8 1.0 Figure 3: Comparison of the best “nnlm” and “trad” runs on individual test queries for the passage retrieval task. Queries are sorted by difference in mean performance between “nnlm” and “trad”runs. Queries on which “nnlm” wins with large margin are at the top. 8 Table 4: Passage retrieval runs. RR (MS) is based on MS MARCO labels. All other metrics are based on NIST labels. neural RR (MS) group subtask RR NDCG@10 NCG@1000 run idst_bert_p1 idst_bert_p2 idst_bert_p3 p_exp_rm3_bert p_bert idst_bert_pr2 idst_bert_pr1 p_exp_bert test1 TUA1-1 runid4 runid3 TUW19-p3-f TUW19-p1-f TUW19-p3-re TUW19-p1-re TUW19-p2-f ICT-BERT2 srchvrs_ps_run2 TUW19-p2-re ICT-CKNRM_B ms_duet_passage ICT-CKNRM_B50 srchvrs_ps_run3 bm25tuned_prf_p bm25base_ax_p bm25tuned_ax_p bm25base_prf_p runid2 runid5 bm25tuned_rm3_p bm25base_rm3_p bm25base_p srchvrs_ps_run1 bm25tuned_p UNH_bm25 IDST IDST IDST h2oloo h2oloo IDST IDST h2oloo Brown TUA1 udel_fang udel_fang TU-Vienna TU-Vienna TU-Vienna TU-Vienna TU-Vienna ICTNET srchvrs TU-Vienna ICTNET Microsoft ICTNET srchvrs BASELINE BASELINE BASELINE BASELINE CCNU_IRGroup CCNU_IRGroup BASELINE BASELINE BASELINE srchvrs BASELINE TREMA-UNH fullrank fullrank fullrank fullrank fullrank rerank rerank fullrank rerank rerank rerank rerank fullrank fullrank rerank rerank fullrank fullrank fullrank rerank fullrank rerank fullrank fullrank fullrank fullrank fullrank fullrank rerank fullrank fullrank fullrank fullrank fullrank fullrank fullrank nnlm nnlm nnlm nnlm nnlm nnlm nnlm nnlm nnlm nnlm nnlm nnlm nn nn nn nn nn nnlm nnlm nn nnlm nn nnlm trad trad trad trad trad nnlm nnlm trad trad trad trad trad trad 0.4635 0.4631 0.4374 0.3582 0.3624 0.4209 0.4430 0.3564 0.3598 0.3622 0.3762 0.3725 0.3134 0.3187 0.3100 0.3180 0.3469 0.3846 0.3262 0.3424 0.2984 0.2473 0.2055 0.1883 0.1928 0.1888 0.1840 0.2007 0.2143 0.2068 0.2162 0.1590 0.2402 0.1902 0.2363 0.1803 0.9283 0.9283 0.9167 0.8884 0.8663 0.8818 0.9070 0.8671 0.8702 0.8702 0.8702 0.8663 0.8407 0.8360 0.8568 0.8516 0.8487 0.8743 0.8302 0.8611 0.8016 0.8065 0.7597 0.6942 0.6996 0.6516 0.6481 0.6211 0.8088 0.7999 0.6992 0.6683 0.7036 0.5597 0.6850 0.6036 0.7645 0.7632 0.7594 0.7422 0.7380 0.7379 0.7378 0.7336 0.7314 0.7314 0.7028 0.6975 0.6884 0.6756 0.6746 0.6746 0.6709 0.6650 0.6645 0.6615 0.6481 0.6137 0.6014 0.5558 0.5536 0.5511 0.5461 0.5372 0.5322 0.5252 0.5231 0.5180 0.5058 0.4990 0.4973 0.4495 0.8196 0.8203 0.8287 0.7939 0.7472 0.6864 0.6864 0.7465 0.6864 0.6864 0.6864 0.6864 0.7436 0.7436 0.6864 0.6864 0.7432 0.2491 0.6643 0.6864 0.2491 0.6864 0.3786 0.7240 0.7947 0.8194 0.8145 0.7901 0.6830 0.5440 0.7841 0.7976 0.7490 0.7240 0.7472 0.6957 — On both document and passage retrieval tasks, the runs appear to be first clustered by group—see Figures 4b and 4d. This is expected, as different runs from the same group are likely to employ variations of the same approach. In Figures 4a and 4c, runs also cluster together based on their categorization as “nnlm”, “nn”, and “trad”. End-to-end retrieval vs. reranking. Our datasets include top-k candidate result lists, with 100 candidates per query for document retrieval and 1000 candidates per query for passage retrieval. Runs that simply rerank the provided candidates are “rerank” runs, whereas runs that perform end-to-end retrieval against the corpus, with millions of potential results, are “fullrank” runs. We would expect that a “fullrank” run should be able to find a greater number of relevant candidates than we provided, achieving higher NCG@k. A multi-stage “fullrank” run should also be able to optimize the stages jointly, such that early stages produce candidates that later stages are good at handling. According to Figure 5, “fullrank” did not achieve much better NDCG@10 performance than “rerank” runs. While it was possible for “fullrank” to achieve better NCG@k, it was also possible to make NCG@k worse, and achieving significantly higher NCG@k does not seem necessary to achieve good NDCG@10. Specifically, for the document retrieval task, the best “fullrank” run achieves only 0.9% higher NDCG@10 over the best “rerank’ run. For the passage retrieval task, the difference is 3.6%. The best NCG@100 for the document retrieval task is achieved by a well-tuned combination of BM25 [Robertson et al., 2009] and RM3 [Abdul-Jaleel et al., 2004] on top of document expansion using doc2query [Nogueira et al., 2019]—which improves by 22.9% on the metric relative to the set of 100 candidates provided for the reranking task. For the passage retrieval task, the best NCG@1000 is 20.7% higher than that of the provided reranking candidate set. 9 0.5030 0.5039 0.5046 0.5049 0.4677 0.4565 0.4571 0.4749 0.4567 0.4571 0.4383 0.4381 0.4196 0.4125 0.4113 0.4073 0.4157 0.2421 0.4090 0.3963 0.2289 0.3477 0.2429 0.3184 0.3684 0.3745 0.3632 0.3561 0.2671 0.2506 0.3377 0.3390 0.3013 0.2972 0.2903 0.2566 ee em e @ @ mim trad e ee ~ PY 5 | e a S|) oe e —e| + im Cm hd g e e s ° ee e e oe e e +++ % e + +t, # nw 5) a 5) —| 3 g s @ BASELINE ee @ = BITEMDL ~~ CCNU_IRGroup * =CMU @ \DsT ) ++ Microsoft oe = TU-Vienna » UCAS | @ heoloo x @ srchvrs x Vo suogTr oe * @ + 2% x e+ x * v fa ee? % + e ee, ° ° . latent dimension 1 latent dimension 1 (a) By model type on document retrieval task (b) By group name on document retrieval task em e e © onnlm A ° % s | trad 1 ee es e e e + 5 + 5 e 2) * 2, e@ aa Ele @ BASELINE S| +t oe S 2 & ps @ Brown g * g La! CCNU_IRGroup “ * ° = W v * ICTNET e + @ pst » y + Microsoft oo xx TREMA-UNH e x TU-Vienna e @ TuAL @ = h2oloo ? Pl Vosrchvrs e * @ udel_fang latent dimension 1 latent dimension 1 # (c) By model type on passage retrieval task (d) By group name on passage retrieval task Figure 4: Visualizing inter-run similarity using t-SNE. Each run is represented by a 43-dimensional vector of NDCG@10 performance on corresponding 43 test queries. The 43-dimensional vector is then reduced to two- dimensions and plotted using t-SNE. Runs that are submitted by the same group generally cluster together. Similarly, “nnlm”, “nn”, and “trad” runs also demonstrate similarities. Given this was the first ever Deep Learning Track at TREC, we are not yet seeing a strong advantage of “fullrank” over “rerank”. However, we hope that as the body of literature on neural methods for phase 1 retrieval (e.g., [Boytsov et al., 2016, Zamani et al., 2018, Mitra et al., 2019, Nogueira et al., 2019]) grows, we would see a larger number of runs with deep learning as an ingredient for phase 1 in future editions of this TREC track. NIST labels vs. Sparse MS MARCO labels. Our baseline human labels from MS MARCO often have one known positive result per query. We use these labels for training, but they are also available for test queries. Although our official evaluation uses NDCG@10 with NIST labels, we now compare this with reciprocal rank (RR) using MS MARCO labels, and RR using NIST labels. Our goal is to understand how changing the labeling scheme and metric affects the overall results of the track, but if there is any disagreement we believe the NDCG results are more valid, since they evaluate the ranking more comprehensively and a ranker that can only perform well on labels with exactly the same distribution as the training set is not robust enough for use in real-world applications, where real users will have opinions that are not necessarily identical to the preferences encoded in sparse training labels. In Figure 7 and 8, We observe general agreement between results using MS MARCO and NIST labels–i.e., runs that perform well on MS MARCO-style evaluation also tends to achieve good performance when evaluated under 10 0.9 2 fullrank —t rerank 0.8 best fullrank run best rerank run S07 ® 8 Trt 206 ; I 0.4 lI 0.9 @ fullrank — best fullrank run ¢_ rerank 0.8 -- S07 ® 8 206 ? ; HU 0.4 i (a) NDCG@10 for runs on the document retrieval task (b) NDCG@10 for runs on the passage retrieval task 0.7 _¢ fullrank 06 t Te _? rerank ¢. 0.5 TTT TTT TITS FT Te ; 8 G04 8 0.3 0.2 1 1 oa 0.9 os! 7? eff * 07 t o “| PTT TTTITTIT ST TTT TOT TT TT 806 ® 8 0.5 0.4 0.3) _@ fullrank ace k a2 SEEEEPH tit (c) NCG@100 for runs on the document retrieval task (d) NCG@1000 for runs on the passage retrieval task Figure 5: Analyzing the impact of “fullrank” vs. “rerank” settings on retrieval performance. Figure (a) and (b) show the performance of different runs on the document and passage retrieval tasks, respectively. Figure (c) and (d) plot the NCG@100 and NCG@1000 metrics for the same runs for the two tasks, respectively. The runs are ordered by their NDCG@10 performance along the x-axis in all four plots. We observe, that the best run under the “fullrank” setting outperforms the same under the “rerank” setting for both document and passage retrieval tasks—although the gaps are relatively smaller compared to those in Figure 1. If we compare Figure (a) with (c) and Figure (b) with (d), we do not observe any evidence that the NCG metric is a good predictor of NDCG@10 performance. traditional TREC settings, and vice versa. This is good news, validating the MS MARCO leaderboard results are at least somewhat indicative of results that are found with pooled judging. # 5 Reusability of test collections One goal of the track was to create traditional ad hoc test sets based on the MS MARCO dataset within available budgets. Since the Document Ranking and Passage Ranking tasks used different document sets, two separate test collections, one per task, were constructed. The two test collections started from a common set of topics and each topic was judged by the same NIST assessor for both documents and passages, but assessing for documents and passages was done at different times. Further, the evaluation set of topics (i.e., the topics over which evaluation scores are computed) are overlapping but not identical in the two collections. Thus the collections created in the track are two separate, independent collections. The runs submitted to the track consisted of ranked lists of items for each topic in the test set of 200 topics. NIST se- lected 52 topics from this set to be judged. The topics were selected by observing the behavior of submitted Document Ranking task runs on the entire test set when using the sparse MARCO judgments to evaluate runs. Test questions that had median MRR scores greater than 0.0 but no more than 0.5 were candidates to be judged. The judgment process then proceeded as follows, where the items to be judged will generically be called ‘documents’ even though those documents were MS MARCO passages for the Passage Ranking task. 11 0.504 @o e 0.45 4 <4 < group e IDST 0.40 4 a Vv h2oloo ~ 4 TU-Vienna 2 ae < UCAS z a ¥v > uogTr [a4 @ 0.354 7 v @ Microsoft > srchvrs «A x cMuU 0.304 e » BASELINE Care a @ CCNU_IRGroup ° 8 e@ BITEM_DL * * 0.25 4 * T T T T T 0.45 0.50 0.55 0.60 0.65 0.70 # NDCG@10 (a) Document retrieval task. e 0.45 4 Pe e 0.40 4 group > e IDST v_ h2oloo 0.35 4 e * e A Brown a << TUAI = » udel_fang Eq 0.30 e@ TU-Vienna ICTNET srchvrs 0.25 4 e * » — Microsoft e e@ BASELINE ce e@ CCNU_IRGroup e@ |_| 0.204 bd @ TREMA-UNH e & e 0.15 4 0.45 050 055 0.60 0.65 0.70 0.75 NDCG@10 (b) Passage retrieval task. Figure 6: Metrics agreement scatter plot, broken down by group. RR (MS) is reciprocal rank calculated with the sparse MS MARCO labels, while NDCG@10 is calculated using NIST labels. 12 0.50 + x 0.45 0.40 Y RR (MS) 0.35 0.30 0.25 1.00 0.95 0.90 RR 0.85 0.80 0.75 4 4 9.75) 7 =0.69 t= 0.73 # + 0.65 4X4 4 # X 4 yy 4 +X 4 % x x 2 4 Y 4 4 Y ¥ ng y NDCG@10 ° fon) fo) ° u a 0.50 v J aa Y 0.2 0.4 0.6 0.8 1.0 0.4 0.6 RR (MS) RR NDCG@10 neural + nnim x onn trad Y 0.8 Figure 7: Metrics agreement analysis, broken down by model type, for the document retrieval task. Kendall correlation (τ ) indicates agreement between metrics on system ordering. RR (MS) is calculated using MS MARCO sparse labels, while RR and NDCG@10 are calculated using NIST labels. 13 0.5 0.4 0.3 RR (MS) 0.2 NDCG@10 0.2 0.4 RR (MS) neural + x y tT=0.77 + fH & 4x ¥ ¥ Tyy oF Y yr Y GSS>SS 0.6 0.8 1.0 0.4 0.6 0.8 RR NDCG@10 Figure 8: Metrics agreement analysis, broken down by model type, for the passage retrieval task. Kendall correlation (τ ) indicates agreement between metrics on system ordering. RR (MS) is calculated using MS MARCO sparse labels, while RR and NDCG@10 are calculated using NIST labels. 14 neural + nnim x onmn y trad [1] For each question, create a top-10 pool across all runs in the task, and add any document that contains a judgment in the MARCO sparse judgments. Call the size of this set P (which varies from topic to topic). The assessor judges these pool documents first, then another 100 documents selected to be judged using the University of Waterloo’s HiCAL [Abualsaud et al., 2018] system. HiCAL uses the current set of judgments to build a relevance model and then selects the unjudged document most likely to be relevant as the next document to judge. At the end of this stage there are R known relevant documents. If 2R < P , the judging is finished for this topic. [2] Call the the difference between the number of documents that have been judged and the desired number of 2R + 100 judgments G. Judge another G documents selected by HiCAL. Now the number of judgments for the topic is J = P + 100 + G and the new number of known relevant is R∗. If 2R∗ + 100 < J, assessment is finished for the topic. If R∗ ≈ J, then discard the topic because it will be too expensive to get “sufficiently complete” judgments for it. [3] If a topic is still live, add a new increment proportional to the number of known relevant documents to the topic budget, and iterate, terminating when (if) the number of known relevant documents is less than half the number of judged documents. [4] Terminate the entire process when assessors are out of time or have nothing left to judge. The resulting evaluation set was the set of topics with at least three relevant documents and a ratio of R∗/J < 0.6. This process resulted in 43 topics in the evaluation set for both the Document Ranking and the Passage Ranking tasks, but as noted it is a slightly different 43 topics for the two tasks. Documents in the Document Ranking task were judged on a four-point scale of Irrelevant (0), Relevant (1), Highly Relevant (2), and Perfectly Relevant (3) where all but Irrelevant were treated as relevant in HiCAL and in computing binary-relevance-based measures. For the Passage Ranking task, passages were judged on a four-point scale of Irrel- evant (0), Related (the passage is on-topic but does not answer the question) (1), Highly Relevant (2), and Perfectly Relevant (3). In this task, only Highly and Perfectly Relevant were considered to be relevant for binary measures and by HiCAL, though nDCG scores did use a gain value of 1 for the Related passages. Table 5 gives counts of the number of documents judged and the number of relevant documents (using the definitions for binary relevance) found for each of the 52 topics that entered the process. HiCAL is a dynamic collection construction method, meaning that the document to be judged next is selected only after judgments for previous documents have been received. The Common Core track in TRECs 2017 and 2018 used a method based on multi-armed bandit optimization techniques, another dynamic method, with the similar goal of building high-quality, reusable, ad hoc test collections affordably [Voorhees, 2018]. That work showed two main issues to be overcome when building new collections with dynamic techniques: providing the assessors the opportunity to learn a topic before immutable judgments are rendered, and setting individual topic budgets when assessors judge at different rates and at different times but are subject to a single overall judgment budget. The first issue is less severe with (NIST’s modification of) HiCAL since assessors can change the value of any previously made judgment at any time; whenever a new relevance model is calculated, HiCAL uses the judgments current at the time of calculation. Nonetheless, top-10 pools provide both an opportunity for assessors to learn a topic and ensure that all measures based on document-level cutoffs less than or equal to ten are precise for all judged runs, and this motivated the use of pools in the first stage of the process. Setting per-topic judgment budgets continues to be a challenging problem. The stopping criterion of ending a topic once 2R+100 documents were judged was motivated by the heuristic observed by Waterloo in prior use of HiCAL [Cormack and Grossman, 2018] further supported by the Common Core track’s observation that a topic for which more than half of its judged documents are relevant is unlikely to be sufficiently judged2. Note that the process described above was the target process, but the practicalities of keeping assessors occupied meant that some topics received more judgments than they “deserved”. All judgments for non-excluded topics are included in the qrels file. # 5.1 Collection Robustness Our goal is to build general-purpose, reusable test collections at acceptable cost. In this context, general-purpose means a collection reliably ranks runs for a wide spectrum of evaluation measures, including recall-focused measures. Reusable means that runs that did not participate in the collection building process can be reliably ranked by the collection. Since costs in building a collection are generally dominated by the cost of human assessments, the number of relevance judgments required is used as the construction cost. 2We nonetheless included topics with a ratio of relevant to judged between 0.5 and 0.6 in the evaluation set because test collection stability tests suggest the collection is more stable with those topics than without them (likely because the total number of topics is greater with them) and to provide a greater diversity of topic sizes in the evaluation set. 15 Table 5: Judging statistics for the Document Ranking and Passage Ranking tasks. Given are the number of documents judged (any variant of) relevant, the total number of documents judged, and the fraction of judged documents that are relevant (Relevant Ratio). Topics were excluded from the evaluation set if they had fewer than 3 relevant or if the fraction of judged documents that are relevant was greater than 0.6. Data for excluded topics are given in gray. The final rows gives the total number of documents judged and the number of documents judged when not counting excluded topics. Document Ranking Passage Ranking # Relevant 53 767 168 165 341 61 42 25 25 240 151 578 23 324 76 177 3 183 34 1 195 202 392 51 52 42 178 5 115 24 283 44 381 40 432 335 242 41 385 93 55 562 7 386 55 2 440 276 38 20 199 426 # Judged 239 1476 404 346 420 218 174 168 157 578 378 885 144 723 228 415 190 446 171 183 376 415 700 161 204 176 412 337 314 173 372 188 708 234 466 395 416 183 664 280 163 1026 158 845 200 250 474 629 175 204 464 454 # Relevant 7 41 31 31 370 111 14 19 8 32 117 200 9 175 11 152 1 25 7 2 63 100 24 24 34 13 42 3 79 21 120 7 183 11 113 192 41 28 119 25 12 213 4 83 23 3 263 120 17 0 219 467 194 143 158 139 432 306 133 132 138 159 300 582 132 451 137 382 140 139 144 199 188 220 175 148 160 141 157 183 192 161 180 154 392 141 152 300 178 175 223 180 151 470 152 257 146 178 378 330 147 163 492 700 Topic 19335 47923 87181 87452 100983 104861 130510 131843 146187 148538 156493 168216 182539 183378 207786 264014 287683 359349 405717 423273 443396 451602 489204 490595 527433 573724 833860 855410 915593 962179 966413 1037798 1063750 1103812 1104031 1104492 1106007 1110199 1112341 1113437 1114646 1114819 1115776 1117099 1121402 1121709 1121986 1124210 1129237 1132213 1133167 1134787 Total judged: Final qrels size: Relevant Ratio 0.222 0.520 0.416 0.477 0.812 0.280 0.241 0.149 0.159 0.415 0.399 0.653 0.160 0.448 0.333 0.427 0.016 0.410 0.199 0.005 0.519 0.487 0.560 0.317 0.255 0.239 0.432 0.015 0.366 0.139 0.761 0.234 0.538 0.171 0.927 0.848 0.582 0.224 0.580 0.332 0.337 0.548 0.044 0.457 0.275 0.008 0.928 0.439 0.217 0.098 0.429 0.938 20,157 16,258 # Judged Relevant Ratio 0.036 0.287 0.196 0.223 0.856 0.363 0.105 0.144 0.058 0.201 0.390 0.344 0.068 0.388 0.080 0.398 0.007 0.180 0.049 0.010 0.335 0.455 0.137 0.162 0.212 0.092 0.268 0.016 0.411 0.130 0.667 0.045 0.467 0.078 0.743 0.640 0.230 0.160 0.534 0.139 0.079 0.453 0.026 0.323 0.158 0.017 0.696 0.364 0.116 0.000 0.445 0.667 11,904 9260 16 Leave-Out-Uniques (LOU) tests [Buckley et al., 2007, Zobel, 1998] are a way of analyzing the reusability of a collec- tion. In these tests, the relevant documents retrieved by only one participating team are removed from the qrels files and all runs are then evaluated using the reduced qrels. The reduced qrels are the qrels that would have resulted had the team not participated in the collection building process, and thus their submitted runs represent new runs with respect to the reduced qrels. If the ranking of runs using the reduced qrels is essentially the same as the ranking of runs using the original qrels over all participating teams, then the original collection is likely reusable. The similarity between rankings of runs is usually defined by the Kendall’s τ correlation between the rankings. Kendall’s τ is a measure of association that is proportional to the number of interchanges between adjacent items in one ranking that are required to turn that ranking into the other. τ scores are normalized such that a score of 1 designates perfect agreement, -1 designates rankings that are inverses of one another, and 0 designates rankings that are independent of one another. τ scores can be misleading in the case of system rankings of TREC submissions, however, because usually there are a set of very good runs and a set of very poor runs and each of those run sets always rank in the same order. Thus, in ad- dition to the τ score between the rankings, we also report drops, the largest (negative) difference in ranks experienced by some run [Voorhees, 2018]. A standard LOU test does not work for examining the collections built in the Deep Learning track because the HiCAL process does not depend on runs to provide documents and thus “unique relevant documents” is no longer a well- defined concept. A given team’s unique relevant documents can be removed from the depth-10 pools in the first stage, but then the HiCAL process must activated as it may select the removed documents to be judged in later stages. Since the HiCAL process is not deterministic (ties are broken randomly) and depends on the particular set of documents seen so far, the HiCAL process must be simulated multiple times using the original qrels’ judgments. The simulations proceeded as follows, where the entire process was performed separately for the Document Ranking and Passage Ranking collections. The original depth-10 pools (i.e., top-10 documents from all runs plus MARCO judgments) were fed to the HiCAL process for each of ten trials, where each trial used a separate initial seed for the random number generator. Within each trial, we tracked the documents encountered by HiCAL, creating a trace of the first 2500 documents encountered per topic. Any unjudged documents encountered by HiCAL were treated as not relevant. We created a qrels file from each trace by taking a prefix of the trace of length equal to the number of documents judged in the original qrels per topic. This resulted in 10 qrels files that could have resulted as the official qrels of the track (modulo the unjudged documents would have been judged). While these qrels are not identical to one another nor to the official qrels, they do rank systems very similarly. The leftmost segment of Table 6 shows the τ values and the drops for MAP scores over the set of ten trials3. The top part of the table gives statistics for the Document Ranking task collection and the bottom part for the Passage Ranking task collection. The rightmost segment of Table 6 gives the τ and maximum drop values for the experiments when one participating team is removed from the process. In these experiments, for each team in turn, we created initial pools consisting of the MARCO judged documents plus the top-10 documents from all runs except those runs submitted by the current team. This pool was fed to the HiCAL process for each of ten trials where the random number seed for a given trial was the same as in the all-teams simulation. As before, we created a trace of the documents that were encountered by HiCAL, and created a qrels file by taking a prefix of the trace of length equal to the number of documents judged in the official qrels. All runs were evaluated using this trial qrels, and the ranking induced by it was compared to the ranking induced by the official qrels. The table reports the smallest τ and largest maximum drop observed over all teams for that trial. In general, the ranking of systems is stable, providing support for the contention that the collections are reusable. A more detailed look at the variability in system rankings is given in Figure 9. The figure shows a heat map of the number of times a run was ranked at a given position over all simulation trials (120 trials for the Document Ranking collection and 130 trials for the Passage Ranking task). The ranks are plotted on the x-axis and the runs on the y-axis where they are sorted by their position in the ranking by the official qrels. The darker a plotted point the more times the run was ranked at that position. The figure makes it clear that a large majority of runs have a single dominant rank. When a run does have change ranks, it moves by a modest amount. # 5.2 Per-topic Budgets The qrels created from the simulations for the stability investigation were constructed to contain exactly the same number of judgments per topic as the official qrels contains for fair comparisons. But, of course, no such stopping criterion is available when first building a collection. The trace of documents encountered by HiCAL in the simulations provides a mechanism for exploring the effect of different stopping conditions on the final collection. We construct a qrels by applying a given stopping criterion to a document trace. For these experiments, all 52 topics start the process 3Prec(10) scores are identical over all trials because each trial starts with a depth-10 pool. 17 Table 6: Kendall’s τ and Maximum Drop in ranks observed in simulation trials. Each trial creates a qrels file of the same size as the official qrels, and the ranking of systems induced by that qrels is compared to the ranking induced by the official qrels. Using all team’s runs compared to the original (left columns) shows the effect of the nondeterminism of HiCAL. The remainder of the columns show the effect of omitting one team’s runs from the pools in the first stage. All vs. Official MAP τ 0.9915 0.9829 0.9801 0.9801 0.9829 0.9858 0.9886 0.9829 0.9801 0.9829 Drop 1 2 2 2 2 2 2 2 2 2 Omit Team vs. Official MAP Prec(10) τ 0.9856 0.9856 0.9856 0.9856 0.9827 0.9798 0.9856 0.9827 0.9856 0.9827 τ 0.9573 0.9659 0.9687 0.9687 0.9687 0.9687 0.9687 0.9687 0.9602 0.9659 Drop 3 3 3 3 3 3 3 3 3 3 Drop 5 5 5 5 5 5 5 5 4 5 a) Document Ranking task collection All vs. Official MAP τ 0.9970 0.9910 0.9880 0.9880 0.9880 0.9970 0.9940 0.9880 0.9880 0.9880 Drop 1 2 2 2 2 1 1 2 2 2 Omit Team vs. Official MAP Prec(10) τ 0.9939 0.9939 0.9939 0.9939 0.9939 0.9939 0.9939 0.9939 0.9939 0.9939 τ 0.9820 0.9819 0.9820 0.9820 0.9820 0.9820 0.9849 0.9820 0.9850 0.9820 Drop 2 2 2 2 2 2 2 2 2 2 Drop 2 2 2 2 2 2 2 2 2 2 b) Passage Ranking task collection and each may be included in the final qrels if the stopping criterion allows. Unjudged documents encountered in a simulation are treated as not relevant. The simplest stopping criterion is to simply judge an equal number of documents per topic. Each of the X topics that starts the process gets totalBudget/X judgments, and a topic is included in the final qrels if at least some minimum number of relevant documents (we use 3) is found. The simplicity of this method arises from the fact that topics are independent of one another once the budget is determined, but equal allotment is known to be sub-optimal for finding the maximum possible viable topics since “small” topics will receive as many judgments as “large” topics. An alternative is a strict implementation of the process loosely followed in the track; we call this the Heuristic stopping criterion. In the Heuristic simulation experiments here, we capped the number of judgments any topic can receive at 1000, though that cap was never reached. Table 7 shows the number of judgments required and relative quality of the qrels created from these different stopping criteria for the two collections built in the track. Note that the only judgments available for these collection is from the Official qrels, so a method could never find more relevant than in the Official qrels. The statistics for the Document Ranking task collection are given in the top half of the table and for the Passage Ranking task collection in the bottom half. The statistics for the Official qrels is included in the table for reference. The qrels designated as “Original Size” are the same qrels as in the previous experiments above: pools are built from all runs but ten different trials of the HiCAL process, corresponding to ten different random number seeds, are tested. “Budget 400” and “Budget 500” correspond to a constant per-topic budget of 400 and 500 judgments respectively. The Total Number of Judgments column in the table gives the number of judgments used over all topics that start the process. These judgments must be made to determine whether a topic will be included in the final evaluation set, and 18 # Document Ranking collection, MAP Document Ranking collection, Prec(10) Passage Ranking collection, Prec(10) Passage Ranking collection, MAP Figure 9: Position at which runs ranked over all simulation trials. so must be accounted for in the budgeting process. The Number of Evaluation Topics is the number of topics that are included in the final qrels file based on the criterion’s specification. Original Size qrels always have the same number of judgments as the official qrels by construction, so the qrels built using that method in each trial has the same number of topics as the qrels from all other trials, namely the number of topics in the Official qrels. Constant budget qrels omit a topic only if the minimum number of relevant documents for a topic is not found. While it is possible for qrels created by a constant budget to differ in the number of topics, for the current collections each trial produced a qrels with the same number of topics as the other trials. The Heuristic method omits not only topics with too few relevant documents but topics with too many relevant as well. Again, different trials could lead to different numbers of topics in the qrels, but that did not happen in practice. The Heuristic method is the only method among those tested that can differ in the number of documents judged across trials. For that method, the table reports the mean number of judgments across the ten trials as well as the minimum and maximum number of judgments observed in a trial. The remaining columns in the table give the Kendall’s τ score and maximum drops for the ranking of systems produced by the test qrels as compared to the ranking produced by the Official qrels. As in the experiments above, the value reported is the smallest τ and largest drop observed across the ten trials. The main take-away from the results in Table 7 is that the HiCAL process is very stable across trials and is even robust to differences in stopping conditions within the ranges tested. The primary effect of the different stopping conditions is the inclusion or exclusion of topics affecting mean scores, not differences in individual topic scores. Averaging 19 Table 7: Effect of stopping criteria on qrels quality and number judgments required. Criterion Official Original Size Budget 400 Budget 500 Heuristic # Eval Topics 43 43 50 50 38 MAP τ — 0.9801 0.9316 0.9431 0.9260 Drop — 2 5 3 5 Prec(10) τ — 1.0000 0.9017 0.9017 Drop — 0 8 8 0.9565 2 a) Document Ranking task collection Criterion Official Original Size Budget 400 Budget 500 Heuristic # Eval Topics 43 43 49 49 46 MAP τ — 0.9880 0.9880 0.9880 0.9880 Drop — 2 1 1 1 Prec(10) τ — 1.0000 0.9727 0.9727 Drop — 0 3 3 0.9786 2 b) Passage Ranking task collection effects are the sole explanation for the differences in Prec(10) rankings: since the top-10 pool was always judged in all conditions, the only difference that can arise for a Prec(10) ranking is the change in the mean score when a topic is omitted from the evaluation set. A large majority of the topics omitted by the Heuristic method were eliminated by matching the condition |Relevant| > 0.6|Judged| once sufficiently many documents were judged (i.e., in step 2 above). LOU tests and other simulations are dependent on the results submitted to the track, so it is not possible to say with certainty that a given partially judged collection is reusable. Nonetheless, the current evidence suggests that the collections built in the Deep Learning track are high quality ad hoc collections. # 6 Conclusion The TREC 2019 Deep Learning Track introduced two large training datasets, for a document retrieval task and a passage retrieval task, generating two ad hoc test collections with good reusability. For both tasks, in the presence of large training data, this year’s non-neural network runs were outperformed by neural network runs. Among the neural approaches, the best-performing runs tended to use transfer learning, employing a pretrained language model such as BERT. In future it will be interesting to confirm and extend these results, understanding what mix of data and multi-stage training lead to the best overall performance. We compared reranking approaches to end-to-end retrieval approaches, and in this year’s track there was not a huge difference, with some runs performing well in both regimes. This is another result that would be interesting to track in future years, since we would expect that end-to-end retrieval should perform better if it can recall documents that are unavailable in a reranking subtask. This year there were not many non-neural runs, so it would be important in next year’s track to see more runs of all types, to further understand the relative performance of different approaches. Although this year’s test collections are of high quality, meaning that they are likely to give meaningful results when reused, overfitting can still be a problem if the test set is used multiple times during the development of a new retrieval approach. The most convincing way to show that a new approach is good is to submit TREC runs. There is no chance of overfitting, or any kind of repeated testing, because the test labels are not generated until after the submission deadline. Through a combination of test collection reuse (from past years) and blind evaluation (submitting runs) the Deep Learning Track is offering a framework for studying ad hoc search in the large data regime. 20 # References Nasreen Abdul-Jaleel, James Allan, W Bruce Croft, Fernando Diaz, Leah Larkey, Xiaoyan Li, Mark D Smucker, and Courtney Wade. Umass at trec 2004: Novelty and hard. 2004. Mustafa Abualsaud, Nimesh Ghelani, Haotian Zhang, Mark D Smucker, Gordon V Cormack, and Maura R Gross- man. A system for efficient high-recall retrieval. In The 41st international ACM SIGIR conference on research & development in information retrieval, pages 1317–1320, 2018. Payal Bajaj, Daniel Campos, Nick Craswell, Li Deng, Jianfeng Gao, Xiaodong Liu, Rangan Majumder, Andrew McNamara, Bhaskar Mitra, Tri Nguyen, et al. Ms marco: A human generated machine reading comprehension dataset. arXiv preprint arXiv:1611.09268, 2016. Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013. Leonid Boytsov, David Novak, Yury Malkov, and Eric Nyberg. Off the beaten path: Let’s replace term-based retrieval with k-nn search. In Proceedings of the 25th ACM International on Conference on Information and Knowledge Management, pages 1099–1108. ACM, 2016. Chris Buckley, Darrin Dimmick, Ian Soboroff, and Ellen Voorhees. Bias and the limits of pooling for large collections. Information retrieval, 10(6):491–508, 2007. Gordon V Cormack and Maura R Grossman. Beyond pooling. In The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pages 1169–1172, 2018. Mostafa Dehghani, Hamed Zamani, Aliaksei Severyn, Jaap Kamps, and W Bruce Croft. Neural ranking models with weak supervision. In Proc. SIGIR, pages 65–74. ACM, 2017. Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proc. CVPR, pages 248–255. Ieee, 2009. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional trans- formers for language understanding. arXiv preprint arXiv:1810.04805, 2018. Laura Dietz, Manisha Verma, Filip Radlinski, and Nick Craswell. Trec complex answer retrieval overview. In Pro- ceedings of TREC, 2017. Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. arXiv preprint arXiv:1607.01759, 2016. Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015. Tie-Yan Liu. Learning to rank for information retrieval. Foundation and Trends in Information Retrieval, 3(3):225– 331, March 2009. Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9 (Nov):2579–2605, 2008. Irina Matveeva, Chris Burges, Timo Burkard, Andy Laucius, and Leon Wong. High accuracy retrieval with multiple nested ranker. In Proceedings of the 29th annual international ACM SIGIR conference on Research and development in information retrieval, pages 437–444. ACM, 2006. Bhaskar Mitra and Nick Craswell. An introduction to neural information retrieval. Foundations and Trends®) in Information Retrieval (to appear), 2018. Bhaskar Mitra and Nick Craswell. An updated duet model for passage re-ranking. arXiv preprint arXiv:1903.07666, 2019. Bhaskar Mitra, Fernando Diaz, and Nick Craswell. Learning to match using local and distributed representations of text for web search. In Proc. WWW, pages 1291–1299, 2017. Incorporating query term independence assumption for efficient retrieval and ranking using deep neural networks. arXiv preprint arXiv:1907.03693, 2019. Rodrigo Nogueira, Wei Yang, Jimmy Lin, and Kyunghyun Cho. Document expansion by query prediction. arXiv preprint arXiv:1904.08375, 2019. Stephen Robertson, Hugo Zaragoza, et al. The probabilistic relevance framework: Bm25 and beyond. Foundations and Trends® in Information Retrieval, 3(4):333-389, 2009. Corby Rosset, Damien Jose, Gargi Ghosh, Bhaskar Mitra, and Saurabh Tiwary. Optimizing query evaluations using reinforcement learning for web search. In Proc. SIGIR, pages 1193–1196. ACM, 2018. 21 Trevor Strohman, Donald Metzler, Howard Turtle, and W Bruce Croft. Indri: A language model-based search engine for complex queries. In Proceedings of the International Conference on Intelligent Analysis, volume 2, pages 2–6. Citeseer, 2005. Ellen M Voorhees. On building fair and reusable test collections using bandit techniques. In Proceedings of the 27th ACM International Conference on Information and Knowledge Management, pages 407–416, 2018. Lidan Wang, Jimmy Lin, and Donald Metzler. A cascade ranking model for efficient ranked retrieval. In Proceedings of the 34th international ACM SIGIR conference on Research and development in Information Retrieval, pages 105–114. ACM, 2011. Peilin Yang and Jimmy Lin. Reproducing and generalizing semantic term matching in axiomatic information retrieval. In European Conference on Information Retrieval, pages 369–381. Springer, 2019. Wei Yang, Kuang Lu, Peilin Yang, and Jimmy Lin. Critically examining the “neural hype”: Weak baselines and the additivity of effectiveness gains from neural ranking models. In Proc. SIGIR, pages 1129–1132. ACM, 2019a. Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237, 2019b. Hamed Zamani, Mostafa Dehghani, W Bruce Croft, Erik Learned-Miller, and Jaap Kamps. From neural re-ranking to neural ranking: Learning a sparse representation for inverted indexing. In Proc. CIKM, pages 497–506. ACM, 2018. Zhaohao Zeng and Tetsuya Sakai. Bm25 pseudo relevance feedback using anserini at waseda university. In Proceed- ings The Open-Source IR Replicability Challenge (OSIRRC) Workshop, 2019. Justin Zobel. How reliable are the results of large-scale information retrieval experiments? In Proceedings of the 21st annual international ACM SIGIR conference on Research and development in information retrieval, pages 307–314, 1998. 22
Title: Generalization through Memorization: Nearest Neighbor Language Models: Summary: We introduce $k$NN-LMs, which extend a pre-trained neural language model (LM) by linearly interpolating it with a $k$-nearest neighbors ($k$NN) model. The nearest neighbors are computed according to distance in the pre-trained LM embedding space, and can be drawn from any text collection, including the original LM training data. Applying this augmentation to a strong Wikitext-103 LM, with neighbors drawn from the original training set, our $k$NN-LM achieves a new state-of-the-art perplexity of 15.79 - a 2.9 point improvement with no additional training. We also show that this approach has implications for efficiently scaling up to larger training sets and allows for effective domain adaptation, by simply varying the nearest neighbor datastore, again without further training. Qualitatively, the model is particularly helpful in predicting rare patterns, such as factual knowledge. Together, these results strongly suggest that learning similarity between sequences of text is easier than predicting the next word, and that nearest neighbor search is an effective approach for language modeling in the long tail. at ICLR 2020 # GENERALIZATION THROUGH MEMORIZATION: NEAREST NEIGHBOR LANGUAGE MODELS Urvashi Khandelwal†∗, Omer Levy‡, Dan Jurafsky†, Luke Zettlemoyer‡ & Mike Lewis‡ †Stanford University ‡Facebook AI Research {urvashik,jurafsky}@stanford.edu {omerlevy,lsz,mikelewis}@fb.com # ABSTRACT We introduce kNN-LMs, which extend a pre-trained neural language model (LM) by linearly interpolating it with a k-nearest neighbors (kNN) model. The near- est neighbors are computed according to distance in the pre-trained LM embed- ding space, and can be drawn from any text collection, including the original LM training data. Applying this augmentation to a strong WIKITEXT-103 LM, with neighbors drawn from the original training set, our kNN-LM achieves a new state- of-the-art perplexity of 15.79 – a 2.9 point improvement with no additional train- ing. We also show that this approach has implications for efficiently scaling up to larger training sets and allows for effective domain adaptation, by simply varying the nearest neighbor datastore, again without further training. Qualitatively, the model is particularly helpful in predicting rare patterns, such as factual knowl- edge. Together, these results strongly suggest that learning similarity between se- quences of text is easier than predicting the next word, and that nearest neighbor search is an effective approach for language modeling in the long tail. # INTRODUCTION Neural language models (LMs) typically solve two subproblems: (1) mapping sentence prefixes to fixed-sized representations, and (2) using these representations to predict the next word in the text (Bengio et al., 2003; Mikolov et al., 2010). We present a new language modeling approach that is based on the hypothesis that the representation learning problem may be easier than the prediction problem. For example, any English speaker knows that Dickens is the author of and Dickens wrote will have essentially the same distribution over the next word, even if they do not know what that distribution is. We provide strong evidence that existing language models, similarly, are much better at the first problem, by using their prefix embeddings in a simple nearest neighbor scheme that significantly improves overall performance. We introduce kNN-LM, an approach that extends a pre-trained LM by linearly interpolating its next word distribution with a k-nearest neighbors (kNN) model. The nearest neighbors are computed according to distance in the pre-trained embedding space and can be drawn from any text collec- tion, including the original LM training data. This approach allows rare patterns to be memorized explicitly, rather than implicitly in model parameters. It also improves performance when the same training data is used for learning the prefix representations and the kNN model, strongly suggesting that the prediction problem is more challenging than previously appreciated. To better measure these effects, we conduct an extensive empirical evaluation. Applying our kNN augmentation to a strong WIKITEXT-103 LM using only the original dataset achieves a new state- of-the-art perplexity of 15.79 – a 2.86 point improvement over the base model (Baevski & Auli, 2019) – with no additional training. We also show that the approach has implications for efficiently scaling up to larger training sets and allows for effective domain adaptation, by simply varying the nearest neighbor datastore. Training a model on 100-million tokens and using kNN search over a 3-billion token dataset can outperform training the same model on all 3-billion tokens, opening a ∗Work done while the first author was interning at Facebook AI Research. 1 Published as a conference paper at ICLR 2020 Training Contexts | Targets |{ Representations Distances Nearest k Normalization ‘Aggregation Ci v; ki = S(ci) 4; = d(q,ki) (ki) & exp(—d;) Pasxlv) = Yo lyme Obama was senator for| Iinois >| 4 Hawaii|3 || Hawaii|o.7 Hawaii|0.8 Barack is married to | Michelle | 100 Da Illinois|4 |—>| Illinois |0.2 A Mlinois | 0.2 Obama was born in| Hawaii @oom | 5 Hawaii|5 |-™| — Hawaii|0.1 Obama is a native of | Hawaii @@O@D || 3 Classification Interpolation PLM) lo(u) = APiaa()+(0— Yer, Test Context Target || Representation 7 a= f(z) Hawaii |0.2 Hawaii | 0.6 Mlinois |0.2. }——>} Minois |0.2 Obama's birthplace is 2 @Ooc® Figure 1: An illustration of kNN-LM. A datastore is constructed with an entry for each training set token, and an encoding of its leftward context. For inference, a test context is encoded, and the k most similar training contexts are retrieved from the datastore, along with the corresponding targets. A distribution over targets is computed based on the distance of the corresponding context from the test context. This distribution is then interpolated with the original model’s output distribution. new path for efficiently using large datasets in language models. Similarly, adding out-of-domain data to the datastore makes a single LM useful across multiple domains, again without further train- ing. Qualitatively, we find the model is particularly helpful for long-tail patterns, such as factual knowledge, which might be easier to access via explicit memory. # 2 NEAREST NEIGHBOR LANGUAGE MODELING Language models (LMs) assign probabilities to sequences. Given a context sequence of tokens ct = (w1, . . . wt−1), autoregressive LMs estimate p(wt|ct), the distribution over the target token wt. The kNN-LM involves augmenting such a pre-trained LM with a nearest neighbors retrieval mech- anism, without any additional training (the representations learned by the LM remain unchanged). This can be done with a single forward pass over a text collection (potentially including the original LM training set), where the resulting context-target pairs are stored in a key-value datastore that is queried during inference, as illustrated in Figure 1. Datastore Let f (·) be the function that maps a context c to a fixed-length vector representation computed by the pre-trained LM. For instance, in a Transformer LM, f (c) could map c to an inter- mediate representation that is output by an arbitrary self-attention layer. Then, given the i-th training example (ci, wi) ∈ D, we define the key-value pair (ki, vi), where the key ki is the vector represen- tation of the context f (ci) and the value vi is the target word wi. The datastore (K, V) is thus the set of all key-value pairs constructed from all the training examples in D: (K, V) = {(f (ci), wi)|(ci, wi) ∈ D} (1) Inference At test time, given the input context x the model generates the output distribution over next words pLM(y|x) and the context representation f (x). The model queries the datastore with f (x) to retrieve its k-nearest neighbors N according to a distance function d(·, ·) (squared L2 distance in our experiments, making the similarity function an RBF kernel).Then, it computes a distribution over neighbors based on a softmax of their negative distances, while aggregating probability mass for each vocabulary item across all its occurrences in the retrieved targets (items that do not appear in the retrieved targets have zero probability): Penn (y|x) x > Ly=v; exp(—d(ki, f(x))) (2) (Kiva )EN Finally, we follow Grave et al. (2017a) and interpolate the nearest neighbor distribution pkNN with the model distribution pLM using a tuned parameter λ to produce the final kNN-LM distribution: p(y|x) = λ pkNN(y|x) + (1 − λ) pLM(y|x) (3) 2 Published as a conference paper at ICLR 2020 Implementation The datastore contains an entry for each target in the training set, which for LMs can be up to billions of examples. To search over this large datastore, we use FAISS (Johnson et al., 2017), an open source library for fast nearest neighbor retrieval in high dimensional spaces. FAISS speeds up search by clustering the keys and looking up neighbors based on the cluster centroids, while reducing memory usage by storing compressed versions of the vectors. We found in pre- liminary experiments that using L2 distance for FAISS retrieval results in better performance for kNN-LM, compared to inner product distance. Related Cache Models Prior work (Grave et al., 2017c; Merity et al., 2017) used a similar ap- proach to compute similarity to the previous hidden states of test documents, making it easier to copy rare vocabulary items from the recent past. Such techniques have been less popular since the development of Transformers (Vaswani et al., 2017), which can learn to copy recent words using self-attention; in Section 4.1, we observe relatively small gains from caching recent items in the same test document `a la Grave et al. (2017c). Most relatedly, Grave et al. (2017a) describe an online language model using nearest neighbor search over all previous hidden states, to improve domain adaptation. In our work, we only save training data, with the goal of explicitly memorizing training examples to better generalize to similar cases at test time. # 3 EXPERIMENTAL SETUP Data Experiments in this paper use the following English corpora: WIKITEXT-103 is a standard benchmark by Merity et al. (2017) for autoregressive language mod- eling with a 250K word-level vocabulary. It consists of 103M tokens of Wikipedia in the training set and 250K tokens in each of the development and test sets. BOOKS is the Toronto Books Corpus (Zhu et al., 2015), containing 0.7B. Complete books are held out for validation/test. WIKI-3B is English Wikipedia, containing about 2.87B tokens. Whole articles are held out for validation/test. WIKI-100M is a random 100M token subset of WIKI-3B, consisting of complete articles. Except for WIKITEXT-103, text is tokenized using the byte-pair encoding (Sennrich et al., 2015) with the 29K subword vocabulary from BERT (Devlin et al., 2019). Model Architecture kNN-LM is compatible with any model that produces fixed size context representations. We use decoder-only Transformers (Vaswani et al., 2017) for language modeling, which are the current state of the art. Since the kNN-LM makes no changes to the underlying LM, we take the exact architecture and optimization described by Baevski & Auli (2019) and use it to create a kNN-LM for inference. This model consists of 16 layers, each with 16 self-attention heads, 1024 dimensional hidden states, and 4096 dimensional feedforward layers, amounting to 247M trainable parameters. It processes 3072 tokens of context per example for WIKITEXT-103 and 1024 tokens for the rest of the corpora. Following Baevski & Auli (2019), we use adaptive inputs and an adaptive softmax (Grave et al., 2017b) with tied weights (Press & Wolf, 2017) for the WIKITEXT-103 experiments. On other datasets we do not use adaptive inputs or an adaptive softmax. Evaluation LMs are trained to minimize the negative log-likelihood of the training corpus, and evaluated by perplexity (exponentiated negative log-likelihood) on held out data. Following Baevski & Auli (2019), 512 tokens are scored per test example, but up to 2560 tokens of extra prior context is provided for WIKITEXT-103 and up to 512 tokens of extra prior context is provided for the rest of the corpora. kNN-LM The keys used for kNN-LM are the 1024-dimensional representations fed to the feed- forward network in the final layer of the Transformer LM (after self-attention and layernorm; see Section 5 for further explanation). We perform a single forward pass over the training set with the trained model, in order to save the keys and values. During this forward pass, each target token is provided a minimum of 1536 tokens of prior context for WIKITEXT-103 and a minimum of 512 3 Published as a conference paper at ICLR 2020 Model Perplexity (↓) Dev Test Baevski & Auli (2019) +Transformer-XL (Dai et al., 2019) +Phrase Induction (Luo et al., 2019) 17.96 - - 18.65 18.30 17.40 247M 257M 257M Base LM (Baevski & Auli, 2019) +kNN-LM 17.96 16.06 18.65 16.12 247M 247M +Continuous Cache (Grave et al., 2017c) +kNN-LM + Continuous Cache 17.67 15.81 18.27 15.79 247M 247M Table 1: Performance on WIKITEXT-103. The kNN-LM substantially outperforms existing work. Gains are additive with the related but orthogonal continuous cache, allowing us to improve the base model by almost 3 perplexity points with no additional training. We report the median of three random seeds. Model Perplexity (↓) # Trainable Params Dev Test Base LM (Baevski & Auli, 2019) +kNN-LM 14.75 14.20 11.89 10.89 247M 247M Table 2: Performance on BOOKS, showing that kNN-LM works well in multiple domains. tokens for the rest of the corpora. A FAISS index is then created using 1M randomly sampled keys to learn 4096 cluster centroids. For efficiency, keys are quantized to 64-bytes. During inference, we retrieve k = 1024 neighbors, and the index looks up 32 cluster centroids while searching for the nearest neighbors. For WIKITEXT-103 experiments, we compute squared L2 distances with full precision keys, but for the other datasets we use the FAISS L2 distances (not squared) between quantized keys directly, for faster evaluation. We tune the interpolation parameter λ on the validation set.1 Computational Cost Although the kNN-LM requires no training given an existing LM, it does add some other computational overheads. Storing the keys and values requires a single forward pass over the training set, which amounts to a fraction of the cost of training for one epoch on the same examples. Once the keys are saved, for WIKITEXT-103 building the cache with 103M entries takes roughly two hours on a single CPU. Finally, running on the validation set took approximately 25 minutes when retrieving 1024 keys. While the cost of building a large cache grows linearly in the number of entries, it is trivial to parallelize and requires no GPU-based training. # 4 EXPERIMENTS 4.1 USING THE TRAINING DATA AS THE DATASTORE We first experiment with creating a datastore from the same data used to train the LM. Table 1 shows that kNN-LM improves perplexity on WIKITEXT-103 from 18.65 (Baevski & Auli, 2019) to a new state-of-the-art of 16.12. We also provide reported perplexities from two other recent models that also build upon Baevski and Auli’s, suggesting that further improvements may be possible by aug- menting the kNN-LM with these techniques. We compare with models trained only on the standard training set, but recent work has shown performance can be improved by training on additional data, from either the test set (Krause et al., 2019) or large amounts of web text (Shoeybi et al., 2019). We also experiment with a continuous cache model, a related but orthogonal technique from Grave et al. (2017c), in which the model saves and retrieves neighbors from earlier in the test document, 1Code is available at: https://github.com/urvashik/knnlm 4 Published as a conference paper at ICLR 2020 Training Data Datastore Perplexity (↓) Dev Test WIKI-3B WIKI-100M - - 16.11 20.99 15.17 19.59 WIKI-100M WIKI-3B 14.61 13.73 Table 3: Experimental results on WIKI-3B. The model trained on 100M tokens is augmented with a datastore that contains about 3B training examples, outperforming the vanilla LM trained on the entire WIKI-3B training set. (a) Effect of datastore size on perplexities. (b) Tuned values of λ for different datastore sizes. Figure 2: Varying the size of the datastore. (a) Increasing the datastore size monotonically improves performance, and has not saturated even at about 3B tokens. A kNN-LM trained on 100M tokens with a datastore of 1.6B tokens already outperforms the LM trained on all 3B tokens. (b) The optimal value of λ increases with the size of the datastore. rather than the training set. Gains from interpolating with the continuous cache are smaller than reported in the original setting that used LSTMs, perhaps because self-attentive language models can learn to perform such queries. Improvements from the continous cache are additive with the kNN-LM, pushing our state-of-the-art result to 15.79, a gain of 2.86 over the base model. Finally, we repeat the experiment using text from a different domain, BOOKS, to control for the possibility that encyclopedic Wikipedia text is somehow uniquely good for caching. Table 2 shows an improvement in test set perplexity from 11.89 to 10.89, suggesting that this is not the case. 4.2 MORE DATA WITHOUT TRAINING Section 4.1 has shown that retrieving neighbors from the training data can significantly improve language modeling performance. This raises the question: can retrieving nearest neighbors from data be a substitute for training on it? To test this, we train a LM on WIKI-100M and use it to build a datastore from WIKI-3B, a corpus 30 times larger than the training set. We then compare this kNN-LM to a vanilla LM trained on the entire WIKI-3B corpus.2 Table 3 shows that, as expected, the model trained on 3B tokens dramatically outperforms the model trained on 100M tokens, improving perplexity from 19.59 to 15.17. However, adding nearest neigh- bors retrieval over those 3B examples to the model trained on 100M tokens improves perplexity from 19.59 to 13.73; i.e. retrieving nearest neighbors from the corpus outperforms training on it. This result suggests that rather than training language models on ever larger datasets, we can use smaller datasets to learn representations and augment them with kNN-LM over a large corpus. 2The original LM (Baevski & Auli, 2019) was trained for 286K steps on a corpus of similar size to WIKI- 100M. When scaling up to WIKI-3B, we tuned only the number of updates on the validation set and found that training for 572K steps (double) produces a slightly stronger baseline. 5 Published as a conference paper at ICLR 2020 Training Data Datastore Perplexity (↓) Dev Test WIKI-3B BOOKS - - 37.13 14.75 34.84 11.89 WIKI-3B BOOKS 24.85 20.47 Table 4: Domain adaptation experiments, with results on BOOKS. Adding an in-domain datastore to a Wikipedia-trained model improves results by 23 points, approaching in-domain training. d (ead Forma Naw) Multi Headed Self Attention # Figure 3: Transformer LM layer. Key Type Dev ppl. (↓) No datastore Model output Model output layer normalized FFN input after layer norm FFN input before layer norm MHSA input after layer norm MHSA input before layer norm 17.96 17.07 17.01 16.06 17.06 16.76 17.14 Table 5: WIKITEXT-103 validation results using dif- ferent states from the final layer of the LM as the rep- resentation function f (·) for keys and queries. We re- trieve k=1024 neighbors and λ is tuned for each. To understand how the amount of data used for kNN retrieval affects performance, we use the WIKI- 100M model to create datastores using different amounts of randomly sampled data from WIKI-3B. Figure 2a shows that using only 1.6B examples for the datastore already surpasses the performance of the model trained on all of WIKI-3B. In addition, performance does not saturate at 3B examples in the datastore, suggesting that growing the datastore more could lead to further gains. Figure 2b shows the model relies more on the kNN component as the size of the datastore increases. 4.3 DOMAIN ADAPTATION We also experiment with domain adaptation by creating a datastore on the target domain training set. Table 4 shows that an in-domain LM on BOOKS has a relatively low perplexity (11.89), while a model trained on WIKI-3B performs poorly on the BOOKS domain (34.84 perplexity). Adding kNN search over BOOKS to the WIKI-3B model reduces perplexity by 14 points (to 20.47), demonstrating that kNN-LM allows a single model to be useful in multiple domains, by simply adding a datastore per domain. # 5 TUNING NEAREST NEIGHBOR SEARCH While the kNN-LM is conceptually straightforward, and requires no additional training, a number of hyperparameters are introduced for nearest neighbor search. We experiment with different choices here. Key Function For similarity search, we extract a representation of context c using an intermediate state of the LM f (c). Transformers compute a number of different intermediate states, and we com- pare several choices depicted in Figure 3, with results shown in Table 5. While all the instantiations of f we tried are helpful, we achieved the largest improvement by using the input to the final layer’s feedforward network. We also observe that normalized representations (i.e. taken immediately af- ter the layer norm) perform better. Repeating the experiment on the second-last transformer layer showed similar trends with slightly worse results (not shown), suggesting that the feedforward layer might be focusing more on the prediction problem, while the onus of representing the input falls more on the self-attention layer. 6 Published as a conference paper at ICLR 2020 Se Books (In-domain) Wiki-3B + Books Datastore I 176 4 KNIN-LM on Wikitext-103 1s- a (Domain Adaptation) 36 Domain Adaptation Perplexity 0.0 02 o4 0.6 0.8 interpolation parameter) 1 2 8 64 256 = 1024 k (# nearest neighbors) Figure 4: Effect of the number of nearest neigh- bors returned per word on WIKITEXT-103 (val- idation set). Returning more entries from the datastore monotonically improves performance. Figure 5: Effect of interpolation parameter λ on in-domain (left y-axis) and out-of-domain (right y-axis) validation set performances. More weight on pkN N improves domain adaptation. Number of Neighbors per Query Each query returns the top-k neighbors. Figure 4 shows that performance monotonically improves as more neighbors are returned, and suggests that even larger improvements may be possible with a higher value of k. Nonetheless, even a small number of neighbors (k = 8) is enough to achieve a new state of the art. Interpolation Parameter We use a parameter λ to interpolate between the base model distribution and the distribution from kNN search over the dataset. Figure 5 shows that λ = 0.25 is optimal on WIKITEXT-103. However, λ = 0.65 works best for domain adaptation results (Figure 5). Precision of Similarity Function In FAISS, the nearest neighbor search computes L2 distances against quantized keys. We found results were improved from 16.5 perplexity on WIKITEXT-103 to 16.06 by computing squared L2 distances with full precision keys for Equation 2. # 6 ANALYSIS Qualitative Analysis To understand why kNN-LM improves performance, we manually examine cases in which pkNN was significantly better than pLM. Table 6 shows one such example, along with several others in Appendix A. The example shows an interesting case where the model matches the trigram impact on the in several retrieved neighbors, but puts almost all weight on the most relevant neighbor, thus adding more value than an n-gram LM. In general, we find that examples where kNN-LM is most helpful typically contain rare patterns. Examples include factual knowledge, names, and near-duplicate sentences from the training set. In these cases, assigning train and test instances similar representations (via f (·)) appears to be an easier problem than implicitly memorizing the next word in model parameters. Simple vs Neural Representation We observe that many long-tail phenomena manifest as rare n-grams (e.g. names). Is it therefore possible to interpolate an n-gram model with a Transformer LM, as an alternative to our kNN approach? Figure 7 shows little improvement from using n-gram LMs – 0.2 perplexity points (similarly to Bakhtin et al. (2018)). This result highlights the need to use the learned representation function f (·) to measure similarity between more varied contexts. If a neural representation function is crucial for kNN-LM, could Implicit vs Explicit Memory implicitly memorizing the training dataset in the neural network parameters replace the explicit memory in the datastore? To test this, we train a Transformer LM with no dropout. Figure 8 shows that this model eventually reaches zero training loss, indicating that it can make perfect predictions for all examples in the training set; the model has memorized the dataset. Naturally, the memorizing LM overfits, i.e. the training loss drops to 0 while the best validation perplexity is much higher at 28.59. For comparison, the vanilla Transformer LM (with dropout) has a much higher training loss (shown in Figure 8), but also generalizes better with a validation perplexity of 17.96. This result shows that the Transformer has sufficient capacity to memorize the training set. 7 Published as a conference paper at ICLR 2020 Test Context (pkNN = 0.998, pLM = 0.124) Test Target it was organised by New Zealand international player Joseph Warbrick, promoted by civil servant Thomas Eyton, and managed by James Scott, a publican. The Natives were the first New Zealand team to perform a haka, and also the first to wear all black. They played 107 rugby matches during the tour, as well as a small number of Victorian Rules football and associ- ation football matches in Australia. Having made a significant impact on the... development # Training Set Context # Training Set Target # Context Probability As the captain and instigator of the 1888-89 Natives – the first New Zealand team to tour the British Isles – Warbrick had a lasting impact on the... # development # development 0.998 promoted to a new first grade competition which started in 1900. Glebe immediately made a big impact on the... # district 0.00012 centuries, few were as large as other players managed. However, others contend that his impact on the... # game 0.000034 Nearly every game in the main series has either an anime or manga adap- tation, or both. The series has had a significant impact on the... development 0.00000092 Figure 6: Example where the kNN model has much higher confidence in the correct target than the LM. Although there are other training set examples with similar local n-gram matches, the nearest neighbour search is highly confident of specific and very relevant context. 18.00 I 17.75 17.50 17.25 = Wikitext-103 LM + n-gram LM === KNN-LM on Wikitext-103 Training loss (base e) 3 With Dropout —4- Without Dropout 0 25 50 1 (size of n-gram) 75 100 Epoch 125 150 175 200 # Perplexity Figure 7: Interpolating the Transformer LM with n-gram LMs on WIKITEXT-103 (validation set). Using kNN-LM gives a much lower perplexity, suggesting that the representations are learning more than just matching local context. Figure 8: Training curves for the Transformer Turning off LM with and without dropout. dropout allows the training loss to go to 0, in- dicating that the model has sufficient capacity to memorize the training data. We consider whether the memorizing LM can be an effective substitute for nearest neighbor search. Interpolating the memorizing LM with the original LM improves validation perplexity by just 0.1 – compared to 1.9 from kNN-LM. This result suggests that although the Transformer is expressive enough to memorize all training examples, learning to do so does not result in context representations that generalize. In contrast, kNN-LM memorizes training data while improving generalization. From these experiments, we conjecture that kNN-LM improves performance because (1) the Trans- former LM is very good at learning a representation function for contexts with an implicit notion of similarity, and (2) while the Transformer has capacity to memorize all training examples, doing so causes its representation to generalize less effectively, but (3) the kNN-LM allows the model to memorize the training data while retaining an effective similarity function. 8 Published as a conference paper at ICLR 2020 # 7 RELATED WORK We discuss related uses of caches for language modeling in Section 2. Similar kNN models to ours have been proposed for computer vision tasks (Papernot & McDaniel, 2018; Orhan, 2018; Zhao & Cho, 2018), primarily motivated by improving interpretability and ro- bustness to adversarial attacks. We hypothesize that our method may be particularly effective for language modeling, because plentiful unlabeled data allows datastores of billions of tokens, and language modeling often requires world knowledge to be learnt from few examples. Nearest neighbor models have been applied to a number of NLP problems in the past, such as part of speech tagging (Daelemans et al., 1996) and morphological analysis (Bosch et al., 2007), but the use of learned representations makes the similarity function much more effective in the case of neural models. More recently, Kaiser et al. (2017) have used a similarly differentiable memory that is learned and updated during training, and is applied to one-shot learning tasks. Several models have also improved language generation by using training examples directly at test time. Guu et al. (2018) propose a model that samples training sentences at random and edits them with a sequence-to-sequence model, but does not use a retrieval mechanism such as kNN. Gu et al. (2018) introduce a translation model that attends over retrieved training set examples. Weston et al. (2018) improve a dialogue response generation model by refining similar instances from the training set. kNN-LM differs from these approaches by working at the level of individual tokens instead of whole training sentences, as well as not incorporating the retrieval mechanism into the training pipeline. A general trend in machine learning, and in language modeling in particular, is that adding more data consistently improves performance (Devlin et al., 2019; Radford et al., 2019; Yang et al., 2019; Liu et al., 2019; Zellers et al., 2019; Shoeybi et al., 2019). Our work offers an alternative method for scaling language models, in which relatively small models learn context representations, and a nearest neighbour search acts as a highly expressive classifier. # 8 CONCLUSION AND FUTURE WORK We have introduced kNN-LMs, which can significantly outperform standard language models by directly querying training examples at test time. The approach can be applied to any neural language model. The success of this method suggests that learning similarity functions between contexts may be an easier problem than predicting the next word from some given context. Future work should explore explicitly training similarity functions, and reducing the size of the datastore. ACKNOWLEDGMENTS The authors thank the anonymous reviewers as well as Sida Wang, Kartikay Khandelwal, Kevin Clark and members of the FAIR Seattle team for helpful discussions and comments. REFERENCES Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. In ICLR, 2019. Anton Bakhtin, Arthur Szlam, Marc’Aurelio Ranzato, and Edouard Grave. Lightweight adaptive mixture of neural and n-gram language models. arXiv preprint arXiv:1804.07705, 2018. Yoshua Bengio, R´ejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic language model. Journal of machine learning research, 3(Feb):1137–1155, 2003. Antal van den Bosch, Bertjan Busser, Sander Canisius, and Walter Daelemans. An efficient memory- based morphosyntactic tagger and parser for dutch. LOT Occasional Series, 7:191–206, 2007. Walter Daelemans, Jakub Zavrel, Peter Berck, and Steven Gillis. Mbt: A memory-based part of speech tagger-generator. In WVLC, 1996. 9 Published as a conference paper at ICLR 2020 Zihang Dai, Zhilin Yang, Yiming Yang, William W Cohen, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL, 2019. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019. Edouard Grave, Moustapha M Cisse, and Armand Joulin. Unbounded cache model for online lan- guage modeling with open vocabulary. In NIPS, pp. 6042–6052, 2017a. Edouard Grave, Armand Joulin, Moustapha Ciss´e, Herv´e J´egou, et al. Efficient softmax approxima- tion for gpus. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1302–1310. JMLR. org, 2017b. Edouard Grave, Armand Joulin, and Nicolas Usunier. Improving neural language models with a continuous cache. In ICLR, 2017c. Jiatao Gu, Yong Wang, Kyunghyun Cho, and Victor OK Li. Search engine guided neural machine translation. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018. Kelvin Guu, Tatsunori B Hashimoto, Yonatan Oren, and Percy Liang. Generating sentences by editing prototypes. Transactions of the Association for Computational Linguistics, 6:437–450, 2018. Jeff Johnson, Matthijs Douze, and Herv´e J´egou. Billion-scale similarity search with gpus. arXiv preprint arXiv:1702.08734, 2017. Łukasz Kaiser, Ofir Nachum, Aurko Roy, and Samy Bengio. Learning to remember rare events. In ICLR, 2017. Ben Krause, Emmanuel Kahembwe, Iain Murray, and Steve Renals. Dynamic evaluation of trans- former language models. arXiv preprint arXiv:1904.08378, 2019. Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. Hongyin Luo, Lan Jiang, Yonatan Belinkov, and James Glass. Improving neural language models by segmenting, attending, and predicting the future. In ACL, 2019. Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. ICLR, 2017. Tom´aˇs Mikolov, Martin Karafi´at, Luk´aˇs Burget, Jan ˇCernock`y, and Sanjeev Khudanpur. Recurrent neural network based language model. In Eleventh annual conference of the international speech communication association, 2010. A. Emin Orhan. A simple cache model for image recognition. In NeurIPS, 2018. Nicolas Papernot and Patrick McDaniel. Deep k-nearest neighbors: Towards confident, interpretable and robust deep learning. arXiv preprint arXiv:1803.04765, 2018. Ofir Press and Lior Wolf. Using the output embedding to improve language models. In ICLR, 2017. Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. URL https://d4mucfpksywv.cloudfront.net/better- language-models/language-models.pdf, 2019. Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015. Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using gpu model parallelism. arXiv preprint arXiv:1909.08053, 2019. 10 Published as a conference paper at ICLR 2020 Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017. Jason Weston, Emily Dinan, and Alexander H Miller. Retrieve and refine: Improved sequence generation models for dialogue. arXiv preprint arXiv:1808.04776, 2018. Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237, 2019. Rowan Zellers, Ari Holtzman, Hannah Rashkin, Ali Farhadi, Franziska Roesner, and Yejin Choi. Defending against neural fake news. In NeurIPS, 2019. Jake Zhao and Kyunghyun Cho. Retrieval-augmented convolutional neural networks for improved robustness against adversarial examples. arXiv preprint arXiv:1802.09502, 2018. Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching In Proceedings of the IEEE international conference on computer movies and reading books. vision, pp. 19–27, 2015. 11 Published as a conference paper at ICLR 2020 # A APPENDIX This section provides several examples where pkNN places higher probability mass on the true target, compared to pLM. Test Context (pkNN = 0.995, pLM = 0.025) Test Target For Australians and New Zealanders the Gallipoli campaign came to sym- bolise an important milestone in the emergence of both nations as indepen- dent actors on the world stage and the development of a sense of national identity. Today, the date of the initial landings, 25 April, is known as An- zac Day in Australia and New Zealand and every year thousands of people gather at memorials in both nations, as well as Turkey, to... honour Training Set Context Training Set Target Context Probability Despite this, for Australians and New Zealanders the Gallipoli campaign has come to symbolise an important milestone in the emergence of both nations as independent actors on the world stage and the development of a sense of national identity. Today, the date of the initial landings, 25 April, is a public holiday known as Anzac Day in Australia and New Zealand and every year thousands of people gather at memorials in both nations, and indeed in Turkey, to ... honour 0.995 On the anniversary date of his death, every year since 1997, thousands of people gather at his home in Memphis to... celebrate 0.0086 Twenty-five years after Marseille’s death, fighter pilot veterans of World War II gathered to... honour 0.0000041 Table 6: Another example where the kNN model places much higher probability mass on the correct target, compared to the LM. The nearest neighbors search has retrieved a training set context that is extremely similar to the test context, while very rare and in the long-tail of patterns. Test Context (pkNN = 0.959, pLM = 0.503) Test Target U2 do what they’re best at, slipping into epic rock mode, playing music made for the arena”. In two other local newspaper reviews, critics praised the song’s inclusion in a sequence of greatest hits. For the PopMart Tour of 1997–... 1998 Training Set Context Training Set Target Context Probability Following their original intent, ”Sunday Bloody Sunday” was not played during any of the forty-seven shows on the Lovetown Tour in 1989. The song reappeared for a brief period during the Zoo TV Tour, and late during the second half of PopMart Tour (1997–... 1998 0.936 They are 6 times Champions and they won the Challenge Cup in 1938, and have experienced two previous stretches in the Super League, 1997–... 2002 0.0071 About $40 million ($61.4 million in 2018 dollars) was spent on the property acquisition. After weather-related construction delays due to the El Nino season of the winter of 1997–... 1998 0.0015 This made it the highest-rated season of The X-Files to air as well as the highest rated Fox program for the 1997–... 98 0.00000048 Table 7: In this example, the desired date pattern appears in many examples. Yet, the nearest neighbors search is able to identify the only training set context which is relevant to the test context and assigns it the highest probability mass. 12 Published as a conference paper at ICLR 2020 Test Context (pkNN = 0.624, pLM = 0.167) Test Target Lord Strathcona awarded Gauthier a scholarship in 1906 that allowed her to return to Europe and continue her vocal studies. She returned there and continued both to study and give performances. Her first operatic perfor- mance came in 1909 in Pavia, Italy as Micaela in Bizet’s... Carmen Training Set Context Training Set Target Context Probability Despite poor relations with the orchestra, Mahler brought five new operas to the theatre, including Bizet’s... Carmen 0.356 The fourth movement of An die Jugend (1909), for instance, uses two of Niccolo Paganini’s Caprices for solo violin (numbers 11 and 15), while the 1920 piece Piano Sonatina No. 6 (Fantasia da camera super Carmen) is based on themes from Georges Bizet’s... opera 0.0937 It also hosted the Ballet of her Majesty’s Theatre in the mid-19th century, before returning to hosting the London premieres of such operas as Bizet’s... Carmen 0.0686 Table 8: In this case, the model is able to memorize the fact that Georges Bizet wrote Carmen. # Test Context (pkNN = 0.031, pLM = 0.007) # Test Target Mycena maculata bears some resemblance to M. <unk>, but is only as- sociated with decaying hardwood logs and stumps, and is found in eastern North America, and sometimes on oak on the West Coast. In age, it... # develops Training Set Context Training Set Target Context Probability Morchella tridentina (=Morchella frustrata) is also rufescent and very sim- ilar to M. rufobrunnea. It is found in mountainous forests and maquis and forms a marked sinus at the attachment of the cap with the stem, which is pure white. At maturity, it... develops 0.031 The winter bonnet (M. tintinnabulum) is a northern European species that is much smaller (cap diameter up to 2.6 cm (1.0 in) across) and has a brown cap, and has ragged hairs at the base. It... generally 0.029 The ”bleeding” will distinguish Mycena atkinsoniana from most other Mycena species commonly encountered. The common and widely dis- tributed M. sanguinolenta is another ”bleeder”, but it is smaller than M. atkinsonia, with a cap diameter ranging from 3 to 15 mm (0.1 to 0.6 in). Additionally, it... has 0.028 Mycena flavoalba bears resemblance to some members of Hemimycena, such as H. lactea and H. <unk>. It... the genus can 0.018 Table 9: This is an example where the pkNN distribution is relatively flat, as several words are plausible continuations. However, the nearest neighbors search assigns the highest probability to In contrast, the LM the correct target and a corresponding context that is particularly relevant. probability on the correct target is lower. 13
Title: Tool Documentation Enables Zero-Shot Tool-Usage with Large Language Models: Summary: Today, large language models (LLMs) are taught to use new tools by providing a few demonstrations of the tool's usage. Unfortunately, demonstrations are hard to acquire, and can result in undesirable biased usage if the wrong demonstration is chosen. Even in the rare scenario that demonstrations are readily available, there is no principled selection protocol to determine how many and which ones to provide. As tasks grow more complex, the selection search grows combinatorially and invariably becomes intractable. Our work provides an alternative to demonstrations: tool documentation. We advocate the use of tool documentation, descriptions for the individual tool usage, over demonstrations. We substantiate our claim through three main empirical findings on 6 tasks across both vision and language modalities. First, on existing benchmarks, zero-shot prompts with only tool documentation are sufficient for eliciting proper tool usage, achieving performance on par with few-shot prompts. Second, on a newly collected realistic tool-use dataset with hundreds of available tool APIs, we show that tool documentation is significantly more valuable than demonstrations, with zero-shot documentation significantly outperforming few-shot without documentation. Third, we highlight the benefits of tool documentations by tackling image generation and video tracking using just-released unseen state-of-the-art models as tools. Finally, we highlight the possibility of using tool documentation to automatically enable new applications: by using nothing more than the documentation of GroundingDino, Stable Diffusion, XMem, and SAM, LLMs can re-invent the functionalities of the just-released Grounded-SAM and Track Anything models. # Tool Documentation Enables Zero-Shot Tool-Usage with Large Language Models Cheng-Yu Hsieh1†, Si-An Chen2†, Chun-Liang Li3, Yasuhisa Fujii4, Alexander Ratner1, Chen-Yu Lee3, Ranjay Krishna1∗, Tomas Pfister3∗ 1University of Washington, 2National Taiwan University, 3Google Cloud AI Research, 4Google Research cydhsieh@cs.washington.edu # Abstract Today, large language models (LLMs) are taught to use new tools by providing a few demonstrations of the tool’s usage. Unfortunately, demonstrations are hard to acquire, and can result in undesirable biased usage if the wrong demonstration is chosen. Even in the rare scenario that demonstrations are readily available, there is no principled selection protocol to determine how many and which ones to provide. As tasks grow more complex, the selection search grows combinatorially and in- variably becomes intractable. Our work provides an alternative to demonstrations: tool documentation. We advocate the use of tool documentation—descriptions for the individual tool usage—over demonstrations. We substantiate our claim through three main empirical findings on 6 tasks across both vision and language modalities. First, on existing benchmarks, zero-shot prompts with only tool documentation are sufficient for eliciting proper tool usage, achieving performance on par with few-shot prompts. Second, on a newly collected realistic tool-use dataset with hundreds of available tool APIs, we show that tool documentation is significantly more valuable than demonstrations, with zero-shot documentation significantly outperforming few-shot without documentation. Third, we highlight the benefits of tool documentations by tackling image generation and video tracking using just-released unseen state-of-the-art models as tools. Finally, we highlight the possibility of using tool documentation to automatically enable new applications: by using nothing more than the documentation of GroundingDino, Stable Diffu- sion, XMem, and SAM, LLMs can re-invent the functionalities of the just-released Grounded-SAM [23] and Track Anything [70] models. # Introduction Today, large language models (LLMs) summon the imagery of a craftsman: when asked to solve a complex task, they decompose the task into simpler sub-tasks and assemble the best possible tools to tackle each sub-task [51, 72]. For example, consider the complex task of question answering given the image in Figure 1. To answer “whether the two magnets will attract or repel each other”, the LLM needs the following: it needs to identify the positions of the magnets in the image, extract general knowledge explaining that “opposite (same) poles attract (repel)”. Just like a competent craftsman who knows what their tools are capable of, an LLM with such knowledge of its tools will be able to invoke one tool (e.g. its Text Detector) to identify the north and south poles and a second tool (e.g. Knowledge Retriever) to extract pertinent background knowledge about magnetic forces. But how does an LLM know which tool is capable of what? †Work done as student researchers at Google Cloud AI Research. *The authors contributed equally to this work. Preprint. Under review. Input Plan Question: Will these magnets attract or Text Detector | “S": (6, 12] repel each other? ry 54, 14] s N s N Large Language “N" eee % Choices: [repel, attract] Model | 1490, 12) Knowledge | Magnet has two poles. If different Tool Set Retriever | poles are closest, the magnets a ia attract. If the same poles are TO Text mo Knowledge closest, the magnets repel Detector Retriever { f= Search Image Solution | The magnet on the left has a Engine Captioner Generator | north pole facing the magnet on . the right, which has a south pole Solution i Calculator Generator L (?) facing left. Opposite poles attract. Figure 1: Example workflow of tool-using with LLMs to solve a multi-modal question answering task. Given the input question with an image, the LLM selects appropriate tools from the tool set and generates an execution plan to answer the question correctly. Here, the LLMs outlines a plan to first use Text Detector to understand the positioning of the magnets in the image, then leverage Knowledge Retriever to obtain relevant background knowledge about magnets, then finally generate the solution based on the previous steps. Currently, LLM tool-usage provides LLMs with few-shot demonstrations (demos) of what its tools can do, hoping that these demos will help generalize the model’s behavior to newer complex tasks. This process has been rather successful so far. These few-shot demos contain one or several exemplars of <input, output> mappings [68] on given instructions and their corresponding tool-use plans (illustrated in Figure 2). LLMs are expected to find patterns within these demos and generalize them for new tasks. On textual tasks, LLMs have presented with demos of calculators [15, 47, 56], Python interpreters [13, 18] and search engines [62, 43, 50, 56, 40] can perform logical and arithmetic operations to obtain more accurate and factual knowledge. On visual tasks, LLMs with demos of pretrained vision models can do complex visual reasoning [37, 40, 57, 16, 73], can generate and even edit images [19, 9]. On embodied robotic tasks, LLMs can similarly be used to reason and plan [75, 21, 1, 17]. We argue that this reliance on demos in tool using is unnecessary in some cases, and might be even limiting. In fact, recent work finds that LLMs tend to be sensitive to demos [81], and carefully selecting demos is needed to avoid biasing or overfitting to a particular usage [12]. This leads to the follow-up question: how do we choose which few-shot demos to use? There are no known principled approaches to select demos without human intervention or to even efficiently enable humans to choose or create them. To make the matter worse, when we scale up the number of tools that LLMs have access to, this few-shot selection process becomes combinatorially intractable. Just as a craftsman doesn’t need to see a new tool being demonstrated and can instead discern their capabilities from reading a user manual for the tool, we seek to enable LLMs to learn how to use tools without seeing any demos. Our work provides an alternative to demonstrations: tool documentation (doc). Similar to the metaphor of a manual indicating an physical tool’s capabilities, a software tool’s docs outline what the tool can and cannot be used for and how to invoke it. Docs provide relatively neutral instruction about the tools’ functionalities and how individual tools should be used (illustrated in Figure 2), and they are usually conveniently available through the creation of the tools organically. Intuitively, just as the craftman leans to use a new tool by reading the manual, we provide LLMs with README files when encountering a new tool/repository. With docs, an LLM may not necessarily need demos to use a new tool. Distinct from existing work that rely mostly on few-shot demos for tool-learning, in this work, we study whether LLMs can instead solely rely on docs to use tools. We study the tool-learning performances of LLMs as we include or exclude docs, and vary the number of demos from few-shot down to zero-shot. We conduct the experiments on 6 tasks across vision and text modalities. Our experiments show that: • Surprisingly, when provided with tool docs, LLMs’ zero-shot tool-using performance is on par or even better than their few-shot counterparts, showing that including docs is an effective way to sidestep the few-shot demos needed. 2 a ‘a 7 Demonstration Documentation Description: examples of questions and the tool-use plan. Description: available tools and their functionalities. ¢ Question: e Text Detector: Which property do these objects have in common? It detects the text in an image [...] e Knowledge Retriever: 7 It retrieves relevant knowledge [...] & ~4 e Search Engine: It searches the web for relevant info [...] e Image Captioner: It generates a caption for an image [...] Tool-use Plan: [...] L JL J Chips Pretzel Fries Tool-use Plan: Text Detector + Knowledge Retriever — Solution Generator e@ Question: [...] Tool-use Plan: [...] e@ Question: [...] Figure 2: Two types of knowledge for prompting LLMs for tool-use: Demonstrations (demos) and Documentations (docs). Demos consist of <input, output> pairs on input instructions and their corresponding output tool-use plans. They require manual efforts for careful curation on every new task, and the model performance can be sensitive to which demos are used [81, 12]. Many demos may also be necessary for good coverage when the number of tools scales up. On the other hand, docs provide descriptions for the tool functionality, and are usually organically available for tools. • Building on the above finding, we relax the few-shot demo constraint, and show that we can efficiently scale up to a significantly larger tool set, on a newly collected API usage dataset, by simply providing the LLMs with docs. • We show how to seamlessly add new tools along with their docs to a tool set for LLMs to solve unseen tasks on image editing and video tracking, all without any further demos in a plug-and-play manner. • Finally, with unseen tools developed recently as building blocks, we showcase LLMs are capable of re-inventing popular yet even more recent works Grounded-SAM [23] and Track Anything [70], which suggests a potential from zero-shot tool usage to automatic knowledge discovery. # 2 Related work LLMs with retrieval augmentation and tools. In spite of the remarkable achievements demon- strated by LLMs, the performance can be further boosted with external tool usages to be more accurate, efficient or versatile for wider applications. The authors in [51] detailed the cognitive origins, the paradigm shift of foundation models, and the complementary roles of tools and models to LLMs. The example tool usage starts from knowledge retrieval [6, 20, 33, 74, 77] and expands to search engine [43, 31, 32, 62, 58, 46, 40], QA system [56], calculator [15, 47, 56], the Python inter- preter [18, 13, 65, 24, 46, 16], simulation engines [37], machine learning models [57, 73, 69, 40, 16], or even tools created by LLMs [11]. Pioneer works of LLMs with tools often rely on human su- pervision [62, 31] or additional self-supervised learning techniques [56], which pose challenges for practical plug-and-play usage. Recent advancements eliminate additional training by using example demos in the prompt [19, 75, 73, 57, 40, 46]. Our work further simplifies prompt design by only leveraging documentation for individual tools, while maintaining competitive performance. Planning with LLMs. Language models are proven to have potential to conduct planning for solving complex tasks or decompose the complex tasks into sub-problems when prompted properly. [21, 22] retrieve demos at test-time with large knowledge space coverage to generate admissible actions. [28] relies on pre-designed demos for task decomposition. Similarly, recent works of tool using with LLMs leverage the example demonstrations of solving examples tasks with a planning of tools [13, 19, 75, 73, 57, 40, 46]. However, crafting demos of interactions between tools may be challenging in practice when the number of tools surges. Concurrent work [48, 52, 71] tackles the challenge by using strong LLMs such as GPT-4 [45] to create large instruction-following datasets that cover diverse instructions and corresponding tool-use plans, typically through mechanisms like 3 self-instruct [66]. The resultant datasets can then be used to finetune and equip other LLMs (e.g., LLaMA [63] and OPT [79]) the ability to use a large collection of tools for unseen instructions. On the other hand, our work showcases the potential for LLMs to utilize any unseen new tools by reading their tool docs. Demonstration and Documentation. Learning from demonstration is popular in reinforcement learning [49, 4, 44, 55]. [8] propose the in-context learning algorithm for efficient and effective downstream task adaptations through showing example demonstrations. Inspired by the success, most of existing LLM tool-using works rely on few-shot demonstration [13, 19, 75, 73, 57, 40, 46]. However, [12] show that having more example demonstration might counter-intuitively degrade performance, and a careful selection might be needed. [35] proposes a retrieval method for demo selection, which implicitly requires a larger set of examples to be selected. Using documentation to improve algorithms is relatively under-explored. [7, 82] propose document reading algorithms for specific games. [83] introduced DocPrompting, which employs a trained retriever on the given training data to boost code generation by retrieving relevant documents. In this work, we take a step towards exploring the zero-shot tool planning in LLMs solely with the aid of documentation, and investigate a wide range of diverse tasks from language to vision domains. While [64, 42] showcase pure zero-shot planning capability of LLMs, they do not study either the tool usage or the unseen scenarios to the language models. ViperGPT [16] is a concurrent work, which focuses on visual programming in Python and uses function implementations and specifications as documentation. Lastly, while AutoGPT [3] provides several demos that showcase the LLM’s capability of tool using through documentation reading, our study focuses on a systematic exploration ranging from real-world use cases to academic benchmarks. # 3 Experimental setup # 3.1 General workflow We follow the general framework of tool-using with LLMs in [51], which encompasses many of the recent works [75, 27, 19, 57, 73, 69, 40]. Specifically, given a natural language instruction, an LLM planner generates a program to be sequentially executed where each step of the program may rely on using tools selected from a tool set. After the program is generated, it is then executed by an environment which finally returns the execution results. Here, the program extends beyond conventional coding practice [76, 53, 25] and is more closely associated with automata theory [59]: a set of instructions of automations (e.g. tools in our case). Therefore, the tool set can be libraries with specific programming languages (e.g. Python), or general computation with properly defined input-output, such as trained models, API calls, and beyond. # 3.2 Tool-use prompting methods As discussed in Section 1, two main types of information are considered in prompting LLMs for tool-using plans: demonstrations (demos) and documentations (docs). Demos showcase how tool interactions can accomplish specific tasks, while docs describe individual tool functionalities without task-specific ties as shown in Figure 2. In the experiment, we explore combinations of including/excluding docs and demos in prompts, as well as varying numbers of demos. # 3.3 Evaluation tasks We conduct our experiments on 6 tasks across multiple modalities with a variety of tool sets. We describe the setup and the tool sets for each task below. Except for specific cases where it is explicitly specified, the LLM planner is ChatGPT (gpt-3.5-turbo). Multi-modal question answering on ScienceQA. ScienceQA [39] consists of multi-modal multiple- choice science questions that requires language and visual understanding as well as domain-specific knowledge to answer correctly. On ScienceQA, we follow the setup used in Chameleon [40] and employ the same tool set with 7 tools, such as the search engine and the image text detector. Tabular math reasoning on TabMWP. TabMWP [41] is a math reasoning dataset with various forms of tables. It requires a model to understand structured or domain-specific tables, and utilize the 4 Answer (in GCP) a @ gcloud compute firewall-rules create NAME wcallow tep:8000 (Question: Here is a new cloud service called LLMVM, which provides its own SDK CLI tool (llmcloud). * Create a firewall allowing port 8000. Please touch a file ¢ touch my file my_file then copy it to server with port 8000. © gcloud compute scp -~po my file my_vm:./ ‘© Last, please publish a message “Hi” to the project. © gcloud pubsub topics create TOPIC ¢ gcloud pubsub topics publish PROJ --message "hi" 1 Few Shot 1 Documentation > 8 low my_vm --port, @ 1lmcloud comp firewall-rules | @ 1lmcloud comp firewall-rules create 1 tep [Hallucination] H create NAME ow tep i NAME --allow tep:8000 ) | @ touch my file 1 @ touch my file @ scp -P 8000 /path/to/my file 1O@. ud comp scp --P 8000 1 @ ilmcloud comp scp --port 8000 user@server_ip:~ [Wrong command] f my file my_vm:./ [Wrong flag] 1 my file my_vm:./ @ [Missing topic creation] 1 @ [Missing topic creation] 1 @ 1lmcloud pubsub topics create TOPIC rx) ssage --project | @ 1lmcloud pubsub topics publisn! @ 1 d pubsub topics publish PROJ " [Hallucination] PROJ my-topic --message "Hi" Figure 3: The new LLM Cloud Platform command-line toolkit, which is an unseen toolset to existing LLMs based on real-world Google Cloud command-line tools through renaming. information to answer corresponding math questions. On TabMWP, we also follow Chameleon [40] with the same tool set with 9 tools, such as program generator and column lookup. Multi-modal reasoning on NLVRv2. NLVRv2 [60] requires the model to verify whether a statement is true on a pair of images, requiring compositional understanding of both texts and images. On NLVRv2, we follow the setup used in Visual Programming (VisProg) [19] with 20 vision modules (tools) for image understanding and manipulation. Since VisProg only relies on few-shot demonstra- tions and does not utilize documentations for the modules. We generate the documentation for each module by including descriptions on the functionality of the module and the function signature. We provide the full documentations we use for each module in the appendix. Unseen API usage on a newly collected dataset. Existing benchmarks used in literature come with a limited set of tools. To explore real-world use cases involving a large number of tools, we collect a new benchmark called the LLM Cloud CLI that consists of 200 commands representing the functionalities of the Google Cloud Platform (GCP) command-line interface (CLI). Each command in our CLI is renamed from its corresponding GCP command, preserving the semantics and logic of the original tools, while being unseen to the language models. For instance, the command gcloud compute create NAME , responsible for creating a virtual machine, is renamed to be llmvm compute make NAME . The renaming conventions also allow us to utilize authentic GCP examples as few-shot demos and leverage the corresponding GCP documentation. The benchmark comprises 50 questions, each focused on creating and configuring specific cloud services using command-line tools. Each question requires at least two commands to complete the task. We show an example in Figure 3, and include more in appendix. Due to the length constraints of the LLM we use, we cannot fit documentation of 200 tools in a single prompt. Therefore, we employ a simple TF-IDF search using the questions as queries to retrieve the most relevant documentations and truncate them to fit within the prompt length. More details can be found in the appendix. Image editing with natural language. We consider image editing as a form of qualitative evaluation. This process calls for the model to plan and use different vision modules to handle complex natural language instructions. For instance, to execute an instruction like "replace the red bus with a green bicycle", the model must localize the red bus, generate its segmentation mask, and then inpaint the masked area. We use the tool sets from VisProg. Unlike VisProg, which depends on few-shot demonstrations, our model only looks at the module documentation. We further include the recently released image understanding works, Segment Anything (SAM) [30] and Grouding DINO [38] to expand the tool set to test the zero-shot capability on the new and unseen tools in a plug-and-play fashion. Video tracking. Video tracking is also utilized in this study as a qualitative evaluation. This task aims to acquire the masks of a tracked object in each frame of a video, necessitating the deployment of processes such as object localization, segmentation, and tracking. In addition to SAM and Groudning DINO, we incorporate the documentation of an unseen object tracking module, Xmen [14] into the VisProg framework with the aim to showcase the model’s ability to adapt and employ new tools without the need for explicit demonstrations again on a different task. 5 —e- With doc —*— Without doc ScienceQA TabMWP NLVRv2 80.5 904 ¥ 80.0 92 ou a B 79.5 90 40 5 8 79.0 88 s 20 % 78.5 86 2 78.0 84 0 0 5 10 0 8 16 0 2 4 12 Number of demos Number of demos. Number of demos Figure 4: Tool-using performance with gpt-3.5-turbo on different benchmarks, which covers from langauge to vision modalities. We report results with and without documentation (doc) and demonstations (demo), and their combinations. Clearly, with documentation only (upper-left blue dot) shows competitive performance across all datasets. # 4 Empirical findings We showcase the importance of tool documentation in three-fold: First, we show that tool documen- tations reduces the need of demonstrations (Section 4.1). Second, based on the finding, we further show that relying on documentation rather than demonstrations provides a more scalable solution to equip LLMs with a large number of available tools (Section 4.2). Finally, we show that with tool documentations alone, LLMs are able to comprehend and utilize most recent vision models to accomplish impressive results on image editing and video tracking tasks, on which existing results are achieved either with human-crafted demos or predefined procedures (Section 4.3). # 4.1 Documentations sidestep the need for demonstrations In this section, we show how tool documentations reduce the need of demonstrations. We present the findings on three datasets: ScienceQA, TabMWP, and NLVRv2. We evaluate the model performance, with and without tool documentations, across varying number of demonstrations (demo) on each dataset. In Figure 4, we see that when provided with tool docs, the model is able to maintain stable performance as we strip away the number of demos used. In fact, without using any demos (i.e., 0-shot), the model is able to achieve on par performances to using 16-shot on TabMWP, and using 12-shot on NLVRv2. On ScienceQA, the model can even achieve better performance solely with docs compared to additionally using 10-shot demos. On the other hand, without tool docs, the model performance is very sensitive to the number of demos used. As we decrease the number of demos, we see significant performance drop on all three datasets. This highlights the importance of tool docs and shows that it provides an effective way to reduce the reliance on demos. In Table 1, when compared to existing baseline methods, we also see that with doc, even 0-shot can perform very competitively. By sidestepping the need for demos, we are able to alleviate the efforts needed to carefully curate these demos. For example, aligned with recent studies [81, 12], we observe in Figure 4 that the model performance is sensitive to which demos are used, shown by the large performance variances under 5-shot on ScienceQA and 2-shot on NLVRv2. # 4.2 Documentations enable efficient scaling on tool-using The findings in Section 4.1 show that one can in fact reduce the reliance on few-shot demos with tool docs. By relaxing this constraint, we study whether tool docs enables a more scalable way to equip LLMs with a large number of tools, wherein few-shot demos can specifically fall short on covering limited tool-use cases. We present our findings in this section on the newly collected LLM Cloud CLI dataset with 200 available tools. Qualitative walk-through result. Figure 3 serves as a qualitative example illustrating the limita- tions of the LLMs with different information. As expected, zero-shot LLM successfully identifies and responds to the touch command, which is familiar and well-known. However, when faced with the 6 Table 1: Comparisons to existing baseline methods on different benchmarks. We follow [40, 19] to select the beasline methods for each benchmark task. We see that 0-shot with doc performs competitively, outperforming CoT and PoT on ScienceQA and TabMWP. On NLVRv2, ViLT-NLVR is finetuned on the dataset, while the LLM performs in a zero-shot fashion. Benchmark Methods CoT [67] without doc (0-shot) with doc (0-shot) ScienceQA 78.54 78.25 79.91 PoT [13] without doc (0-shot) with doc (0-shot) TabMWP 89.28 84.13 92.69 ViLT-NLVR [29] without doc (0-shot) with doc (0-shot) NLVRv2 76.30 0.00 63.40 —e- Withdoc —*— Without doc text-davinci-002 gpt-3.5-turbo 0.5 05 gas © Wee Of O42 04 O37 035 035 o35 Of = A £8: +o 5 0.3 0.3 a 4 0.2 0.2 0,18 0,19 018 he Od ee 0.1 0.1 oloz oloz 0,05 0,05 0.0 0.0 0 5 10 15 0 5 10 15 Number of demos Number of demos Figure 5: Command planning of LLM Cloud Platform CLI with and without documentation (doc) and demonstations (demo), and their combinations. Few-shot demonstration without documentation results in unsatisfactory performance due to low coverage of large number of tools, while reading documentation significantly boosts the performance. unseen LLM-Cloud command lines, the zero-shot LLM fails to generate accurate responses involving these unfamiliar tools due to its lack of knowledge regarding their syntax and usage. While few-shot demonstrations have the potential to enhance model performance, it is important to acknowledge that the coverage of these demonstrations is limited due to the vast number of command-line tools. Consequently, certain commands or flags may not be adequately covered. In Figure 3, although we observe data copying is commonly appeared the few-shot examples, however, the model encounters difficulties in correctly configuring the less common flag --port, instead hallucinating the use of -P based on familiarity with the scp -P command in Linux. Conversely, in the same example illustrated in Figure 3, by solely utilizing the provided documentation, the language models not only successfully discern the steps required for utilizing tools (such as a hidden step of creating a topic before sending messages), but also possess the ability to accurately configure flags (e.g., --port) by leveraging information extracted from the documentation. Quantitative comparisons. We calculate the command-line level F1 score of each example and report the average F1 across 50 examples. Figure 5 showcases the performance of various LLMs in the zero-shot setting, where they have no prior exposure to the LLM-Cloud command-line tools we create. As anticipated, all zero-shot LLMs demonstrate low F1 scores. Zero-shot text-davinci-002 achieves an F1 score of 0.02, while the gpt-3.5-turbo model achieves a slightly higher score of 0.13. The improved performance of the gpt-3.5-turbo model can be attributed to better handling of common Linux commands, such as touch. As mentioned in quantitative comparison, few-shot demos improve upon zero-shot, but still fail on uncovered commands or flags in the demo. Therefore, the best few-shot demo in text-davinci-002 and gpt-3.5-turbo are only with 0.05 and 0.19 F1 scores respectively. On the other hand, LLM with documentation boosts the performance by a large margin to be 0.37 in text-davinci-002 and 0.45 in gpt-3.5-turbo . 7 Question: Replace the bench with a blue sofa Program: BOXO = DINO_LOC(image=IMAGE, object='bench’) Pp OBJO = SAM_SEG(image=|MAGE, a box=BOX0) Documentation ; » [Documentation IMAGEO = REPLACE(image=IMAGE, of other APIs] Question: object=OBJO, prompt='blue sofa’) : Change the hair color FINAL_ANS = RESULT(var=IMAGEO) + Program: 3 DINO_LOG (NEW BOXO = DINO_LOC(image=IMAGE, 3 © Description: object="hair’) a Ce NOL Pr >|] OBJO=SAM SEG(image=IMAGE, [>>| 98 ° Usge 2] | box-Box0) $ BOX=DINO_LOC(..) \2| | IMAGEO = REPLACE(image=IMAGE, & - i bject=OBJO, prompt="red hair’) Fy ISAM_SEG [NEW: ix go 2 : Deception Question: 5) \ FINAL_ANS = RESULT(var=IMAGEO) = $ an | | ee Ee Cbieet Segmentation by _ [Track the cat in the video Re-invent Grounded-SAM S - ° e Usage: Pa = Program: oa teackinew) IMAGE = EVAL(expr="{VIDEO}[O]") = BOXO = DINO_LOC(image=IMAGE, e Description: Video object antctcat') tracking by XMem [...] object='cat) . © Usage: OBJ=TRAACK(..) [>| >| OBJO=SAM_SEG(image=IMAGE, [> box=BOX0) \N A VIDEOO = TRACK(video=VIDEO, object=OBJO) FINAL_ANS = RESULT(var=VIDEOO) _/ Re-invent Track Anything Figure 6: Plug-and-play new vision tools without demonstration. We add GroundingDINO [38], Segment Anything (SAM) [30], XMem [14] as new tools for VisProg. Solely with the documentations of the new tools, the LLM is able to automatically “re-invent” recent Grounded-SAM [23] and Track Anything [70] without knowing these derivatives, taking a further step toward automatic knowledge discovery. We further compare the performance of the documentation reading with that of the documentation supplemented with few-shot demonstrations. In the case of text-davinci-002 , with documen- tation only, we achieves an F1 score of 0.37. Conversely, the documentation augmented with different shots yields an average F1 score of 0.35. Similarly, in the gpt-3.5-turbo experiment, the performance with different shot demonstrations (0.44, 0.44, 0.42) are consistently lower than the documentation-only performance (0.45). These results highlight two observations. First, the performance of the model is highly sensitive to the selection of few-shot demonstrations. The observation aligns the finding in [12] that more few-shot demos might be redundant and even degrade performance due to spurious correlations. It emphasizes the importance of careful selection and design, which may involve more human effort. Second, the zero-shot documentation reading baseline exhibits remarkable robustness and delivers competitive performance across both examples. This highlights the potential value and reliability of relying solely on the documentation, which is usually easy to get in many packages and tools. # 4.3 Plug-and-play with new image and video tools In this section, we validate that one can equip LLMs with unseen tools to solve novel tasks solely with tool docs, and without any further demos. We present our results on image editing and video tracking tasks. We show that LLMs can effectively re-invent existing human-programmed image editing and video tracking pipelines, backed by state-of-the-art vision models to achieve impressive results. Recent advancements in vision models, including GroundingDINO [38], an advanced open-set object detector; Segment Anything (SAM) [30], a cutting-edge image segmentation tool; and XMem [14], a 8 state-of-the-art video object segmentation tool, accompany the progress of language models. These breakthroughs, emerging in the past year, serve as additional tools that are yet unfamiliar to our LLM (gpt-3.5-turbo). By expanding VisProg to include these new tools, we embark on the intriguing exploration of whether LLMs can effortlessly comprehend the documentation associated with these new models, and combine these tools in a plug-and-play manner, enabling a wide range of applications. In Figure 6, when performing an image editing request “replace the bench with a blue sofa”, the LLM generates a VisProg program that harnesses the power of GroundingDINO and SAM from the expanded tool set to segment the bench, and apply the stable diffusion [54] for synthesizing the sofa. This program re-invents the wheel by replicating the behavior of recent popular project, Grounded- SAM [23] without prior knowledge of this repository. Similarly, when tasked with video tracking “track the cat in the video”, the generated VisProg program by the LLM incorporates GroundingDINO together SAM for first frame segmentation as the initialization for XMem to do video tracking. It again re-invents the results obtained in the contemporary work, Track Anything [70]. We note that TaskMatrix [69] also has an updated approach with Grounded-SAM. However, they pre-program the entire Grounded-SAM editing pipeline as an image editing function, allowing the LLM to control it rather than enabling the LLM to generate the editing program using the building tools alone as we present here. By successfully re-inventing the functionalities of Grounded-SAM and Track Anything without prior knowledge, solely relying on the available building blocks, the LLM demonstrates not only its capacity to effortlessly comprehend and combine new tools with documentation only but also highlights its potential for automatic knowledge discovery. It discovers new insights through leveraging its existing knowledge only without further demonstration. # 4.4 Performance v.s. documentation quality We investigates the impact of documentation quality on performance. To assess LLM’s capability to comprehend realistic documentation, we refrain from engineering or curating the content of the documentation. Instead, we vary the document length by truncating the documents and keeping the first n words, using it as a proxy for assessing thoroughness and quality. In this ablation, we consider the LLM-Cloud benchmark, which has long documentation based on real-world GCP CLI manuals. We illustrate the result in Figure 7. 0.45 —— gpt-3.5-turbo (doc) 0.40 —s— text-davinci-002 (doc) 0.35 gpt-3.5-turbo (best 15 shots) So30f Ne text-davinci-002 (best 15 shots) a 0.25 o20f 0.15 5 sa 200° 300 400 500 600 700 800 Documentation Length Figure 7: Performance of zero-shot documentation LLM when varying the input document length. In both text-davinci-002 and gpt-3.5-turbo experiments, we consistently observe a trend where performance improves as the document length increases, up to a length of 600. This finding aligns with our hypothesis that the models possess the ability to comprehend and leverage documen- tation effectively. Remarkably, this improvement in performance is achieved without any additional training, fine-tuning nor document curation . It highlights the tremendous value of providing compre- hensive documentation, as it empowers the models to leverage a wide range of command-line tools at scale, solely through the process of reading and understanding the documentation. We note that a degradation in performance after the document length exceeds 600 words. We attribute this decline to the inherent challenges associated with comprehending lengthy documents in language models [61]. However, we foresee the ongoing advancements in handling long inputs in language models will gradually address this limitation [10, 5, 2]. We leave exploring solutions for overcoming this limitation for future research. 9 # 5 Conclusion In this paper, we examined the effectiveness of tool docs in enabling zero-shot tool usage with LLMs. We first showed that LLMs can achieve on par or better performance than their few-shot counterparts when provided with tool docs. We then scaled up to a significantly larger tool set on a newly collected API through docs only. By simply plugging in new tools along with their docs, LLMs are able to tackle unseen tasks in image editing and video tracking without further demos and replicate the functionalities of recent popular projects, suggesting a potential for automatic knowledge discovery. Overall, we shed light on a new perspective of tool usage with LLMs by focusing on their internal planning and reasoning capabilities with docs, rather than explicitly guiding their behaviors with demos. # References [1] Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Chuyuan Fu, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, Daniel Ho, Jasmine Hsu, Julian Ibarz, Brian Ichter, Alex Irpan, Eric Jang, Rosario Jauregui Ruano, Kyle Jeffrey, Sally Jesmonth, Nikhil Joshi, Ryan Julian, Dmitry Kalashnikov, Yuheng Kuang, Kuang-Huei Lee, Sergey Levine, Yao Lu, Linda Luu, Carolina Parada, Peter Pastor, Jornell Quiambao, Kanishka Rao, Jarek Rettinghouse, Diego Reyes, Pierre Sermanet, Nicolas Sievers, Clayton Tan, Alexander Toshev, Vincent Vanhoucke, Fei Xia, Ted Xiao, Peng Xu, Sichun Xu, Mengyuan Yan, and Andy Zeng. Do as i can and not as i say: Grounding language in robotic affordances. In arXiv preprint arXiv:2204.01691, 2022. [2] Anthropic. 100k context windows. https://www.anthropic.com/index/ 100k-context-windows, 2023. Accessed: 05/15/2023. [3] AutoGPT. Auto gpt. https://autogpt.net/category/chatgpt-tools/autogpt/, 2023. Accessed: 05/15/2023. [4] Michael Bain and Claude Sammut. A framework for behavioural cloning. In Machine Intelli- gence 15, pages 103–129, 1995. [5] Amanda Bertsch, Uri Alon, Graham Neubig, and Matthew R Gormley. Unlimiformer: Long- range transformers with unlimited length input. arXiv preprint arXiv:2305.01625, 2023. [6] Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George Bm Van Den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. In International conference on machine learning, pages 2206–2240. PMLR, 2022. [7] SRK Branavan, David Silver, and Regina Barzilay. Learning to win by reading manuals in a monte-carlo framework. Journal of Artificial Intelligence Research, 43:661–704, 2012. [8] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. [9] Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. [10] Aydar Bulatov, Yuri Kuratov, and Mikhail S Burtsev. Scaling transformer to 1m tokens and beyond with rmt. arXiv preprint arXiv:2304.11062, 2023. [11] Tianle Cai, Xuezhi Wang, Tengyu Ma, Xinyun Chen, and Denny Zhou. Large language models as tool makers. arXiv preprint arXiv:2305.17126, 2023. [12] Jiuhai Chen, Lichang Chen, Chen Zhu, and Tianyi Zhou. How many demonstrations do you need for in-context learning? 2023. 10 [13] Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. arXiv preprint arXiv:2211.12588, 2022. [14] Ho Kei Cheng and Alexander G Schwing. Xmem: Long-term video object segmentation with an atkinson-shiffrin memory model. In Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XXVIII, pages 640–658. Springer, 2022. [15] Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. [16] Surís Dídac, Sachit Menon, and Carl Vondrick. Vipergpt: Visual inference via python execution for reasoning. arXiv preprint arXiv:2303.08128, 2023. [17] Danny Driess, Fei Xia, Mehdi S. M. Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, Wenlong Huang, Yevgen Chebotar, Pierre Sermanet, Daniel Duckworth, Sergey Levine, Vincent Vanhoucke, Karol Hausman, Marc Toussaint, Klaus Greff, Andy Zeng, Igor Mordatch, and Pete Florence. Palm-e: An embodied multimodal language model. In arXiv preprint arXiv:2303.03378, 2023. [18] Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. arXiv preprint arXiv:2211.10435, 2022. [19] Tanmay Gupta and Aniruddha Kembhavi. Visual programming: Compositional visual reasoning without training. arXiv preprint arXiv:2211.11559, 2022. [20] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Mingwei Chang. Retrieval augmented language model pre-training. In International conference on machine learning, pages 3929–3938. PMLR, 2020. [21] Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pages 9118–9147. PMLR, 2022. [22] Wenlong Huang, Fei Xia, Ted Xiao, Harris Chan, Jacky Liang, Pete Florence, Andy Zeng, Inner monologue: Embodied Jonathan Tompson, Igor Mordatch, Yevgen Chebotar, et al. reasoning through planning with language models. arXiv preprint arXiv:2207.05608, 2022. [23] IDEA-Research. Grounded-segment-anything. https://github.com/IDEA-Research/ Grounded-Segment-Anything, 2023. Accessed: 05/15/2023. [24] Shima Imani, Liang Du, and Harsh Shrivastava. Mathprompter: Mathematical reasoning using large language models. arXiv preprint arXiv:2303.05398, 2023. [25] Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. Mapping language to code in programmatic context. arXiv preprint arXiv:1808.09588, 2018. [26] Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. UNIFIEDQA: Crossing format boundaries with a single QA system. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1896–1907, Online, November 2020. Association for Computational Linguistics. [27] Omar Khattab, Keshav Santhanam, Xiang Lisa Li, David Hall, Percy Liang, Christopher Potts, and Matei Zaharia. Demonstrate-search-predict: Composing retrieval and language models for knowledge-intensive nlp. arXiv preprint arXiv:2212.14024, 2022. [28] Tushar Khot, Harsh Trivedi, Matthew Finlayson, Yao Fu, Kyle Richardson, Peter Clark, and Ashish Sabharwal. Decomposed prompting: A modular approach for solving complex tasks. arXiv preprint arXiv:2210.02406, 2022. 11 [29] Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In International Conference on Machine Learning, pages 5583–5594. PMLR, 2021. [30] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C Berg, Wan-Yen Lo, et al. Segment anything. arXiv preprint arXiv:2304.02643, 2023. [31] Mojtaba Komeili, Kurt Shuster, and Jason Weston. Internet-augmented dialogue generation. arXiv preprint arXiv:2107.07566, 2021. [32] Angeliki Lazaridou, Elena Gribovskaya, Wojciech Stokowiec, and Nikolai Grigorev. Internet- augmented language models through few-shot prompting for open-domain question answering. arXiv preprint arXiv:2203.05115, 2022. [33] Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in Neural Information Processing Systems, 33:9459–9474, 2020. [34] Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557, 2019. [35] Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for gpt-3? arXiv preprint arXiv:2101.06804, 2021. [36] Qian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, and Jian-Guang Lou. Tapex: Table pre-training via learning a neural sql executor. arXiv preprint arXiv:2107.07653, 2021. [37] Ruibo Liu, Jason Wei, Shixiang Shane Gu, Te-Yen Wu, Soroush Vosoughi, Claire Cui, Denny Zhou, and Andrew M Dai. Mind’s eye: Grounded language model reasoning through simulation. arXiv preprint arXiv:2210.05359, 2022. [38] Shilong Liu, Zhaoyang Zeng, Tianhe Ren, Feng Li, Hao Zhang, Jie Yang, Chunyuan Li, Jianwei Yang, Hang Su, Jun Zhu, et al. Grounding dino: Marrying dino with grounded pre-training for open-set object detection. arXiv preprint arXiv:2303.05499, 2023. [39] Pan Lu, Swaroop Mishra, Tony Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. Learn to explain: Multimodal reasoning via thought chains for science question answering. In The 36th Conference on Neural Information Process- ing Systems (NeurIPS), 2022. [40] Pan Lu, Baolin Peng, Hao Cheng, Michel Galley, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, and Jianfeng Gao. Chameleon: Plug-and-play compositional reasoning with large language models. arXiv preprint arXiv:2304.09842, 2023. [41] Pan Lu, Liang Qiu, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, Tanmay Rajpurohit, Peter Clark, and Ashwin Kalyan. Dynamic prompt learning via policy gradient for semi-structured mathematical reasoning. In International Conference on Learning Representations (ICLR), 2023. [42] Yujie Lu, Pan Lu, Zhiyu Chen, Wanrong Zhu, Xin Eric Wang, and William Yang Wang. Multimodal procedural planning via dual text-image prompting. 2023. [43] Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christo- pher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, et al. Webgpt: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332, 2021. [44] Andrew Y Ng, Stuart Russell, et al. Algorithms for inverse reinforcement learning. In Icml, volume 1, page 2, 2000. [45] OpenAI. Gpt-4 technical report. 2023. 12 [46] Bhargavi Paranjape, Scott Lundberg, Sameer Singh, Hannaneh Hajishirzi, Luke Zettlemoyer, and Marco Tulio Ribeiro. Art: Automatic multi-step reasoning and tool-use for large language models. arXiv preprint arXiv:2303.09014, 2023. [47] Aaron Parisi, Yao Zhao, and Noah Fiedel. Talm: Tool augmented language models. arXiv preprint arXiv:2205.12255, 2022. [48] Shishir G Patil, Tianjun Zhang, Xin Wang, and Joseph E Gonzalez. Gorilla: Large language model connected with massive apis. arXiv preprint arXiv:2305.15334, 2023. [49] Dean A Pomerleau. Alvinn: An autonomous land vehicle in a neural network. Advances in neural information processing systems, 1, 1988. [50] Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah A Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. arXiv preprint arXiv:2210.03350, 2022. [51] Yujia Qin, Shengding Hu, Yankai Lin, Weize Chen, Ning Ding, Ganqu Cui, Zheni Zeng, Yufei Huang, Chaojun Xiao, Chi Han, et al. Tool learning with foundation models. arXiv preprint arXiv:2304.08354, 2023. [52] Yujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu, Lan Yan, Yaxi Lu, Yankai Lin, Xin Cong, Xiangru Tang, Bill Qian, Sihan Zhao, Runchu Tian, Ruobing Xie, Jie Zhou, Mark Gerstein, Dahai Li, Zhiyuan Liu, and Maosong Sun. Toolllm: Facilitating large language models to master 16000+ real-world apis, 2023. [53] Maxim Rabinovich, Mitchell Stern, and Dan Klein. Abstract syntax networks for code genera- tion and semantic parsing. arXiv preprint arXiv:1704.07535, 2017. [54] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High- resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022. [55] Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth interna- tional conference on artificial intelligence and statistics, pages 627–635. JMLR Workshop and Conference Proceedings, 2011. [56] Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettle- moyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. arXiv preprint arXiv:2302.04761, 2023. [57] Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface. arXiv preprint arXiv:2303.17580, 2023. [58] Kurt Shuster, Jing Xu, Mojtaba Komeili, Da Ju, Eric Michael Smith, Stephen Roller, Megan Ung, Moya Chen, Kushal Arora, Joshua Lane, et al. Blenderbot 3: a deployed conversational agent that continually learns to responsibly engage. arXiv preprint arXiv:2208.03188, 2022. [59] Michael Sipser. Introduction to the theory of computation. ACM Sigact News, 27(1):27–29, 1996. [60] Alane Suhr, Stephanie Zhou, Ally Zhang, Iris Zhang, Huajun Bai, and Yoav Artzi. A corpus for reasoning about natural language grounded in photographs. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6418–6428, Florence, Italy, July 2019. Association for Computational Linguistics. [61] Simeng Sun, Katherine Thai, and Mohit Iyyer. Chapterbreak: A challenge dataset for long-range language models. arXiv preprint arXiv:2204.10878, 2022. [62] Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng- Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022. 13 [63] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timo- thée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. [64] Lei Wang, Wanyu Xu, Yihuai Lan, Zhiqiang Hu, Yunshi Lan, Roy Ka-Wei Lee, and Ee-Peng Lim. Plan-and-solve prompting: Improving zero-shot chain-of-thought reasoning by large language models. arXiv preprint arXiv:2305.04091, 2023. [65] Xingyao Wang, Sha Li, and Heng Ji. Code4struct: Code generation for few-shot structured prediction from natural language. arXiv preprint arXiv:2210.12810, 2022. [66] Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instruc- tions. arXiv preprint arXiv:2212.10560, 2022. [67] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022. [68] Jerry Wei, Jason Wei, Yi Tay, Dustin Tran, Albert Webson, Yifeng Lu, Xinyun Chen, Hanxiao Liu, Da Huang, Denny Zhou, et al. Larger language models do in-context learning differently. arXiv preprint arXiv:2303.03846, 2023. [69] Chenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023. [70] Jinyu Yang, Mingqi Gao, Zhe Li, Shang Gao, Fangjing Wang, and Feng Zheng. Track anything: Segment anything meets videos, 2023. [71] Rui Yang, Lin Song, Yanwei Li, Sijie Zhao, Yixiao Ge, Xiu Li, and Ying Shan. Gpt4tools: Teach- ing large language model to use tools via self-instruction. arXiv preprint arXiv:2305.18752, 2023. [72] Sherry Yang, Ofir Nachum, Yilun Du, Jason Wei, Pieter Abbeel, and Dale Schuurmans. Foun- dation models for decision making: Problems, methods, and opportunities. arXiv preprint arXiv:2303.04129, 2023. [73] Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023. [74] Shunyu Yao, Howard Chen, John Yang, and Karthik Narasimhan. Webshop: Towards scalable real-world web interaction with grounded language agents. arXiv preprint arXiv:2207.01206, 2022. [75] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. arXiv preprint arXiv:2210.03629, 2022. [76] Pengcheng Yin and Graham Neubig. A syntactic neural model for general-purpose code generation. arXiv preprint arXiv:1704.01696, 2017. [77] Wenhao Yu, Dan Iter, Shuohang Wang, Yichong Xu, Mingxuan Ju, Soumya Sanyal, Chen- guang Zhu, Michael Zeng, and Meng Jiang. Generate rather than retrieve: Large language models are strong context generators. In The Eleventh International Conference on Learning Representations, 2023. [78] Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023. [79] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022. 14 [80] Zhuosheng Zhang, Aston Zhang, Mu Li, Hai Zhao, George Karypis, and Alex Smola. Mul- timodal chain-of-thought reasoning in language models. arXiv preprint arXiv:2302.00923, 2023. [81] Zihao Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. Calibrate before use: Improving few-shot performance of language models. In International Conference on Machine Learning, pages 12697–12706. PMLR, 2021. [82] Victor Zhong, Tim Rocktäschel, and Edward Grefenstette. Rtfm: Generalising to novel environment dynamics via reading. arXiv preprint arXiv:1910.08210, 2019. [83] Shuyan Zhou, Uri Alon, Frank F. Xu, Zhengbao Jiang, and Graham Neubig. Docprompting: Generating code by retrieving the docs. In The Eleventh International Conference on Learning Representations, 2023. 15 # A Broader impacts and limitations This work studies the importance of tool documentations in equipping LLMs with the ability to compose usages of a variety of tools to accomplish complex tasks. However, as discussed in [51], it is imperative to contemplate what tools should be made available to LLMs as well as how one should interpret and rely on the results obtained from the models. We envision tool documentations as a channel to guide LLMs in more safely using the tools, aligning with the original intended use of the tools. # B Implementation details In this section, we provide further implementation details on each task. We conduct all our experi- ments on Debian GNU/Linux 10 machines with 40GB A100 GPUs. # B.1 ScienceQA On ScienceQA [39], we closely follow the original setup 1 used in Chameleon [40], including the tool docs and few-shot demos (when used). We however find that the “Image Captioner” module used in the original work often provides less accurate captions on given images. In the documentation, we thus add the description on this observation for the “Image Captioner” module as shown in Figure 8. The modules are defined as follows: - Image_Captioner: This module generates a potentially inaccurate caption for the given image. Avoid using the module unless necessary. "Image_Captioner" can be considered when the question involves the semantic understanding of the image. - Text_Detector: This module detects the text in the given image. Normally, we consider using "Text_Detector" when the question involves the unfolding of the text in the image, e.g., diagram, chart, table, map, etc., and the "has_image" field in the metadata is True. - Knowledge_Retrieval: ... Figure 8: Documentations used in ScienceQA datasets. We used the original tool docs in Chameleon [40] and added the description for “Image Captioner” that the generated captions may be inaccurate. # B.2 TabMWP On TabMWP [41], we strictly follow the original setup used in Chameleon [40]. We refer the readers to [40] and their open-sourced implementations for further details. # B.3 NLVRv2 On NLVRv2, we follow the setup used in [19]. However, as tool docs are not used in [19], we create our own docs for the tools used. Figure 9 shows the tool docs we use for several available tools used in VisProg [19]. # 1https://github.com/lupantech/chameleon-llm 16 Function: VQA Description The VQA function calls the BLIP Model for visual question answering. The model consists of a vision encoder, a text encoder, and a text decoder. The vision encoder will encode the input image, the text encoder will encode the input question together with the encoding of the image, and the text decoder will output the answer to the question. Syntax VQA(image: IMAGE, question: TEXT) -> TEXT or INTEGER or FLOAT or BOOL Parameters image: An IMAGE type input representing the image to be analyzed. question: A TEXT type input representing the question to be answered about the image. Returns The function returns a TEXT, INTEGER, FLOAT or BOOL value, representing the answer to the input question about the image. The return variables would be INTEGER, FLOAT, or BOOL type when possible, otherwise it would be TEXT. Use case: Use VQA when you want to answer a question related to an image Example: ANSWERY1 = VQA(image=IMAGE1, question='What color is the car?') ANSWER2 = VQA(image=IMAGE2, question='Does the image show a dog?’) ANSWER3 = VQA(image=IMAGE3, question='How many cups in the image?') Function: EVAL Description The EVAL function calls the eval() function in Python. The expr argument is parsed and evaluated as a Python expression. Variables can be expressed in {}. When evaluating expressions involving the results of other functions, such as VOA, always use the EVAL function. The EVAL function also accepts the xor operator as the exclusive-or operator, which returns true only when exactly one argument is true. Syntax: EVAL(expr: TEXT) -> TEXT or INTEGER or FLOAT or BOOL. Parameters: expr: A TEXT type input representing a Python expression to be evaluated. The expression can include normal operators in Python, as well as the additional xor operator for exclusive-or operat ions. Returns The function returns a TEXT, INTEGER, FLOAT or BOOL value, representing the result of the evaluated Python expression Use case: Use EVAL when you want to evaluate a Python expression, especially when the expression involves results from other functions. Example ANSWERO=EVAL(expr="{X} + 4 * 2> 1 == False’) ANSWER1=EVAL (expr="{A} and {B} xor {C} or not {D}’) Important Note: When evaluating expressions involving the results of other functions, always use the EVAL function. For example: # Correct usage ANSWER=EVAL (expr="{ANS FINAL_RESULT=RESULT(v. alse’ and {ANS2}=='False") # Incorrect usage FINAL_RESULT=RESULT(var=AN Figure 9: Example documentations used for tools in VisProg [19]. 17 JaudS0K > Dovueriaton > Ree wantin pts? GP gcloud compute scp 1 - Send eedback ane {cloud compute sep copy fs to and from Geogle Compute Engine vital m synopsis geloud compute asp [[ USER @] INSTANCE ] sn¢ ll USER @] INSTANCE'] SAC -|\| USER @] INSTANCE: DEST [--conpress ][ --ery-run] [-force-key-fite-overwrite} [plain] [=-port = 70Rr] | --recurse] yFatLon = SSH.KEY.EXPIRATION | --84h-Key-exp EXPIRE AFTER) i [octovo.mroe FLAG |) DESCRIPTION seloud compute sep securely copes files between avitusl machine instance and yout local mactine use the sep command. This command works for Linux VMs and Windows Server 2019 ard later VMs that have SSH enabled. gcloud compute ssh © - name gcloud compute ssh - SSH into a virtual machine instance synopsis (cloud compute ssh [ USER @] INSTANCE [--comand = COnANO] [--container = COWTAINER] [--éry-run] [ --force-key-file-overwrite]}| --plain}{ ~-ssh-flag = SSH. FLAG] | --ssh-key-file = SSH_KEY.FILE] triet-host-Key-checking = STRICT.MOST_KEY_CHECKING]|--troubleshoct ]{ --zone = Z0ME] ‘ennel: network = NETHORK ~-region = REGION Jp * DEST. GROUP} [--28h ation = SSHMEYLEXPIRATION | pepire-af ter = SSH_KEY_EXPIRE_AFTER] | GCLOUO_NIDE.FLAG J{~ SSH.ARGS | DESCRIPTION geloud compute ssh is athn wrapper around the ssh(1) command that takes care of authemtication and the translation of the instance name into an IP address To use SSH to connect to a Windows VM refer to this guide tps: cloud google com/compute/dees/connect/windows-ssh Figure 10: The documentation examples from GCP CLI. We crawl the website, remove the HTML tags and apply the renaming procedure as the documentation of the created LLM-Cloud CLI. # B.4 LLM-Cloud CLI More examples. on GCP CLI. In Table 2, we show more examples of the created LLM-Cloud CLI dataset, based Creating tool documentations. On the LLM-Cloud CLI dataset, we create tool documentations using the widely-used BeautifulSoup 2 library to scrape the GCP CLI documentation. We removed HTML tags and implemented the renaming procedures for LLM-Cloud CLI documentation. We note that we purposely do not eliminate unrelated content such as terms and hyperlinks. An example documentation from GCP before our renaming procedure is shown in Figure 10. This is to prevent excessive engineering of the documentation for better assessing the robustness of LLM documentation reading ability. Documentation retrieval details. Given the extensive number of command-line tools in our exper- iments (200 in total), the complete documentation cannot fit within a single prompt. Consequently, for each query, we employ a simple TF-IDF search to retrieve the top 10 relevant documentations. We then truncate the length to a maximum of 600 words. We note that the actual token count depends on the tokenizer used by each LLM and is typically more than 600. # 2https://pypi.org/project/beautifulsoup4/ 18 Table 2: More examples of the created LLM-Cloud CLI dataset. Question Commands in GCP Commands after renaming (Final Answer) Show me how to deploy ocr-xer container and invoke it with a schedule every 2 hours on a project “test_proj” in sdk command lines. The ocr-xer container is located at “us-docker.pkg.dev/gcr- cleaner/ocr-xer/ocr-xer”. • gcloud config set project test_proj ocr-xer • gcloud run deploy --image=us-docker.pkg.dev/gcr- cleaner/ocr-xer/ocr-xer • gcloud scheduler jobs create http NAME --schedule --schedule="0 */2 * * *" • llmcloud test_proj • llmcloud config set run deploy project ocr-xer --image=us-docker.pkg.dev/gcr- cleaner/ocr-xer/ocr-xer • llmcloud scheduler jobs make http NAME --schedule --schedule="0 */2 * * *" How to deploy a machine learning model model.pt saved in my local to cloud via sdk command line? • gsutil cp model.pt LOC/model.pt • gcloud ai-platform versions cre- ate VERSION --model MODEL -- origin gs://LOC/model.pt • llmutil cp model.pt LOC/model.pt • llmcloud ai-platform versions cre- ate VERSION --model MODEL -- origin gs://LOC/model.pt How to get transcript of a video test.mp4 at local via the cloud SDK? • ffmpeg -i test.mp4 -ac 2 -f wav out- put.wav • ffmpeg -i test.mp4 -ac 2 -f wav out- put.wav • gsutil cp test.wav LOC/test.wav • gcloud ml speech recognize-long- • llmutil cp test.wav LOC/test.wav • llmcloud ml speech recognize-long- running --uri LOC/test.wav running --uri LOC/test.wav How to create a composer enviroment with a private ip network? • gcloud composer environments cre- ate my_env • llmcloud composer environments make my_env • gcloud compute networks subnets update default --enable-private-ip- google-access • llmcloud compute networks sub- --enable- nets update default private-ip-google-access How to create a service account test@service.com with the name “AutoML” “BigQuery Data Editor” and “"AutoML Recommen- dations Service Account” permissions? • gcloud iam service-accounts test@service.com --display-name AutoML • gcloud projects add-iam- -- PROJ_ID policy-binding member="test@service.com" --role "roles/bigquery.dataEditor" • gcloud projects add-iam-policy- PROJ_ID --member --role • llmcloud iam service-accounts test@service.com --display-name AutoML • llmcloud projects add-iam- -- PROJ_ID policy-binding member="test@service.com" --role "roles/bigquery.dataEditor" • llmcloud projects add-iam-policy- PROJ_ID --member --role 19 # B.5 Image editing and video tracking As discussed in Section 4.3, by providing tool documentations, we can easily add on new tools to enable LLMs in solving novel tasks such as image editing and video tracking. Here, we leverage the recent advancements in vision models and expand the tool set used in VisProg [19] with three new tools: GroundingDINO [38], Segment Anything (SAM) [30], and XMem [14]. We provide their corresponding documentations in Figure 11. Function: BETTERLOC Description The BETTERLOC function calls the GroundingDINO model to perform object localization. GroundingDINO is a zero-shot text-conditioned object detection model. It returns all bounding boxes of the queried object. To make multiple queries at one time, separate different object names with “”. Syntax BETTERLOC(image: IMAGE, object: TEXT) -> BOX Parameters image: An IMAGE type input representing the image to be analyzed. object: A TEXT type input representing the object to be localized in the image. Returns The function returns a BOX value, representing the bounding boxes of the queried object. Use case: Use BETTERLOC when you want to locate an object in an image and retrieve its bounding box(es). Example: BOXO = BETTERLOC(image=IMAGE, object='cat') Function: BETTERSEG Description The BETTERSEG function calls the Segment Anything Model (SAM) for image segmentation. It returns all objects detected in the images as a list of OBJECT instances. Each OBJECT instance contain s its bounding box and mask. Syntax BETTERSEG(image: IMAGE, box: BOX) -> LISTIOBJECT] Parameters image: An IMAGE type input representing the image to be analyzed. box: The bounding boxes where we want to segment. Returns The function returns a LIST of OBJECT instances, each representing a detected object and including its bounding box, and mask. Use case: Use BETTERSEG when you want to segment an object in a bounding box. Then the returned objects can be used by other functions such as REPLACE, COLORPOP, BGBLUR. Example: BOXO = BETTERLOC(image: IMAGE, object: ‘fish’) OBJO=BETTERSEG(image=IMAGE, box=BOX0) Function: TRACK Description The TRACK function calls the XMem model for video object tracking. It takes an OBJECT instance from the first frame of the video as input then returns all frames where the object is highlight ed witha mask. Syntax TRACK(video: LIST[IMAGE], object: LISTT[OBJECT]) -> LIST[IMAGE] Parameters video: A list of IMAGE type input representing the video to be analyzed. object: The bounding boxes and masks of the objects which we want to track in the first frame of the video. Returns The function returns a list of a list of OBJECT instances representing the bounding boxes and masks of tracked objects in each frame. Use case: Use TRACK when you want to track an object in a video. Then the returned list of objects can be used by other functions. Example: VIDEOO=TRACK(video=VIDEO, object=OBJ) Important note: A video is a list of images. Use "IMAGE=EVAL(expr="{VIDEO)[i]")’ in a separate line to get the i-th frame of the video Figure 11: Documentation of new tools introduced in VisProg. BETTERLOC, BETTERSEG, TRACK calls GroundingDINO, Segment Anything, XMem, respectively. 20 # C Experimental results In this section, we show the experimental results on each task with comparisons to more baselines. ScienceQA. In Table 3, we compare zero-shot prompting with tool documentations to other baseline methods. We include the following baseline methods that are finetuned on the ScienceQA training set for performance reference: ViLT [29], VisualBERT [34], UnifiedQA CoT [39], MM-CoT [80], and LLaMA-Adapter [78]. We report the results obtained from [40] for the finetuned methods. For fair comparison, we shall focus on zero/few-shot settings. Thus, we include Chain-of-Thought (CoT) [67] and Chameleon [40] as the few-shot baselines to compare to. We see that with tool docs, we can not only achieve better performance than the few-shot methods without any demos, but we can also match (outperform) several models specifically finetuned on the dataset. Table 3: Comparing zero-shot prompting with tool docs to existing baseline methods on ScienceQA. We see that zero-shot prompting with tool docs performs competitively, outperforming the two few-shot baselines and several finetuned models. Finetuned methods Few-shot methods Zero-shot methods Benchmark ViLT VisualBERT UnifiedQA CoT MM-CoT LLaMA-Adapter CoT Chameleon 0-shot with docs ScienceQA 61.14 61.87 74.11 84.91 85.19 78.54 79.20 79.91 TabMWP. Similarly, in Table 4, we compare zero-shot prompting with tool docs to various finetuned models and few-shot baselines, inlcuding: UnifiedQA [26], TAPEX [36], Chain-of-Thought (CoT) [67], Program-of-Thought (PoT) [13], and Chameleon [40]. We report the results obtained from [40] for UnifiedQA, TAPEX, and CoT. We see that with tool docs, zero-shot prompting significantly outperforms finetuned models, and baseline few-shot methods, CoT and PoT. When compared to Chameleon that utilizes 16 few-shot tool-usage demos, tool docs enable the model to perform comparably without relying on any demos. Table 4: Comparing zero-shot prompting with tool docs to existing baseline methods on TabMWP. We see that with tool docs, even zero-shot prompting without any tool-usage demos achieves better performance than finetuned models and few-shot CoT and PoT baseline. It also performs comparably to Chameleon that employs 16-shot tool-usage demos. Finetuned methods Few-shot methods Zero-shot methods Benchmark UnifiedQA TAPEX CoT PoT Chameleon 0-shot with docs TabMWP 57.35 58.52 82.03 89.28 93.88 92.69 NLVRv2. In Table 5, we compare zero-shot prompting with tool docs to a finetuned model on NLVRv2 and various few-shot baselines. Specifically, we consider ViLT [29] as the finetuned baseline and VisProg [19] with varying numbers of tool-usage demos as the few-shot baselines. We report the result obtained from [19] for ViLT. Since VisProg does not utilize tool docs, we see that its performance is very sensitive to the number of demos used. In addition, we also observe large performance variances when we randomly select different demos used for prompting, e.g., the standard deviation for 2-shot prompting reaches 16.1 percentage point. This indicates that the few-shot demos may require careful curation for the model to achieve good performance. On the other hand, with tool docs, zero-shot prompting can already achieve decent performance compared to only using few-shot demos. Table 5: Comparing zero-shot prompting with tool docs to existing baseline methods on NLVRv2. Zero-shot methods Finetuned methods Few-shot methods Benchmark ViLT VisProg (0-shot) VisProg (2-shot) VisProg (4-shot) VisProg (12-shot) 0-shot with docs NLVRv2 76.30 0 43.1 ± 16.1 66.5 ± 1.4 69.1 ± 0.1 63.4 21 LLM Cloud-CLI. In Table 6, we present the results on LLM-Cloud CLI with different underlying LLM planners. On both text-davinci-002 and gpt-3.5-turbo, when there is a large number of tools, we see documentation is much more important than few-shot demonstrations, where zero- shot with docs achieves significantly better performances than few-shot without docs. Additionally, when provided with docs, the LLMs are able to figure out how to use the tools without the need of demonstrations. LLM text-davinci-002 gpt-3.5-turbo Table 6: Results on the LLM-Cloud CLI. Number of Demos Documentations 0 5 10 15 5 10 15 0 0 5 10 15 5 10 15 0 No No No No Yes Yes Yes Yes No No No No Yes Yes Yes Yes F1 0.02 0.02 ± 0.02(0.05) 0.05 ± 0.02(0.11) 0.05 ± 0.05(0.1) 0.35 ± 0.02(0.37) 0.35 ± 0.02(0.37) 0.35 ± 0.01(0.37) 0.37 0.13 0.18 ± 0.06(0.21) 0.19 ± 0.06(0.23) 0.18 ± 0.06(0.22) 0.44 ± 0.02(0.47) 0.44 ± 0.02(0.48) 0.42 ± 0.04(0.49) 0.45 Image editing. We provide more image editing examples achieved by zero-shot prompting with tool docs in Figure 12. In particular, we show that with tool docs, we are able to reproduce the image editing examples achieved by VisProg [19] without using any few-shot demos, wherein VisProg relies on 10 task-specific few-shot demos. 22 Instruction: Replace man in black henley (person) with brick wall Program: OBJO=SEG(image=IMAGE) OBJ1=SELECT(image=IMAGE,object=OBJO,query='man wearing a black henley’,category='person’) IMAGEO=REPLACE(image=IMAGE,object=OBJ1,prompt='brick wall’) FINAL_ANSWER=RESULT(var=IMAGEO) Instruction: Hide Salman and Aamir's faces with :ps, Shahrukh’'s faces with 8) and Hritik’s with ;) Program: OBJO=FACEDET(image=|MAGE) OBJ1=SELECT(image=|MAGE,object=OBJO,query='Salman Khan,Aamir Khan,Shahrukh Khan,Hritik Roshan’,category='face’) OBJ2=SELECT(image=IMAGE,object=OBJ1,query='Salman Khan,Aamir. Khan',category="face’) OBJ3=SELECT(image=IMAGE,object=OBJ1,query='Shahrukh Khan',category="face’) OBJ4=SELECT(image=IMAGE,object-OBJ1,query='Hritik Roshan’,category="face’) IMAGEO=EMOJI(image=IMAGE, object=OBJ2,emoji="face_with_tongue’) IMAGE1=EMOJIimage=IMAGEO,object=OBJ3,emoji='smiling_face_with_sunglasses') IMAGE2=EMOJI(image=IMAGE1,object=OBJ4,emoji='winking_face’) FINAL_ANSWER=RESULT(var=IMAGE2) Instruction: Create a colorpop of the man in black henley and also blur the background Program: OBJO=SEG(image=IMAGE) OBJ1=SELECT(image=IMAGE, object=OBJO, query='man wearing black henley’, category='person’) IMAGEO=COLORPOP(image=IMAGE, object=OBJ1) IMAGE1=BGBLUR(image=IMAGEO, object=OBJ1) FINAL_ANSWER=RESULT(var=IMAGE1) Figure 12: Image editing examples by zero-shot prompting gpt-3.5-turbo with tool docs. Zero- shot prompting with docs is able to reproduce the results achieved by VisProg using few-shot demos [19]. 23
"Title: FewCLUE: A Chinese Few-shot Learning Evaluation Benchmark:\n Summary:\nPretrained Language M(...TRUNCATED)
"Title: CERT: Contrastive Self-supervised Learning for Language Understanding:\n Summary:\nPretraine(...TRUNCATED)
"Title: minicons: Enabling Flexible Behavioral and Representational Analyses of Transformer Language(...TRUNCATED)
"Title: ReAct: Synergizing Reasoning and Acting in Language Models:\n Summary:\nWhile large language(...TRUNCATED)
"Title: Fusion of Detected Objects in Text for Visual Question Answering:\n Summary:\nTo advance mod(...TRUNCATED)
"Title: CValues: Measuring the Values of Chinese Large Language Models from Safety to Responsibility(...TRUNCATED)
"Title: Mastering Diverse Domains through World Models:\n Summary:\nGeneral intelligence requires so(...TRUNCATED)
README.md exists but content is empty.
Downloads last month
38