Elamur Research

Lessons Learned from GPT-SW3: Building the First Large-Scale Generative Language Model for Swedish

Paper · 2022 · Ariel Ekgren, Amaru Cuba Gyllensten, Evangelia Gogoulou et al.

Summary

Building a system that can write in Swedish requires enough Swedish text to train it and a way to judge what it can do. Both were hard to come by at the scale the authors wanted. They built GPT-SW3, a language model with 3.5 billion parameters that generates text by predicting one piece at a time. They assembled a 100 GB Swedish training corpus from existing collections and newly gathered web material. It covered genres from parliamentary speech to fiction, but much of its volume came from web sources, including forums and news. The paper follows the work from assembling that collection and training on a computing cluster to finding workable substitutes for a Swedish benchmark that was still under development.

The authors measured how well GPT-SW3 and three other systems predicted text drawn from mc4. They scored the predictions per character so that systems which split the same passage into different numbers of pieces could be compared. GPT-SW3 had the lowest average character-level perplexity on the Swedish sample, at 2.19. GPT-Neo scored 2.87 and the earlier Swedish Flashback-GPT scored 4.76. On the English sample, GPT-Neo led at 2.11, while GPT-SW3 scored 2.70. The rankings show a Swedish advantage for GPT-SW3 under this test, with the strongest English results coming from systems developed for English.

The authors also tested what GPT-SW3 would write when given a task in its input. It produced formatted emails, carried on conversations, continued a speech, and reused the organization of a hiking checklist for a new list. In Swedish-to-English translation, the share of outputs using Swedish among the 22 tested translations fell from 17% with an instruction alone to 0% when the prompt contained several worked examples. The translations also exposed failures that a language check alone would miss. A question could elicit a reply, and a sentence could come back in English with its meaning changed.

The experiments give two views of the same system. Perplexity measures how much probability it gives to existing text. The writing trials show which tasks it can carry out under particular prompts and generation settings. The examples make structure especially visible. Speaker labels can cue a dialogue, and a sequence of numbered items can cue a list. Performance in these trials depended on choices the authors refined by hand, so the paper establishes a set of demonstrated behaviors and documents how the authors elicited them. Their frequency across ordinary inputs remains open.

Deep dive: Lessons Learned from GPT-SW3: Building the First Large-Scale Generative Language Model for Swedish

How GPT-SW3 was trained on Swedish text, how it compared with other systems on perplexity, and what its prompting experiments revealed. · about 32 minutes to read

The problem and its context

Swedish text generation had a different starting point

A generator has to learn both what expressions occur in a language and how they fit together over a passage. A plausible continuation of a public address calls for different choices from a continuation of a discussion thread. Training on many kinds of writing gives a system opportunities to encounter those differences. For Swedish, the authors describe a shortage of large, publicly available text collections. The difficulty was to gather a corpus big enough to support a large generator while drawing on enough kinds of writing to make it more broadly applicable than a system trained on a single source.

The size of the networks then being built made this problem more acute. The paper traces the GPT line through GPT-2, with 1.5 billion parameters, and describes larger systems such as Megatron-LM, with 8.3 billion. Parameters are the adjustable values learned during training. The paper uses these counts to establish the engineering scale at which the field was working. Its account of that work includes Megatron-LM.

The authors also describe an effort to make larger generators available through EleutherAI. Its releases included GPT-Neo with 2.7 billion parameters and GPT-J with 6 billion. The line also included an open-source autoregressive system with 20 billion parameters, GPT-NeoX-20B. Those releases mattered to the setting of the paper because an English generator could serve as a point of comparison even when a comparable Swedish system was scarce.

For languages other than English, the paper describes a smaller set of projects concentrated around GPT-2 scale. It points to generators for Italian, French and Russian, as well as an effort to recycle an English GPT-2 for Dutch and work on Arabic text generation. The Arabic example is AraGPT2. The earlier Dutch work is As Good as New.

In Sweden and the other Nordic countries named in the paper, the authors describe much of the preceding work as training encoders such as BERT. An encoder builds a representation of a supplied passage. A GPT-style generator is trained to predict what follows a supplied prefix, which allows it to write onward from that prefix. Swedish encoder development therefore represented a body of work with a different training purpose. One example the authors cite is Swedish BERT.

The closest Swedish precedent was an open-domain conversational GPT trained on text from Flashback, a Swedish discussion forum. In its historical account, the paper describes the earlier project as training a 1.5 billion parameter system on 23 GB of forum material. That precedent established that Swedish GPT-style training was possible. It also gave the GPT-SW3 authors a Swedish comparison whose training material had a much narrower source. A forum can supply large volumes of replies, arguments and informal language. A broader generator also has to learn the conventions of writing that has a different audience and purpose.

A generator needed a way to show what it had learned

The earlier GPT research motivated the authors to look beyond fluent continuation in isolation. A task could be conveyed in ordinary text, and the generator could attempt it without receiving task-specific training before the test. A prompt can contain just an instruction, or it can show examples before asking for a new response. In the latter case the examples form part of the input at the moment of use. That is the distinction between zero-shot use and few-shot learning.

This arrangement makes a shared test set especially valuable. When systems receive comparable tasks, the resulting answers can reveal what each does with the information available in a prompt. The paper notes that GPT-3 was examined on 43 English datasets in zero- and few-shot settings. The corresponding Swedish effort the authors knew of was still being developed. Those were very different evaluation conditions, even for researchers training systems intended to be used in much the same way. The English reference point was Language Models are Few-Shot Learners.

The authors also describe a general problem in assessing generated writing. An email can satisfy its request with many different wordings. A continuation of a speech can be recognizable as a speech while making a different choice about what to say next. A translation has to preserve meaning, but its wording can legitimately vary. A single reference string would be a poor description of all the acceptable answers to these tasks. The paper cites work on inconsistent human evaluation of generated language to explain why a standardized test would require decisions about precisely what to judge.

At the same time, predicting an existing passage offers a numerical test with a clear target. The text already supplies what occurs next at each position. That makes predictive evaluation practical across many positions without commissioning judgments for each generated passage. The complication is that each system can have its own way of dividing the text into units. A fair comparison has to account for this, especially when the test spans systems trained primarily on different languages. The paper connects its choice of a character-based measure to earlier work on comparing language prediction across languages, including Are All Languages Equally Hard to Language-Model?.

These constraints shaped the study. The authors needed to build the Swedish corpus and train the generator before they could ask what it had learned. They then needed an evaluation with enough common ground to compare it to earlier systems, as well as an examination of the uses that motivated the project. Prediction on existing text and trying out tasks in prompts addressed different parts of that problem.

The method, step by step

Build a corpus from very different sources

The authors brought together existing Swedish collections and additional text gathered from the web. This was a practical way to reach the reported corpus size of 100 GB. It also combined materials whose language serves very different purposes. A record of a parliamentary intervention contains the vocabulary and conventions of debate. A subtitle collection contains dialogue. An encyclopedia article has its own way of introducing a topic and developing a description. All can supply training passages under the same prediction objective.

How the authors built and evaluated GPT-SW3

The steps in order.

How the authors built and evaluated GPT-SW3Step 1: Gather existing Swedish collections and new web text1. Gather existing Swedish collections and new web textStep 2: Filter unwanted material from the corpus2. Filter unwanted material from the corpusStep 3: Represent text as sequences of tokens3. Represent text as sequences of tokensStep 4: Train GPT-SW3 to predict the next token4. Train GPT-SW3 to predict the next tokenStep 5: Compare character-normalized prediction on mc4 samples5. Compare character-normalized prediction on mc4 samplesStep 6: Test writing and translation with varied prompts6. Test writing and translation with varied prompts

The largest entries in the corpus inventory were the miscellaneous web collection at 45.0 GB, OSCAR at 28.0 GB, and the Flashback forum collection at 22.0 GB. Their prominence is part of the method. The character of the resulting training material depends heavily on what can be gathered at that scale. The authors describe forums and news articles as major components of the web material and expect the large web sources to be of lower quality than the smaller curated collections.

The smaller sources nevertheless extended the range of genres available. The corpus inventory lists 5.3 GB for SOU under politics, 0.9 GB for Anföranden, and additional political material in DCEP and DGT. The legal sources include JRC and Författningar. Fass supplies medical text, and Litteraturbanken supplies books. There are also 1.3 GB of subtitles and 1.8 GB of Wikipedia. This breakdown tells the reader which kinds of text are represented and how unevenly they contribute by volume. The corpus contains much more than forum language, while large web collections still account for much of what the training procedure can draw on.

The preprocessing relied on filtering rules for unwanted material. The authors mention HTML markup and a blacklist targeting words they regarded as inappropriate, including sexual or obscene terms. The procedure could discard documents. In the discussion they characterize their overall approach as minimal filtering, reflecting the difficulty of acquiring enough Swedish text. Taken together, the two descriptions indicate that they applied some exclusions while favoring retention on a corpus-wide scale.

Their choice sits within a debate about whose language survives a cleaning rule. A blacklist can be applied consistently, but a word on it may occur in settings that have little in common. The authors cite an examination of the Colossal Clean Crawled Corpus that found consequences for the representation of minority groups after filtering. The relevance to GPT-SW3 is the decision the researchers faced about how aggressively to intervene. The earlier audit was Documenting Large Webtext Corpora.

The paper also cites a reported comparison in which heavier filtering of a training corpus was associated with weaker downstream performance. Here a downstream task means something the trained system is asked to do beyond predicting the next unit of its original training text. These earlier studies informed the authors’ preference to retain Swedish material. Their own corpus construction supplies the training conditions for GPT-SW3, with the comparative evidence about filtering coming from the prior work they discuss.

Train the network to continue a sequence

The input to GPT-SW3 consists of tokens, the pieces of text that the system treats as units. The same visible string can be divided in different ways by different systems. A token may represent a familiar word or a smaller piece of it. The process that converts the input text to those pieces is tokenization.

The training task is to predict the next token from the tokens that come before it. An existing passage thus provides both the context and the target. As training moves through a passage, later tokens become new targets and the preceding context changes. At generation time, there is no prewritten continuation to supply the target. The system produces a token, appends it to the context, and predicts again. This dependence on the growing sequence is what the paper means by autoregressive generation.

GPT-SW3 uses the GPT architecture as implemented in Megatron-LM. Its 30 layers repeatedly process the input representations. Attention allows the representation at a position to draw on information from earlier positions that the generator can see. Attention heads are parallel parts of that operation, giving a layer different ways to use the available context. The paper lists 32 attention heads, an embedding dimension of 3,072, and a sequence length of 2,048 tokens. The embedding dimension is the width of the numerical representation the system works with. Together these are architectural specifications of the Transformer.

The exact parameter count in the architecture table is 3,559,415,808. The authors chose their hyper-parameters using the results of earlier GPT training experiments. Hyper-parameters are settings selected for training or for the architecture, in contrast to the numerical weights that the training procedure adjusts. In this paper, the layer count and the length of an input sequence are examples of settings decided in advance. The training-scale work they drew on was Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM.

Over the course of training, 97,000 steps were completed using batches of 512. A batch supplies the examples used together for an update, while the step count records how many such training updates were run. The optimizer was Adam, which takes information from the prediction errors and uses it to adjust the parameters. The authors used the following weight-decay setting.

λ = 0.01

The symbol λ denotes the coefficient for weight decay, and 0.01 is its configured value. Weight decay acts on the learned weights during optimization. It is a setting of training, separate from the choices about how to sample a continuation when the trained system is used.

The run took 2.5 days on the Berzelius Superpod. The authors used 16 Nvidia DGX A100 servers, corresponding to 128 GPUs for their training run. In the description of the machine, each of those servers contains 8 Nvidia A100 GPUs with 320 GB of total GPU memory. The paper includes a curve of validation loss during training. Validation loss tracks prediction error on material reserved for checking training progress. The curve documents the course of the chosen run. The architecture, optimizer and hardware figures give the computational conditions under which it was carried out.

Compare prediction on a shared unit

Perplexity expresses how much probability a system gives to a passage. A generator that repeatedly assigns high probability to the units that actually appear in the text will earn a lower value. Each evaluated system still assigns probabilities to its own tokens. The authors put the outcome on a common scale by using the number of characters in the original passage when normalizing the total log probability.

PPL_c(X) = exp(−(1/c) ∑ᵢ₌₁ᵗ log p(Tᵢ | T_{<i}))

Here X is the original passage and c is its length in characters. T is the token sequence obtained by tokenizing X, and t is the number of tokens in T. The sum sign ∑ accumulates a contribution for each position, with index i starting at 1 and ending at t. Tᵢ means the token at position i, and T_{<i} means all tokens in T at positions before i. The vertical bar in p(Tᵢ | T_{<i}) indicates conditioning, so p is the system’s probability for the observed token given that preceding sequence. The operation log takes its logarithm. The minus sign turns the sum of log probabilities into a quantity that grows as the observed tokens receive lower probabilities. The factor 1/c averages that quantity over characters, and exp exponentiates it to give PPL_c(X), the character-normalized perplexity of X.

The division by character count addresses a specific problem with per-token scoring. Imagine that two systems are evaluated on the same passage, but one divides many of its words into smaller pieces. A per-token average uses a larger denominator for that system. Its score would reflect both its prediction and a counting choice that differs from the other system’s. The character count stays fixed when the passage stays fixed. This lets the authors compare scores for the same written material even when the token sequences differ.

The proposal still evaluates sequence probabilities from the actual trained systems. A model’s segmentation can affect how well it learns or predicts, and that influence can still appear in its score. Character normalization deals with the unit in which the result is reported. It leaves the predictive consequences of each system’s architecture, training data and representation in place.

Present tasks as text that has a natural continuation

For the qualitative experiments, the authors presented GPT-SW3 with text that set up a desired continuation. Some prompts began as translated examples from OpenAI documentation and were revised after trials. The authors developed other prompts from scratch and repeatedly adjusted them. The common idea was to give the generator enough context to make the intended action a plausible next part of the text. The same prediction mechanism used for prose could then produce a reply, an email, a summary or a translation.

An instruction is one way to convey the action. An example adds information about how the answer should look. In the email setup, a brief command can specify who is writing, who should receive the message and what it should ask. A demonstration can also convey where the greeting goes, how to turn the command into sentences and how to sign off. In dialogue, speaker labels indicate whose turn comes next. In translation, a Swedish input followed by a label for English specifies the role of the missing continuation. These choices change the text available to GPT-SW3 when it generates. The trained weights remain fixed during prompting, in contrast with fine-tuning.

The authors also adjusted decoding, the procedure that turns predicted probabilities into a continuation. Temperature changes how sharply the distribution favors the most probable tokens. Top-p restricts the candidates to a set that reaches a chosen amount of cumulative probability, starting from the most probable. Top-k sets a count limit on candidates ranked by probability. Beams let the decoder keep several partial continuations in play as it searches. The prompt recipes also report a repetition setting, which affects the treatment of material the system has already generated.

For most tasks the authors used temperature and top-p between 0.60 and 1.00, and between 2 and 6 beams. They observed that settings below 0.60 made repetitive loops more likely, while beam sizes of 6 or greater often caused memory failures. For more open-ended writing they generally favored somewhat higher temperature and top-p values to allow more variation. The configuration was chosen task by task, so a published result can reflect a combination of prompt design and decoding choices.

The appendices give concrete configurations for several tasks. For the dialogue prompt, the paper reports 4 beams, temperature 0.60, top-p 0.60, top-k 1000 and repetition 2.00. The translation prompt also used 4 beams, top-k 1000 and repetition 2.00, with temperature and top-p both at 0.80. The few-shot email recipe used 3 beams, temperature and top-p both at 0.70, top-k 1000 and repetition 2.50. These are settings for generating the displayed kinds of output. They matter to interpreting the examples because the prose of a prompt is only one part of the generation procedure.

Experiments and results

Predicting Swedish and English text

The authors chose mc4 with two aims in mind. They wanted originally Swedish text for the Swedish test, and they sought material the evaluated systems had likely never seen. They describe the latter as a judgment made to the best of their knowledge. With limited compute for evaluation they randomly sampled 50 examples from the mc4 validation set. The performance table gives averages at the character level for samples in Swedish and English. The connection to mc4 in their discussion is mT5.

The comparison included both an earlier Swedish generator and English systems. In the evaluation section, the authors label Flashback-GPT as 1.4B. The earlier part of the paper describes the work that produced it as a 1.5 billion parameter project. The other baselines are GPT2-xl at 1.5B and GPT-Neo at 2.7B, compared with GPT-SW3 at 3.5B. The systems are comparable in the broad sense of being autoregressive generators with billions of parameters. Each arrives at the test with its own size, training material and tokenization.

Average character-level perplexity on Swedish mc4

GPT-SW3 assigns the strongest predictions to the Swedish sample by this measure.

Average character-level perplexity on Swedish mc4Flashback-GPT: 4.76Flashback-GPT4.76GPT2-xl: 4.70GPT2-xl4.70GPT-Neo: 2.87GPT-Neo2.87GPT-SW3 (this paper): 2.19GPT-SW3 (this paper)2.19
The numbers
System or settingCharacter-level perplexity
Flashback-GPT4.76
GPT2-xl4.70
GPT-Neo2.87
GPT-SW3 (this paper)2.19

On Swedish mc4, GPT-SW3 leads at 2.19, with GPT-Neo next at 2.87. GPT2-xl scores 4.70 and Flashback-GPT 4.76. A low score means the system gives the observed passage relatively high probability per character. The result shows that GPT-SW3 was the strongest predictor of this Swedish material among the systems compared. GPT-Neo’s position also shows that the main language a system was developed for is insufficient to predict its exact place in this ranking. The English-developed GPT-Neo beats the Swedish forum baseline on the Swedish sample.

The Flashback comparison illustrates why the source of the test matters. Flashback-GPT learned from discussion-forum text, while GPT-SW3 received a collection spanning several genres. Both systems can be assessed on the same Swedish validation material, but that assessment is about their performance on mc4. Their relative prediction of a forum sample would require an additional test. The established result concerns the language and source of the actual evaluation passages.

Average character-level perplexity on English mc4

GPT-Neo leads on the English sample, with GPT2-xl also ahead of GPT-SW3.

Average character-level perplexity on English mc4Flashback-GPT: 6.22Flashback-GPT6.22GPT2-xl: 2.30GPT2-xl2.30GPT-Neo: 2.11GPT-Neo2.11GPT-SW3 (this paper): 2.70GPT-SW3 (this paper)2.70
The numbers
System or settingCharacter-level perplexity
Flashback-GPT6.22
GPT2-xl2.30
GPT-Neo2.11
GPT-SW3 (this paper)2.70

On English mc4 the order changes. GPT-Neo leads with 2.11, followed by GPT2-xl with 2.30, GPT-SW3 with 2.70 and Flashback-GPT with 6.22. The authors note that GPT-Neo trained on 800 GB of English data. Taken together, the language columns show each system’s predictive performance on the respective mc4 sample. GPT-SW3’s strongest relative result is on the language it was built for, while GPT-Neo leads the English comparison and performs competitively on the Swedish one.

The prediction test supplies a baseline for the writing studies. A system that does well at predicting held-out Swedish text has demonstrated something about its command of regularities in that text. To see whether a command becomes an email, or whether a Swedish question comes back as an English question, it is necessary to inspect a generated answer. Those tasks give the authors a different target from the probability of a passage that was already written.

Continuing a genre and acting on a request

The creative examples range from tasks with a recognizably open ending to tasks with concrete content requirements. The political trials ask GPT-SW3 to continue text in forms the authors associate with parliamentary writing. A cue associated with answering an interpellation elicited a response taking the opposing side of an earlier statement. A delimiter around a topic name could elicit a parliamentary debate on that topic. The authors relate this behavior to the presence of political text in their corpus. The examples establish that those genre cues were effective in particular trials.

For speeches, short prompts specifying the type of address and its recipient could elicit a coherent continuation. One exercise begins with the opening six paragraphs of the Swedish King’s 2018 Christmas speech. GPT-SW3 continued in the register of a holiday address, brought the passage to a close and appended a cue for applause. The supplied opening already establishes the occasion, the style and the role of the speaker. The generation shows how much of that framing the system can preserve while continuing the prose. Another example builds a thank-you address to the Dala Horse, a Swedish cultural symbol, from a much shorter specification of the occasion.

Song lyrics make the role of visible structure more apparent. The authors supplied an opening verse and chorus in one example. The continuation uses section labels and carries forward the theme. They also found that giving section markers could help elicit text organized like a song. As presented, the example is evidence about written structure and thematic continuation. Its success criteria are different from those for a translation, where each central proposition needs to survive the change of language.

The fictitious hair spray LOKAR tests a change of voice within a related topic. A product description frames the item commercially, and a cue introducing customer comments leads into review-like text. The generated reviews follow conventions different from those of the product description while keeping the same item in focus. A synthetic product suits this test because the writers can supply its identity and let the generator fill out the genre. The experiment illustrates a style and formatting capability. Assertions made by an invented reviewer have the status of generated copy.

The dialogue study uses a translated prompt that introduces an assistant with a personality and presents exchanges to follow. GPT-SW3 continued the human-and-assistant turn pattern and gave answers related to the questions. The examples include requests for everyday advice, which allow the authors to show both continuity of form and topical relevance. The appendix also makes variations in answer quality visible. In the dialogue concerning food and weight, a generated response contains advice that turns internally inconsistent. Persistence of persona and speaker format thus goes alongside variation in the soundness of what the assistant says. The result is best understood as a demonstration of chatbot behavior in the particular turns shown.

The command-to-email example makes it possible to check the result against more specific requirements. In the displayed case, the researchers ask for mail from Sara to Peter about a family picnic and help with lunch. The output addresses Peter, develops the request and signs off as Sara. It also supplies details of its own, including Saturday as the day of the picnic and an explanation about being unable to bring food. This is part of what makes the result read like a full message. It also shows that expanding a command can introduce concrete circumstances left unspecified by the sender.

The authors demonstrate summarization by placing a short request after the text to be condensed. The system begins producing a summary of the preceding material. The reported result is that this arrangement can elicit the desired activity. The study gives more direct evidence about task initiation than about which important facts are retained or how faithful the result stays to the source. This is a distinct use of a generator for text summarization.

Carrying a format over to a new topic

In the list trials, the authors moved from simple formatting cues to a more developed context. Numbered lists generally worked better in their experiments than lists introduced with dashes or stars. A sentence explaining what the list should cover improved the result they wanted, and a preceding paragraph written in the style of a blog made it work better still. The setup can be understood as gradually supplying more evidence about what kind of writing should follow. The numbering supplies the local pattern, the description gives the scope, and the introductory paragraph establishes a reason for the list.

The authors also show GPT-SW3 carrying the format over from one list to another. A completed hiking packing list precedes a new list description, and the generator produces a list of 10 routes and related hiking resources. The first list models the presentation. The new description supplies the target subject. It is a useful example of a task whose organization can carry over even when its content has to change.

The longer packing-list example shows why format alone is a partial success criterion. GPT-SW3 sustains the numbered sequence, but some concepts recur, including food and a backpack. The output can be easy to recognize as a packing list while still needing editing for redundancy or suitability. How well the result meets a practical need depends on what its items contain as well as whether it continues the sequence.

Translating Swedish into English

For translation, the authors could vary the number of worked examples while keeping the task direction fixed. The zero-shot version uses the task description alone, the one-shot version retains a single demonstration, and the few-shot version includes several demonstrations. The demonstrated format calls for a Swedish sentence and its English counterpart. The prompt ends at the point where GPT-SW3 is to supply the next English line.

The paper’s numerical comparison tracks how frequently Swedish appeared in the 22 tested translations. The reported share was 17% in the zero-shot setting and 0% in the few-shot setting. A corresponding percentage for the one-shot setting is unavailable in the paper. The statistic is a measure of adherence to the target language in this test.

Share of outputs using Swedish in the tested Swedish-to-English translations

Prompts with worked examples yield less Swedish in the translations than the instruction alone.

Share of outputs using Swedish in the tested Swedish-to-English translationsZero-shot prompt: 17Zero-shot prompt17Few-shot prompt (this paper): 0Few-shot prompt (this paper)0
The numbers
System or settingOutputs using Swedish %
Zero-shot prompt17
Few-shot prompt (this paper)0

Individual translations help explain why this change matters and where the statistic runs out of detail. A simple statement about feeling well is translated successfully under all the shown settings. In the sentence about cold Nordic winters, the zero-shot and one-shot outputs express warmth. The few-shot output restores the cold weather described by the input. The earlier errors occur in English. They therefore pass the language check while reversing an important part of the message.

The example about whether everyone will fit shows a different failure. With the instruction alone, the system responds to the question as someone participating in a conversation. With an example, it attempts a rendering but alters the intended sense. In the few-shot output, it preserves the question more closely, adding a room as the setting. The progression shows how a prompt can shift the action from answering a question towards translating it. It also gives a case in which the more successful translation still includes extra detail.

In the example about increasing demand for electric cars, earlier outputs stay in Swedish. The few-shot output switches to English and conveys the growth of demand, but introduces a more specific time frame than the input. This distinguishes language selection from semantic fidelity. The system can improve on the measured statistic and preserve the broad idea while still altering a detail that matters.

The authors report that higher sentence complexity often made the system more likely to continue in Swedish, and that questions could prompt an answer in place of a translation. Their appendix also shows successful zero-shot attempts on relatively complex sentences concerning astronomy and black holes. These are recognizable English renderings with imperfections in wording or content. They establish that an instruction alone can elicit translation of difficult material on some inputs. The spread of examples shows why sentence complexity was an observed tendency, alongside the influence of form and subject matter, with substantial variation from one case to another.

What the ablations show

The paper has no formal ablation of the corpus, architecture or training procedure. It does offer comparative analyses during evaluation, especially a translation experiment that changes the examples available to GPT-SW3 at inference time. The writing studies also describe what happened when the authors changed visible structure, context and generation settings. These comparisons have different degrees of control. Translation supplies a defined prompt variation and a reported outcome across a test set. The observations about lists and open-ended writing mostly come from exploratory trials.

The translation examples clarify the requested action

The translation prompt in the appendix makes the difference between the shot settings explicit. The authors can remove demonstrations to obtain the shorter prompts. This keeps the language pair and task instruction in place while changing the evidence of what should follow. For the displayed sentences, the input sentence can be compared across settings. The network has the same learned parameters throughout, making the examples an intervention on use of the system.

The fall in Swedish output is consistent with the demonstrations helping establish English as the expected continuation. The examples pair a Swedish sentence with its counterpart rather than merely naming English as the destination. They show where a response belongs and what relation it should bear to the supplied sentence. The question example is especially informative because the question itself affords an ordinary conversational continuation. The demonstration adds evidence for a different relation between input and output, namely that the question should remain a question in English.

Some examples also improve on meaning, as in the return to cold weather in the Nordic-winter sentence. The numerical result for language use is narrower. It captures one failure with an observable surface marker. Errors that preserve English while changing a fact, reframing a question or inventing a date can persist after the Swedish output disappears. The comparison supports a claim that demonstrations helped the system deliver English in these trials. A separate measure and judgments of the translations would be needed to quantify improvement in preservation of meaning.

Adding demonstrations also changes multiple features of the input at once. It adds text, repeats language labels and shows examples of the correct correspondence. The comparison can attribute the observed change to the prompt setting as a whole. It leaves open whether repeated English labels, the recurring layout, the translation examples themselves or their combination contributed most. The value of the comparison is that the intervention is located at inference time and the output failure it reduces is clearly identified.

Format and framing are observable in the writing trials

List generation provides a series of exploratory comparisons. A numbered beginning appears to be a stronger cue than bullets made with dashes or stars. A descriptive sentence adds guidance about the kind of items expected. An opening paragraph in a familiar prose style adds a broader frame. The authors report improvements as they adopted these choices. Their examples also show a completed list supplying a pattern for a later list whose content differs.

These observations point to distinct ways a prompt can support continuation. A sequence of item numbers makes it easy to recognize the expected form of the next line. A description conveys the intended subject of the items. An introductory paragraph can make the list a natural next part of a recognizable document. The study shows the effects of the resulting prompts in use, with the individual contribution of each feature left uncertain. A numbered pattern may be followed faithfully while the content repeats. A contextual paragraph can help sustain a style while leaving the exact coverage of the list open.

Speaker labels and demonstrations play a comparable role in dialogue and email, although the examples give less direct evidence for the effect of any particular piece. In the dialogue setup, a character description, prior exchanges and speaker labels act together. The resulting continuation keeps the dialogue format. In the email setup, examples convey the shape of a finished message as well as how information moves from a command into that message. Taken as demonstrations, these cases show GPT-SW3 carrying structure forward. Matched trials that vary individual cues would be needed to say how much each contributes.

The authors’ preferences about prompt punctuation belong to this exploratory evidence. They found colons preferable to arrows for separating parts of a few-shot example. They also judged clear category labels helpful when a task calls for a definite answer from a set of categories. The paper presents these as practices the researchers arrived at during initial trials. It gives neither a punctuation benchmark nor classification scores from which to estimate those effects. The evidence concerns how the investigators found workable prompts for this system.

Generation settings shaped the observed behavior

The decoding observations concern a different part of the method. Reducing temperature or top-p narrows or concentrates the choices the generator encounters. In the authors’ trials, going below 0.60 increased the tendency to fall into repetitive loops. They used somewhat higher settings for creative tasks where varied continuations were desirable. The observed repetition problem gives a reason to record the configuration when evaluating a prompt. Changing what the decoder can choose may change the character of the result even if the input is identical.

The beam observation is mainly about feasibility. In the authors’ setup, using 6 or more beams frequently led to memory crashes. Since a beam keeps an additional candidate continuation available for the search, the number of beams bears on the resources generation requires. The observation restricts what settings were practical for the trials. It gives little evidence about which beam width would yield the best writing if memory were sufficient.

Finally, the Swedish and English perplexity columns change the test language while keeping the tested systems fixed. They provide a comparative view of where each system predicts well. They are not a training-data ablation because the systems being compared also differ in other respects. Similarly, the validation curve describes how the chosen GPT-SW3 run progressed. It cannot separate the effects of using the chosen corpus, weight decay, architecture and duration. The analyses that most directly show what changing a choice did are the ones in which the authors used the same trained generator and varied the prompt or generation conditions.

Limitations

Limits the authors state

A Swedish downstream benchmark suitable for systematic GPT evaluation was still in development. The authors identify this as a reason for using a prediction score and a qualitative study. Their choice yields a quantitative ranking for mc4 and shows attainable responses under particular conditions. It leaves overall task performance across a common Swedish benchmark unmeasured. In particular, the GPT baselines in the perplexity table were compared for prediction of text, while the creative and translation demonstrations describe GPT-SW3.

Computational resources also limited the scale of the predictive evaluation. The authors report sampling 50 examples randomly from the mc4 validation set. The table gives averages, and the reported analysis leaves uncertainty across alternative samples unspecified. The authors selected mc4 because they believed the evaluation material was fresh for the compared systems and because they wanted originally Swedish writing for the Swedish test. Their account makes the unseen-text condition a reasoned assumption. It remains possible that similar material, or some of the passages themselves, had appeared in training.

The authors acknowledge the difficulty of acquiring Swedish training text and the probable quality difference between large web collections and smaller curated sources. They chose minimal filtering overall to retain enough material. This is an important condition of the experiment because a headline size says little about the distribution of genres, the consistency of the prose or the people represented in it. The paper describes the corpus and its cleaning choices, but the social consequences of those choices in GPT-SW3’s outputs remain unevaluated. The discussion of representation draws on prior work relevant to bias, fairness and safety.

They also present their prompt-design advice as provisional. The authors found effective prompts through trial and error, and they expect better styles to be discovered. The generation settings posed practical limits too. At lower values the team encountered repetitive outputs, and higher beam counts often failed because of memory. These are observations from their experiments. The scope of each depends on the task, input and settings under which it arose.

Limits visible in the design

The favorable Swedish perplexity result compares complete systems. GPT-SW3 and Flashback-GPT differ in size and training corpus, and the English baselines introduce further differences in training language and exposure. The study leaves the individual contribution of those differences unresolved. It establishes the ranking on a shared test. A claim about how much of GPT-SW3’s advantage came specifically from curated Swedish material, recent web text, more parameters or another design choice would need a comparison built for that question.

Character normalization lets the systems be scored per unit of the same written material. It does not make the Swedish and English samples equivalent in genre, topics or difficulty. Within each test language, the systems are predicting common passages. Between languages, they are facing different passages. The change in ranking is therefore informative about the tested samples and the respective systems’ performance on them. A conclusion about the inherent difficulty of predicting Swedish and English would require evidence that controls the passage differences as well.

The training description identifies sources, high-level filtering, architecture, optimizer and run scale. Questions about corpus composition can still arise within those broad descriptions. A collection listed as web data can contain many kinds of writing, with different conventions and editorial standards. The genre of a convincing output also does not identify where GPT-SW3 learned it. For example, the authors connect political completions to political source material, but the examples cannot trace a particular competence to a particular collection. There is no version of the same training run with the political sources removed against which to check that interpretation.

The procedure for finding prompts matters to what the writing examples prove. Iterating on instructions and settings can establish that a task is achievable under some conditions. It also makes selected responses a weak basis for estimating what a new user will see on the first attempt. The article’s examples show specific successful and unsuccessful continuations, while prompt robustness across topics, phrasings and decoding runs remains unknown. A model can reproduce speaker turns in a dialogue or continue a numbered list consistently in the displayed example. The paper leaves open how frequently it would do so if the same intent were expressed another way.

Success also depends on what the task asks the output to preserve. A greeting and signature are visible checks for an email, but the addition of a date changes the meaning of a short command. A coherent speech relies on continuity of style, but its plausibility gives limited evidence about the reliability of any factual statements it makes. A conversation can maintain a persona while offering inconsistent guidance. The paper’s demonstrations are rich enough to show these distinctions. They supply no general rate for such errors across the tasks.

Translation provides the clearest measured change from modifying the prompt, together with a clear example of the limits of the metric. The 0% result for Swedish usage applies to the 22 tested translations in the few-shot condition. A rendition can be entirely English and still reverse the weather, soften a claim, add a time frame or invent a setting. The paper’s side-by-side sentences show several such issues. An estimate of translation fidelity would require judgments about the relation between the content of each input and output, beyond identifying the language of the generated text.

The scope of the study is consequently strongest where its evidence is most direct. GPT-SW3 assigns high relative probability to the Swedish mc4 sample, and the demonstrations show that it can carry out several kinds of prompted writing. Claims about which training ingredients produced those abilities, how often the tasks succeed, and what happens in settings unlike the trials remain open.

What came after

Later papers that cite GPT-SW3 approach the language-resource problem through several different experiments. The titles identify their broad purposes, from testing existing systems on Swedish to building an Icelandic benchmark or adapting a generator to Swedish journalism. Those purposes establish a connection to questions raised by GPT-SW3. Specific reuse of its corpus, checkpoints or evaluation procedure is unspecified.

One later study asks how effective English and multilingual systems are for Swedish. GPT-SW3 trained a Swedish generator and included English-developed systems in its predictive comparison. The later study’s title puts the applicability of existing English and multilingual systems to Swedish at the center. The shared question is how much capability in Swedish can be obtained from systems whose training is organized around different languages. The later study is Bridging the Resource Gap.

GPT-SW3 also showed why a language-specific assessment needs to specify what a good answer would demonstrate. Its translation results distinguished producing English from preserving meaning, and its broader writing trials lacked a ready-made Swedish task suite. In Icelandic, a later citing work addresses a more defined evaluation problem. It uses assisted benchmark generation and automated evaluation for questions about Icelandic cultural knowledge. Prediction of general written text and answers about a language community’s culture offer evidence about different abilities. The later work is WikiQA-IS.

A further citing work centers on Latxa, open language modeling and evaluation. That scope relates to the pairing of development and assessment in GPT-SW3. Training a generator and specifying how to evaluate it are separate research activities, and the Swedish project had to make choices about both. Details of Latxa’s datasets, experimental comparisons and any transfer of a GPT-SW3 method are unspecified in this account. The citing work is Latxa.

The journalism study narrows the setting from general Swedish to a particular domain. News articles contribute to the web portion of the GPT-SW3 corpus, alongside many other sources. The later paper makes Swedish journalism the subject of adaptation and uses continued pretraining, which means carrying on the pretraining of an existing system with additional material. That poses a different experimental question from the original construction of a broad Swedish corpus. It asks what additional training can do when the desired writing comes from a particular domain. The study is Reading the News.

These papers extend the questions that made the GPT-SW3 study useful beyond its immediate run. Capacity in a language can be approached through a dedicated generator or by examining systems trained across other language settings. Assessment can focus on general text prediction, a defined body of cultural knowledge or a particular domain of writing. GPT-SW3’s contribution was to document what it took to train a Swedish generator and to show, through both scores and concrete outputs, how the evidence changes with the test.

Cite

Cite as Ariel Ekgren, Amaru Cuba Gyllensten, Evangelia Gogoulou, Alice Heiman, Severine Verlinden, Joey Öhman, Fredrik Carlsson and Magnus Sahlgren. 2022. Lessons Learned from GPT-SW3: Building the First Large-Scale Generative Language Model for Swedish. Proceedings of the Thirteenth Language Resources and Evaluation Conference.

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{ekgren2022lessons,
  title = {{Lessons Learned from GPT-SW3: Building the First Large-Scale Generative Language Model for Swedish}},
  author = {Ariel Ekgren, Amaru Cuba Gyllensten, Evangelia Gogoulou, Alice Heiman, Severine Verlinden, Joey Öhman, Fredrik Carlsson and Magnus Sahlgren},
  booktitle = {Proceedings of the Thirteenth Language Resources and Evaluation Conference},
  year = {2022},
  doi = {10.63317/2u9szjhk3jwh},
  url = {https://doi.org/10.63317/2u9szjhk3jwh}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/ekgren-2022-lessons-learned-gpt-sw3-building/