
3.2.1 Fine-tuning
Provided with sufficient context in the prompt, a
freshly obtained GPT-2 model produces qualita-
tively convincing news article text. It will, how-
ever, periodically confuse itself with exactly which
publication it is imitating, e.g. it can switch from
sounding like CNN to CBC to BBC in a single
text. For the purposes of comparison with a single
news source, it is thus necessary to fine-tune the
model with example texts encapsulating the desired
editorial and writing style.
Fine-tuning is a two-step process. We first gather
a sequence of texts best representing our target writ-
ing mode before fine-tuning a stock GPT-2 model
with the training dataset.
Training Dataset
We use a web scraper to ex-
tract a random selection of news articles published
between 2007 and 2020 from CBC News’ website.
We configure our scraper to pull the same metadata
as our COVID-19 dataset: headline, subheadline,
date, URL, and article text. We again deduplicate
to reduce the possibility of overfitting our model.
With this method we collect 1,368 articles with an
average length of 660 words per article.
We next construct a dictionary structure to for-
malize both our generation targets and to provide
GPT-2 a consistent interface with which to aid it in
logically linking together pieces of metadata. Pre-
vious research has indicated fine-tuning LLMs with
structured data aids the model in both understand-
ing and reacting to meaningful keywords (Ueda
et al.,2021). We therefore structure our fine-tuning
data in a dictionary. We provide a template of our
structure below.
{
’title’: ’Lorem ipsum...’,
’description’: ’Lorem ipsum...’,
’text’: ’Lorem ipsum...’
}
We produce one dictionary per article in our train-
ing set. We convert each dictionary to a string
before appending it to a final dataset text file with
which we train GPT-2.
Training
With our training dataset in hand, we
proceed to configure our training environment. We
use an Adam optimizer with a learning rate of
2e−4
and run the process (Kingma and Ba,2014). Train-
ing the model for 20,000 steps over six hours results
in a final model achieving an average training loss
of 0.10.
3.2.2 Model Hyperparameters
In addition to fine-tuning our model, we experi-
ment with different hyperparameters and prompt
strategies. Numerous prior studies have described
the effects hyperparameter tuning has on the to-
ken generation process (van Stegeren and My´
sli-
wiec,2021;Xu et al.,2022). For our purposes,
we use three prompting strategies when generating
our synthetic news articles along with one further
parameter (temperature):
Standard Context
Only title and description
metadata are used as context dfor the model.
Static Context
In addition to the standard con-
text, we supply the model with an additional
framework
key containing a brief description of
the COVID-19 pandemic found on the website of
the Centre for Disease Control (CDC) in May 2020.
All generation iterations use the same description.
Rolling Context
We again supply the model
with an additional
framework
key, but keep the
description of COVID-19 contemporaneous with
the date of the real article in question. We again use
the CDC as a source but instead use the Internet
Archive’s Way Back Machine API to scrape dated
descriptions.3
Temperature
We manipulate the temperature
hyperparameter during generation with half-
percentage steps shifting the temperature between
0.1...1
. The temperature value is a divisor ap-
plied on the
softmax
operation on the returned
probability distribution, the affect of which effec-
tively controls the overall likelihood of the most
probable words. A high temperature results in a
more dynamic and random word choice, while a
lower temperature encourages those words which
are most likely according to the model’s priors.
Models
Manipulating the above hyperparemeters
gives us the following model framework:
•
Model 1: headline-only, temperature between
0.1 and 1
•
Model 2: static context, temperature between
0.1 and 1
•
Model 3: rolling context, temperature be-
tween 0.1 and 1
3https://archive.org/help/wayback_api.php