You can edit almost every page by Creating an account and confirming your email.

Toolformer

From EverybodyWiki Bios & Wiki



ToolFormer is a method that enhances large language models (LLMs) by enabling interactions with external tools. Integrating tools with language models improves performance on complex tasks like question answering and arithmetic (on which LLMs have historically performed poorly[1]) with minimal human intervention. It also enables LLMs to answer queries about events outside the model's training data, which is impossible for a conventional LLM. Since its introduction in 2023, ToolFormer has gained considerable attention for its potential to extend LLM functionality and improve its adaptability to complex tasks.

Method

Dataset Creation

The model takes as input some plain text dataset represented as C={x1,...,x|C|} and adds possible API calls to it, resulting in an augmented dataset C*. This is done by first sampling potential API calls for up to k candidate positions by calculating the probability of the Language Model M assigning an API call (<API>) as a continuation of a given sequence at position i for each i{1,...,n} as pi=pM(<API>|P(x),x1:i1). Only the top k positions with probability pi>τs, where τs is a threshold, are kept, and for each such position, m API calls are sampled.

Next, all the sampled API calls ci are executed and responses ri are collected (where ri is a text sequence). After this, API calls are filtered based on cross entropy loss values for the model. Loss is calculated as Li(z)=j=inwjilogpM(xj|z,x1:j1) given the model is prefixed with 𝐳 and weights are given as a sequence (wi|i). Cross entropy loss is calculated for two cases – (i) when the API call is made and the results are used in M and (ii) when the API call is not made at all or it’s made but the response is not provided. These are computed using the following formulas: (i) Li+=Li(e(ci,ri)), (ii) Li=min(Li(ε),Li(e(ci,ε))) where ε is an empty sequence. Given the losses, APIs are filtered based on threshold τf such that LiLi+τf and the resulting APIs are added to the input. As a result, an augmented dataset C* is produced which is used in model finetuning.

Training

For training and evaluation, the authors used a subset of CCNet[2](dataset C) and GPT-J (language model M).

Evaluation

Authors compared four models in their experiment including GPT-J without finetuning, GPT-J finetuned on a subset of CCNet without API calls, Toolformer finetuned on the augmented dataset with API calls, and Toolformer with disabled API calls. These models, along with larger models – OPT and GPT-3 – were evaluated based on their performance on different downstream tasks without in-context examples fed into the model. The goal of this experimental setup is to see if the model can correctly decide which tools to use and how without users' directions.

When evaluated on subsets of LAMA[3][4] benchmark to fill in a missing part in a short statement, Toolformer with API calls outperforms all other models listed above. For math tasks evaluated using ASDiv,[5] SVAMP, and MAWPS,[6] Toolformer models with and without API calls outperform all the other models, with Toolformer with API outperforming all the baseline models. Similar results are observed for temporal datasets as well evaluated on TempLama[7] and a custom Dataset to check the utility of the Calendar API. Toolformer with API outperforms all the models except for GPT-3 in question answering task as well evaluated on Web Questions,[8] Natural Questions,[9] and TriviaQA[10] datasets. However, Toolformer shows worse performance for multilingual question answering tasks evaluated on MLQA.[11]

Benefits

Eliminate Memorization

Although LLMs are great at memorizing, they can't memorize every detail from the training set and consequently might not provide satisfactory responses to specialized questions. Integrating tools with LLMs (especially search/retrieval augmented generation) may help them respond better.

Enhanced Expertise

LLMs are generally trained on enormous corpora and may lack domain-specific knowledge, even when finetuned. Providing tooling for specific tasks, like a calculator, may improve expertise.

Interpretability

Explainable Artificial Intelligence is becoming very relevant, and tracking the tools that LLMs leverage can help us understand their decision-making process by recording when/how they're leveraged and their inputs and outputs.

Applications

Integrating tools with LLMs can be used to solve many challenging problems. Notably, search engines can be enhanced to use generative artificial intelligence techniques, like perplexity.ai[12] or Google's new AI overview feature.[13] Most LLM APIs specify techniques to help their models interact with other APIs[14][15][16]

Authors

The authors of the paper in which the Toolformer[17] model was introduced are Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, Thomas Scialom. Roberto Dessì is affiliated with Universitat Pompeu Fabra. All the other authors have an affiliation with Meta AI Research.

References

  1. "Measuring Mathematical Problem Solving With the MATH Dataset" (PDF).
  2. Wenzek, Guillaume; Lachaux, Marie-Anne; Conneau, Alexis; Chaudhary, Vishrav; Guzmán, Francisco; Joulin, Armand; Grave, Edouard (2019-11-14), CCNet: Extracting High-Quality Monolingual Datasets from Web Crawl Data, arXiv:1911.00359
  3. "Facebookresearch/LAMA". GitHub.
  4. Petroni, Fabio; Rocktäschel, Tim; Lewis, Patrick; Bakhtin, Anton; Wu, Yuxiang; Miller, Alexander H.; Riedel, Sebastian (2019-09-04), Language Models as Knowledge Bases?, arXiv:1909.01066
  5. "Facebookresearch/LAMA". GitHub.
  6. Koncel-Kedziorski, Rik; Roy, Subhro; Amini, Aida; Kushman, Nate; Hajishirzi, Hannaneh (June 2016). "MAWPS: A Math Word Problem Repository". In Knight, Kevin; Nenkova, Ani; Rambow, Owen. Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. San Diego, California: Association for Computational Linguistics. pp. 1152–1157. doi:10.18653/v1/N16-1136. Search this book on
  7. Dhingra, Bhuwan; Cole, Jeremy R.; Eisenschlos, Julian Martin; Gillick, Daniel; Eisenstein, Jacob; Cohen, William W. (2022). Roark, Brian; Nenkova, Ani, eds. "Time-Aware Language Models as Temporal Knowledge Bases". Transactions of the Association for Computational Linguistics. 10: 257–273. doi:10.1162/tacl_a_00459.
  8. Talmor, Alon; Berant, Jonathan (2018-03-18), The Web as a Knowledge-base for Answering Complex Questions, arXiv:1803.06643
  9. Kwiatkowski, Tom; Palomaki, Jennimaria; Redfield, Olivia; Collins, Michael; Parikh, Ankur; Alberti, Chris; Epstein, Danielle; Polosukhin, Illia; Devlin, Jacob; Lee, Kenton; Toutanova, Kristina; Jones, Llion; Kelcey, Matthew; Chang, Ming-Wei; Dai, Andrew M. (2019). Lee, Lillian; Johnson, Mark; Roark, Brian; Nenkova, Ani, eds. "Natural Questions: A Benchmark for Question Answering Research". Transactions of the Association for Computational Linguistics. 7: 452–466. doi:10.1162/tacl_a_00276.
  10. Joshi, Mandar; Choi, Eunsol; Weld, Daniel S.; Zettlemoyer, Luke (2017-05-13), TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension, arXiv:1705.03551
  11. Lewis, Patrick; Oguz, Barlas; Rinott, Ruty; Riedel, Sebastian; Schwenk, Holger (July 2020). Jurafsky, Dan; Chai, Joyce; Schluter, Natalie; Tetreault, Joel, eds. "MLQA: Evaluating Cross-lingual Extractive Question Answering". Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. Online: Association for Computational Linguistics: 7315–7330. doi:10.18653/v1/2020.acl-main.653.
  12. "Perplexity AI".
  13. "Google Search AI Overview". 14 May 2024.
  14. "ChatGPT function calling".
  15. ""Llama function calling"".
  16. "Claude (Anthropic) function calling".
  17. Schick, Timo; Dwivedi-Yu, Jane; Dessì, Roberto; Raileanu, Roberta; Lomeli, Maria; Zettlemoyer, Luke; Cancedda, Nicola; Scialom, Thomas (2023-02-09), Toolformer: Language Models Can Teach Themselves to Use Tools, arXiv:2302.04761


This article "Toolformer" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Toolformer. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.