What kind of page is this?
Blog, online shop, FAQ, news front page, personal home page, search results. Search engines and dataset builders use genre to filter and organise the web.
Genre and authorship classification · Research, in progress
This project compares methods for two text-sorting tasks: identifying the genre of a web page and attributing a text to one of several candidate authors when the topic changes. Every method runs under one protocol in which nothing is learned from test data. The first round covers the classical methods. Character n-grams with a linear SVM reach 97.2% accuracy on the 7-genre corpus, but only 58.2 macro-F1 on cross-domain authorship (PAN-18), where the best score falls to 46.5 for Polish. The next rounds test whether pretrained models and LLMs close that gap.
Both are closed-set classification. The model receives a text and must assign it one label from a fixed list.
Blog, online shop, FAQ, news front page, personal home page, search results. Search engines and dataset builders use genre to filter and organise the web.
Each candidate has seven known texts on one topic. The unknown texts are on a different topic, so the model has to follow the writer and ignore the subject.
| Corpus | Task | Texts | Labels | Protocol |
|---|---|---|---|---|
| 7-genre (Santini) | Web genre | 1,400 | 7 genres, 200 each | Stratified 10-fold CV × 3 seeds |
| KI-04 (Meyer zu Eissen & Stein) | Web genre | 1,205 | 8 genres, 126–205 each | Stratified 10-fold CV × 3 seeds |
| PAN-18 (dev) | Authorship | 20 problems | 5–20 candidates, 5 languages | Official known / unknown split |
The oldest strong baseline cuts a text into overlapping slices of three characters and counts
them. "the cat" becomes the, he·, e·c,
·ca, cat. The counts form a profile that captures function words,
punctuation habits, spelling and word endings, which are less tied to topic than vocabulary is.
· marks a space. Edit either text to update the score.Methods are grouped by how much they know before they see our data. All tiers run on the same splits and the same scorer.
| Tier | Methods | Compute | Status |
|---|---|---|---|
| 0. Classical | Official PAN-18 baseline (char 3-grams + SVM); TF-IDF char 1–4-grams + SVM; fastText | CPU | Done |
| 1. Frozen embeddings | Multilingual sentence embeddings + linear classifier | CPU / free GPU | Next |
| 2. Fine-tuned encoders | ModernBERT (en); XLM-R, mDeBERTa (multilingual); long-document handling | Free GPU | Planned |
| 3. LLMs | Zero- and few-shot prompting; known texts as in-context examples for PAN | API | Planned |
| 4. Historical | ULMFiT re-implemented under the leakage-free protocol | Free GPU | Optional |
A score is only meaningful if the model never saw the test texts while learning. When it does, the error is called data leakage, and it inflates results. These rules apply to every model and are enforced in code where possible.
Vocabularies, scalers, embeddings, language-model adaptation and prompt examples come from the training part of each split only.
Hyperparameters live in versioned configs. Any tuning uses validation data carved from the training split.
Accuracy and macro-F1 for every split. PAN-18 uses macro-F1 over candidates, averaged over problems, also per language.
Mean ± standard deviation over splits, with three CV seeds on the genre corpora.
Paired Wilcoxon signed-rank tests over identical splits, corrected for multiple comparisons.
Fit and predict time per split, hardware, and API cost where relevant.
Every run records its config, git commit and package versions.
97.2%
Character n-grams + SVM sort 7-genre pages almost perfectly. KI-04 is harder, at 85.0%.
58.4F1
Cross-topic authorship stays hard. The two n-gram methods tie, and both are weakest in Polish.
13.4F1
fastText fails on authorship. Seven texts per candidate are too few for it to learn word-level signals.
| Method | EN | FR | IT | PL | ES |
|---|---|---|---|---|---|
| PAN-18 baseline | 69.7 | 58.5 | 60.5 | 41.9 | 61.5 |
| Char 1–4-grams + SVM | 74.1 | 56.6 | 57.0 | 46.5 | 56.8 |
| fastText | 16.4 | 13.1 | 6.2 | 23.4 | 7.6 |
Our copy of the official PAN-18 baseline reproduces all 1,315 answers of the published baseline, which confirms the data loading and scoring.
ULMFiT was applied to both tasks. It reported 99.1% on 7-genre and 92.6% on KI-04, and losses against n-gram baselines on authorship.
Test accuracy exceeded validation accuracy on both genre corpora, which suggests the language model was adapted on text that included test pages. PAN-18 numbers were inconsistent, an English-only model was applied to four other languages, and most code was missing.
The thesis is motivation only. Every number on this page comes from code in the repository, re-run under the protocol in §4.
Test tiers 1–3 under the same protocol and answer the main question: has pretraining overtaken character n-grams on cross-topic authorship?