Applications developers to have an artificial intelligence system that is expert in understanding and writing the Spanish language

28 July 2021
The model has been created at the Barcelona Supercomputing Center (BSC) and has been trained on the MareNostrum supercomputer with data files from the Biblioteca Nacional de España (BNE). 

The project has been financed with funds from the Language Technologies Plan of the Ministry of Economic Affairs and Digital Agenda and the Future Computing Center, an initiative of the BSC and IBM.

MarIA, which is the name of the system, is available at no cost so that any developer, company or entity can use it at no cost. Its possible applications range from language correctors or predictors, to automatic summarization applications, chatbots, smart searches, translation engines and automatic subtitling, among others. These are the WARC resulting from the tracking and archiving of the Spanish website, which the BNE keeps, by virtue of the legal deposit law, as documentary heritage. The BSC has been able to use them to train the system thanks to the participation of both institutions in the Language Technologies Plan.

First massive AI model in the Spanish language

MarIA is a set of language models or, in other words, deep neural networks that have been trained to acquire an understanding of language, its vocabulary and its mechanisms to express meaning and write at an expert level. They manage to work with short and long interdependencies and are able to understand not only abstract concepts, but also their context.

The first step in creating a model of the language is to develop a corpus of words and phrases, which will be the basis on which the system will be trained.

59 terabytes (equivalent to 59,000 gigabytes) from the Biblioteca Nacional de España web archive were used to create the MarIA corpus. Subsequently, these files were processed to remove anything that was not well-formed text (such as page numbers, graphics, endeless sentences, wrong encodings, duplicate sentences, other languages, etc.) and only well-formed texts were saved in the Spanish language, as it is actually used. For this screening and its subsequent compilation, 6,910,000 hours of MareNostrum supercomputer processors were required and the results were 201,080,084 clean documents, occupying a total of 570 gigabytes of clean text without duplications.

This corpus exceeds the size and quality of the corpus available today by several orders of magnitude. It is a corpus that will enrich the digital heritage of Spanish and the BNE's own archive and that may be used for multiple applications in the future, such as having a temporary image that allows analyzing the evolution of the language, understanding the digital society in its set and, of course, the training of new models.

Once the corpus was created, the BSC researchers used neural network technology (based on the Transformer architecture), which has shown excellent results in English and was trained to learn to use the language. Multilayer neural networks are an artificial intelligence technology and the trainings consist, among other techniques, in presenting texts with hidden words to the network, so that it learns to find out which is the hidden word given its context.

This training required 184,000 processor hours and more than 18,000 GPU hours. The models released so far have 125 million and 355 million parameters respectively.

Marta Villegas, project manager and BSC text mining group leader, explains the importance of being able to implement new Artificial Intelligence technologies, “which are completely transforming the field of natural language processing. With this project, we contribute to the country joining this scientific-technical revolution and positioning itself as a full-fledged actor in the computational treatment of Spanish language”.

Alfonso Valencia, BSC Life Sciences department director, argues that “the BSC's High Performance Computing infrastructure has proven to be essential for this type of large projects that require both a lot of computing and large amounts of data. For us, it is very satisfactory to put technical capacities and expert knowledge at the service of a project with so many repercussions for the position of Spanish in the digital society”.

The Biblioteca Nacional de España, as established by its regulatory law, has among its functions “to promote and support research programs aimed at generating knowledge about its collections, establishing spaces for dialogue with research centers”. With this project, framed in the Language Technologies Plan, the BNE explores new ways of exploiting the data and collections it conserves, and seeks to promote reuse, new research projects and improve citizens' access to information.

Next steps

After releasing the general models, the BSC text mining team is working on expanding the corpus, with new file sources that will provide texts with different particularities from those found in web environments, such as scientific publications from the CSIC.

The generation of models trained with texts from different languages ​​is also planned: Spanish, Catalan, Galician, Euskera, Portuguese and Spanish from Latin America.

BSC and Plan-TL

The BSC is the technical office of the Language Technologies Plan (Plan-TL) of the Secretary of State for Digitalization and Artificial Intelligence (SEDIA). As such, its mission is to facilitate the development of more competitive language systems for society, companies and research groups, making both general and specific language models public - for domains such as biomedicine or legal - and releasing sets of text for train and evaluate new models.

Further information about the Plan-TL:

RoBERTa-base Model:

RoBERTa-large Model:

Information repository: