LIVE
The Berzelius supercomputer at Linköping University, where GPT-SW3 was trained
Photo: Erik And30
Retrospective · Milestones

GPT-SW3: when Sweden built its own language model

· AInu-redaktionenSweden

While the world had yet to hear of ChatGPT, AI Sweden, RISE and WASP were training the first large generative language model for Swedish on the Berzelius supercomputer in Linköping.

Retrospective written in 2026 by the AInu editors with the help of AI, based on the sources below.

In the summer of 2022, half a year before ChatGPT made large language models a dinner-table topic, an unusual project was under way in Linköping. On the Berzelius supercomputer, researchers from AI Sweden, RISE and WASP were training the largest language model ever built for Swedish. It was called GPT-SW3, and it was an early attempt to answer a question that has grown ever more important since: does a small language area need its own AI models?

Background: an English AI

When OpenAI released GPT-3 in 2020, it showed that a large enough language model could write coherent text about almost anything. But the model was trained on data that was overwhelmingly English. It could write Swedish, but less well, and it was a commercial service from an American company that Swedish agencies and businesses could neither inspect nor run themselves.

For a country of ten million people it was not obvious that it could build something of its own. Training a large language model takes huge amounts of text and computing power. But Sweden had two assets. One was AI Sweden, the national centre for applied AI. The other was Berzelius, an AI supercomputer at Linköping University built with Nvidia’s DGX systems.

The first model

The project was a collaboration between AI Sweden, the research institute RISE and WASP’s research arena WARA Media & Language. A first model was presented in December 2021, and in June 2022 the researchers described it in a paper at the international language technology conference LREC in Marseille.

The model had 3.5 billion parameters and was trained on a newly assembled Swedish text collection of about 100 GB. The authors, among them Ariel Ekgren, Evangelia Gogoulou, Joey Öhman and Magnus Sahlgren, described how they collected the data, how training went and how hard it was to evaluate a generative model in Swedish. Measurements showed it kept pace with other models of the same size, and tests with different prompts showed it could write coherent Swedish text.

“Our little model is an incredibly good proof of concept,” Ariel Ekgren said, according to Dagens PS on 9 June 2022.

How a language model is trained

A language model like GPT-SW3 learns by reading huge amounts of text and guessing the next word over and over again. Each time it guesses wrong, billions of small numbers, parameters, in the neural network are adjusted so that the guess is a little better next time. After enough rounds the model has built up a statistical picture of the language rich enough to write new text, answer questions and summarise.

Two things determine how good the result is: the amount of data and the amount of computation. For Swedish the first is the big problem. There is simply far less Swedish text than English. So AI Sweden chose, in the next step, to build a Nordic model in which Swedish is supplemented by the closely related Norwegian, Danish and Icelandic, as well as English.

The computation was done on Berzelius with Nvidia’s Megatron software, which is designed to spread the training of very large models across hundreds of graphics processors.

Summer 2022: bigger models

The plan presented in June was ambitious. Over the summer the team would train a GPT-SW3 with up to 175 billion parameters, as large as GPT-3, on about a terabyte of text. AI Sweden wanted the model to be available to every part of society if it worked as intended.

According to Nvidia, GPT-SW3 was trained on Berzelius in June, and a more powerful version with 20 billion parameters could, among other things, help developers write code. Nvidia also said that a large Swedish bank was exploring a chatbot built on the latest version, and that Berzelius would be expanded with another 34 DGX systems to reach nearly half an exaflop of AI performance.

The release

The work continued into 2023. In January AI Sweden opened a pre-release for Nordic organisations and researchers, who had to apply for access. In December 2023 the models were released openly, so that any company, agency or organisation could use them. The family then comprised six sizes, from 126 million to 40 billion parameters. The researchers described the work in a paper as the first large generative language model developed natively for the Nordic languages.

What GPT-SW3 meant

In hindsight it is easy to see GPT-SW3’s limitations. By the time the models were released openly, ChatGPT and GPT-4 had set a bar that no national effort with a few tens of billions of parameters could reach. The commercial models from the big American companies also quickly got better at Swedish.

But the project served several purposes. It showed that Sweden had the skills and infrastructure to train large models. It built up knowledge about Swedish training data and how to evaluate Swedish language models. And it gave Swedish organisations a model they could run on their own servers, without sending sensitive information to a foreign cloud company. That question of digital sovereignty has since become one of the most debated topics in Swedish and European AI policy.

GPT-SW3 also gave AI Sweden a place in European collaboration on language models. The organisation has since taken part in broader Nordic and European projects, including models covering many European languages.

Above all, GPT-SW3 was a sign that Sweden took the development seriously before it became widely known. When ChatGPT launched in November 2022, there was already a Swedish group that knew how such models were built.

Sources