The ROOTS Search Tool: Data Transparency for LLM s (2023)

Abstract: ROOTS is a 1.6TB multilingual text corpus developed for the training of BLOOM, currently the largest language model explicitly accompanied by commensurate data governance efforts. In continuation of these efforts, we present the ROOTS Search Tool: a search engine over the entire ROOTS corpus offering both fuzzy and exact search capabilities. ROOTS is the largest corpus to date that can be investigated this way. The ROOTS Search Tool is open-sourced and available on Hugging Face Spaces: https://huggingface.co/spaces/bigscience-data/roots-search . We describe our implementation and the possible use cases of our tool.

## introduction large language models (llms) are ubiquitous in modern nlp, used directly to generate text and as building blocks in downstream applications. the ever-increasing size of the latest models inflates the demand for massive volumes of training data @xcite , in practice sourced mainly from the web. this raises questions concerning the quality of the data, the feasibility of curating and inspecting it, as well as documenting it in terms of what kinds of speech and speakers it represents @xcite @xcite . without that level of characterization, we cannot tell for what varieties of language the resulting models can be expected to work well, whether the data was ethically sourced, how to interpret evaluation metrics, and to what degree a particular output was memorized directly from the training data. in an encouraging new trend, we see researchers exploring ways to quantitatively describe large datasets @xcite . however, user-friendly tools for an extensive qualitative analysis are still predominantly missing. in our current work, we aim to fill that gap for a specific, web-scale, textual corpus. building on the efforts of the bigscience workshop, foot_0 we present the roots search tool foot_1 a search engine for the the 1.6tb multilingual roots corpus (laurençon et al., 2022). the roots corpus was created to pre-train bloom (scao et al., 2022)-the first llm of its scale designed with commensurate efforts in responsible licensing foot_2 and data governance (jernite et al., 2022). we hope that our tool will facilitate qualitative analysis of the web-scale roots corpus, and establish the qualitative analysis of training data-critical for the model understanding and governance work-as an essential step in the development of llms. corpus linguistics. the core methodology for studying large volumes of text was developed in corpus linguistics @xcite , an area of research responsible for curating large text collections carefully designed to represent specific varieties of language. for example, the 100m word british national corpus (leech, 1992) was created to represent the spoken and written british english of the late 20th century, with each text handpicked by experts, who also procured appropriate copyright exemptions. similar national corpora were later created for many other languages, e.g. japanese @xcite . the texts were often accompanied by multiple layers of annotationssyntactic, morphological, semantic, genre, source etc. this enabled valuable empirical research on the variants of represented languages, finding use in early distributional semantic models. corpus linguistics developed sophisticated methodologies including concordances, word sketches and various word association measures @xcite @xcite . however, this methodology did not adapt well to web-scale corpora due to the lack of tools and resources that could support such scale. web-scale corpora for llm pre-training. as llms grew, so did the need for massive pretraining datasets. to date, there were several efforts to collect and clean large english and multilingual corpora @xcite @xcite @xcite . non-english, monolingual corpora of this scale have also started to emerge @xcite however, the sheer scale of such datasets renders them hard to properly curate: we now know that the data used for training llms may contain synthetic data @xcite , privacy-infringing data @xcite , incorrect language codes or and translations @xcite , as well as the ubiquitous issues with social biases @xcite @xcite . another issue pertains to the permissions to use the data, which, perhaps the most famously, surfaced in relation to the bookcorpus @xcite , used, among others, to train bert @xcite , but collected without author permissions and eventually taken down by the authors @xcite . these issues are a consequence of the fact that the current web-scale corpora are opportunistic samples of publicly available text, rather than artifacts curated to provide a representative snapshot of a specific language variety, as in the corpus linguistics work @xcite . this highlights the general problem with the lack of documentation in nlp datasets of all sizes @xcite , and the fact that data work has generally not been a priority in nlp recently @xcite . ## the roots corpus the roots corpus @xcite is a high-quality, heterogeneous, multilingual text corpus collected as part of the bigscience project to train the bloom llm @xcite . roots consists of 1.6tb of data in 46 natural and 13 programming languages. the full roots dataset is open to the members of the bigscience data organization on the hugging face hub, which the interested researchers can still apply to join foot_5 . ## implementation fuzzy search backend. the roots corpus is organized in 498 datasets, each annotated with a language identifier. there are two types of identifiers: those indicating an individual language (e.g. pt for portuguese), and those indicating a language within a language group (e.g. indic-mr for marathi, as part of the indic language group). all programming languages are collected under a common code tag. we build 13 sparse, bm25 @xcite indices: one per language group for the indic and nigercongo groups, one for code, and one for each of the remaining languages (except chinese, where we combine the tags zh, zht, and zhs into a single index). exact search backend. we leverage a suffix array implementation foot_10 proposed by @xcite . we build the suffix array for the whole roots corpus, this time without the split into languages or language groups. we host both the bm25 indices and the suffix array on hugging face-provisioned machines. the server code is open-sourced foot_11 . frontend and user experience. the roots search tool user interface is built with gradio @xcite and served via hugging face spaces. 13 . by default, searches are performed in fuzzy mode, in order to move to the exact search one can enclose the query in double quotes. fuzzy searches can be performed in a user-specified language, or in all languages (in that case results are surfaced separately for each language). we also provide an option to auto-detect the language of the query with a fasttext classifier @xcite . results are displayed in the order of decreasing relevance; users can control the maximum number of results they want to see using a slider. in exact search mode, the backend returns all documents matching a given query exactly irrespective of the language, and they are displayed over multiple pages in a random order, with the max results parameter controlling the size of a single page. the total number of matched results is displayed at the top of the results page. pii redaction is applied to all results on the backend side. the tool also allows users to filter out all results from a specific dataset appearing on a given page. ## use cases detecting pii issues to improve obfuscation. bloom was trained with efforts to detect and obfuscate personally identifiable information, or pii (e.g. email and personal addresses, age, phone numbers or government-issued identifiers such as license plates) in the original roots documents. as described in section 3.2, we build on that effort when obfuscating pii in search results. however, it is still possible that some such data was not detected. the tool allows searching for the specific pii by concerned individuals, which is the first step for requesting removal of their data. one could also simply search for their name to see if they are represented in the corpus, and how. detecting undesired content. text from web crawls contains all kinds of undesired content @xcite . examples of possible classes of problems include hate speech, pornography, synthetic text (e.g. machine-translated text, ai-generated text), word lists that are not meaningful and are meant to trick search engines @xcite , factually incorrect text such as fake news or conspiracy theories, among others. for example, we found at least 5 snippets from the oscar source incorrectly arguing that barack obama was born in kenya. while the creators of roots employed filtering strategies targeted specifically at spam and machine-generated content @xcite , developing filters for such content is a never-ending arms race with its producers, and the only way to keep improving them is to look at the data-which our tool enables. ## limitations and future work a major limitation of this work is that to mitigate possible issues on the data governance side, we can only provide short snippets of the indexed texts, as is typical of web search engines. we strive to provide links to the original text sources, but this metadata is not consistently available in roots. implementation-wise, the current version of exact search is exact down to capitalization and punctuation, and fuzzy search can be noticeably slower. these issues will be addressed in future versions. the current tool is heavily influenced by the ux of search engines, and its core functionality is similar. in future we intend to review classic corpus analysis tools for ideas of different presentation modes, such as concordance and word sketches. we would like to add more quantitative information, e.g. term frequency information, number of hits, and co-occurrence statistics. community feedback and suggestions are welcome in the community tab of the demo. we are also pursuing a spin-off collaboration with pyserini to make large scale indexing and hosting of textual data even more seamless. ## impact statement our tool aims to improve the current state of documentation search for large corpora of web-scraped text, starting with the roots corpus. however, it also comes withe ethical considerations: for instance, it can also inadvertently display sensitive information such as pii and harmful content, and help malicious actors find information about a given topic from multiple sources (which is more difficult given only the raw text of the corpus). we are aware of these limitations, and have taken precautions to compensate for them, such as the pii redaction measures we present in figure 2 . we also present only a snippet of the raw text, which means that for accessing the full documents, users much sign up to be a part of the big science organization on the hugging face hub, which also reduces the amount of information that potentially malicious anonymous users can access.