Elamur Research

Logion: Machine Learning for Greek Philology

Paper · 2023 · Charlie Cowen-Breen, Creston Brooks, Johannes Haubold et al.

Summary

A manuscript can preserve a sentence for centuries and still leave its editor with two different problems. Part of the sentence may have disappeared where the writing surface deteriorated. Elsewhere, every letter may be legible, yet the words may reflect a copyist’s mistake. Logion uses machine learning to help editors investigate both problems. The authors train BERT on premodern Greek, ultimately using a collection of about 70 million words. For suspicious readings, Logion asks how well the transmitted word fits its surroundings and whether a nearby spelling fits better. For gaps, it searches for completions that fit both the context and the estimated number of missing characters. Ancient Greek

The error detector gives an editor a ranked list of places to examine. In a test that introduced a single character substitution into each paragraph, the altered word ranked first in 556 of 615 cases, for a top-1 accuracy of 90.5%. When the altered word ranked first, the system’s leading replacement recovered the original word 98.1% of the time. The paper also describes a finding in a printed edition of Michael Psellus. Logion’s suggestions pointed toward joining what the edition presented as separate words. Inspection of the manuscript confirmed a suggested reading that made sense of the passage, even though the system had assigned it a low probability. That case shows how a suggestion can direct an editor toward decisive evidence.

The restoration experiment gave a philologist 48 passages from Psellus with artificially removed text. The expert’s first conjecture matched the hidden wording more often than BERT’s first choice. The expert performed best after seeing the system’s top ten suggestions and deciding whether to revise his answer. Exact agreement with the hidden text determined success, so the test measured recovery of a known reading. It also showed why a list can be valuable even when its leading entry is weaker than an unaided human answer.

The authors also investigate whether particular parts of BERT respond to recognizable features of Greek grammar. One attention head tends to connect the particle μέν with the corresponding δέ, which commonly introduces the second of two parallel clauses. It sometimes identifies other particles that serve a related function. Tests against annotated syntax locate other promising heads, although the findings concern selected constructions. Together, the experiments show how Logion can direct attention to a suspicious passage, supply alternatives for a difficult reconstruction, and expose some of the linguistic patterns behind its suggestions. Interpretability

Deep dive: Logion: Machine Learning for Greek Philology

Logion helps editors of premodern Greek find possible copying errors, reconstruct missing text, and test what BERT learns about Greek grammar. · about 36 minutes to read

The problem and its context

The gap an editor can see and the error an editor has to find

The material history of a text shapes the questions an editor can ask. A hole, rubbed surface, or other damage can make the position of a loss apparent even when its contents are inaccessible. The editor may be able to estimate the extent of that loss from the surviving writing surface. In a passage altered during copying, the trouble can be harder to locate. A copyist may have substituted a familiar word for one that sounded similar, or turned an unusual expression into a more ordinary one. The surviving line can look complete. Recognizing that a reading deserves scrutiny is itself part of the work.

The paper uses the Iliad to illustrate how transmission separates a work from its surviving witnesses. It dates the poem to the 8th c. BCE, from the oldest surviving pieces of papyrus through the third century. BCE, and the first manuscripts containing the entire poem to the 10th c. CE. Copies made in the intervening tradition could preserve readings from much older material. The same process could pass a change from one copy to the next. An editor encounters its outcomes through the surviving documents and has to reason about earlier stages whose physical witnesses may be gone.

Some copying changes are easy to imagine from the appearance or sound of a word. Others depend on how a scribe reads a whole expression. A copyist can omit material, adapt spellings to a later pronunciation, or choose an expression that seems clearer in context. A reader looking for corruptions therefore needs to consider ordinary Greek words as well as obviously defective forms. A dictionary can tell the reader that a word exists. The harder question is why this word occurs at this point in a particular author’s work.

Traditionally, the authors describe finding such passages as a matter of sustained, careful reading. Verification is a further step. An expert may judge a proposed reading persuasive on linguistic and contextual grounds. In another case, a manuscript may supply the decisive evidence, particularly if an earlier editor overlooked it or read it incorrectly. Those stages motivate the design of Logion. The framework can direct attention to a location and offer a candidate. The judgment about the transmitted text draws on evidence that a score from its immediate context cannot supply on its own.

Earlier work on anomalous words and lost text

The paper contrasts the needs of textual criticism with the problems addressed by earlier spelling and grammar checkers for modern languages. A copying error can leave a word that is legal in the vocabulary and an expression that appears to make sense. The authors therefore draw on out-of-distribution detection, where the question is whether an observation looks as if it belongs to a particular source. In Logion’s study of Psellus, that source is the author’s writing as represented by the available texts. The observable form is compared with plausible alternatives in the same context. Earlier work on likelihood ratios gives the authors a way to turn that comparison into a ranking.

The comparison matters because a contextual prediction can be uncertain for several reasons. A rare but genuine expression may receive little probability because its context licenses a wide variety of words. A common-looking form might be much more suspicious if a close alternative completes a recognizable expression. An editorial shortlist depends on deciding which of these uncertainties deserves attention. The authors’ design brings together contextual fit and the degree of change a copyist would have had to make.

For restoration, the paper discusses work on both Latin and Greek. Bamman and Burns tested whether BERT could recover a token masked in a Latin passage. A token is a unit the software uses to represent text, and it can be a piece of a word. Masking a single token makes a direct test of the task on which BERT was trained. A physical gap normally comes with a different kind of clue. An editor may have a reasonable estimate of the number of letters missing while having no way to know their division into tokens. Using a system trained on tokens for an editorial problem specified in characters requires a way to connect those units. Tokenization

The work on Greek inscriptions used approaches designed to account for gap size. Pythia-Word combined information about words and characters and searched for restorations one character at a time. Ithaca represented characters, words, and their positions in a transformer and used separate outputs for supplying missing text, assigning a region, and estimating a date. The Logion authors emphasize that the inscribed text and a copied literary manuscript have different transmission histories. In the earlier inscription study, the restoration task concerns loss through damage. For the literary texts that motivate Logion, an editor also has to consider changes introduced between an earlier exemplar and the document under inspection.

Ithaca also supplied a precedent for evaluating collaboration. The earlier study compared automated completions, judgments made by classics graduate students, and judgments made with access to the system’s suggestions. Logion adopts that sequence and changes who represents the human side of the experiment. Its expert had already worked on the author whose passages were used in the test. This gives the collaboration a specific editorial setting. The independent conjecture comes from an experienced reader of Psellus, and the suggestions provide additional material for that reader to consider.

Why inspect the system’s reading patterns?

An editor can explain a conjecture by identifying a construction, a usage elsewhere, or a feature of a manuscript. BERT estimates contextual fit through stacked computations whose contribution to a particular answer is harder to trace. The authors ask a narrower question about that process. Do any of its components direct attention between words that classical scholars identify as grammatically related?

Previous studies discussed in the paper had treated attention heads as simple classifiers of syntactic relationships in English and other modern languages. A classifier makes a choice among candidates. In this kind of study, a head can be read as choosing a word by finding the position to which it assigns the greatest attention. The researchers can then check whether that choice corresponds to a known relation. Logion applies this approach to premodern Greek, drawing on accounts of Greek particles and syntactic annotations. The analysis asks what grammatical information can be recovered from individual components of a system trained to predict hidden text. Dependency parsing

The method, step by step

Train on premodern Greek and adapt to Psellus

Logion builds on BERT’s ability to use words on both sides of a hidden part of a passage. During training, selected input tokens are masked. BERT sees where a token is missing and assigns probabilities to possible identities for it. Comparing these predictions with the hidden tokens provides the training signal. The paper uses this ability in several ways. A word already present in an edition can be hidden temporarily to see which forms the context supports. A real or simulated lacuna can be represented with several masks. The internal attention weights can also be examined while BERT reads intact text. Language model

How Logion learns Greek and proposes editorial readings

The steps in order.

How Logion learns Greek and proposes editorial readingsStep 1: Train BERT to predict masked Greek tokens1. Train BERT to predict masked Greek tokensStep 2: Adapt it to the works of Psellus2. Adapt it to the works of PsellusStep 3: Hide a suspect word or mark a gap3. Hide a suspect word or mark a gapStep 4: Search for candidate readings in context4. Search for candidate readings in contextStep 5: Score candidates using distance or gap length5. Score candidates using distance or gap lengthStep 6: Present ranked possibilities for philological review6. Present ranked possibilities for philological review

The authors began with 6.4 million words of premodern Greek supplied by Pranaydeep Singh. Singh and colleagues had assembled material from open sources including the Perseus Digital Library and First1KGreek while preparing their own BERT for ancient and medieval Greek. Logion’s initial training on that corpus supplied the system used in the companion study of previously overlooked textual problems. The authors then assembled about 70 million words, a corpus they describe as the largest used for this purpose to their knowledge. Its sources include texts supplied under a license from the Thesaurus Linguae Graecae and material furnished by colleagues. Some of the corpus can be shared on request, subject to the terms governing the material.

For the larger corpus the authors used a 90-10 train-test split. They packed segments separated by punctuation into inputs as far as the limit of 512 tokens allowed. A token limit matters here because two passages with the same number of words can break into different numbers of pieces. The authors report a batch size of 16, a masking ratio of 0.15, training on two NVIDIA A100 GPUs, and 200 epochs, by which point validation loss had stabilized. An epoch is a pass through the training data. Validation loss tracks how well the learned predictions fit held-out material during training.

The authors also compared two ways of starting this training. One run began with randomly initialized weights. The other began with the weights of Singh and colleagues’ Ancient Greek BERT, whose development had started from Modern Greek BERT. Both runs used the same Modern Greek sub-word tokenizer inherited from Singh and colleagues. A sub-word tokenizer lets a vocabulary represent forms by combining smaller units. That makes it possible to represent a long or infrequent form without reserving a vocabulary entry for the whole word. The initialization comparison changes the starting weights while holding this division of text into units fixed. Subword tokenization

For the work on scribal errors, the authors then adapt the Greek BERT to Psellus by continuing training on his works. Such fine-tuning gives the system practice on the author whose language supplies the reference for judging possible corruptions. General training establishes patterns that recur across the larger Greek collection. The author-specific stage puts the focus on which expressions fit this body of writing. Its predictions still describe patterns learned from surviving texts, with all the uncertainties that survival and editing bring.

Get a probability for an observed word and its alternatives

The error detector starts from a passage with a token temporarily hidden. The authors represent the context by removing that position from the sequence. In the notation, the left and right portions of the passage remain available to constrain the missing item.

w₋ᵢ = (w₁, …, wᵢ₋₁, wᵢ₊₁, …, wₙ)

Here w₁ through wₙ are the tokens in order, and n is the length of the sequence. The index i identifies the token under examination. The subscript ₋ᵢ means that this token is omitted from the context. The ellipses stand for successive tokens in their original order. The tokens with indices i − 1 and i + 1 are those immediately before and after the omitted position when those neighbors exist.

p(w | w₋ᵢ)

Here p denotes the learned conditional probability, w is a candidate token for position i, and the vertical bar means given the context w₋ᵢ. Replacing w with the token that actually appears yields a probability for the transmitted form. Considering all possible values of w gives competing predictions for that position.

A whole word may occupy several tokens. For a word-level decision the authors extend the same notation to a distribution over word candidates assembled by beam search. Beam search keeps a shortlist of promising partial completions while filling a sequence of masks. At a later step, previously chosen pieces of a candidate provide context for the remaining pieces. Maintaining a shortlist leaves multiple continuations in play without enumerating every possible token sequence. The resulting word scores can then be compared in the notation used for an individual token. From this point in the error calculation, i indexes a word position and the context comprises the other words.

The simplest measure is the probability assigned to the word found in the text. The paper calls it chance.

chance = p(wᵢ | w₋ᵢ)

Here wᵢ is the observed word at position i, w₋ᵢ is its surrounding word context, and p gives the probability of the observed word in that context. Chance measures how much support the system assigns to the reading the editor is examining.

The second measure is the probability of the strongest candidate. The authors call this confidence.

confidence = max over w of p(w | w₋ᵢ)

Here max takes the largest probability among the candidate words w, with w₋ᵢ fixed. Confidence belongs to the leading candidate, which may be the form already in the text. It tells the editor how concentrated the system’s support is on that candidate. A passage can give low chance to the observed word while offering only another low-probability word in its place. A low-chance word paired with a strongly supported alternative gives the shortlist a different kind of evidence.

The third measure is the distance from the observed word to the suggestion. Ordinary Levenshtein distance measures the edits needed to turn one string into another. The paper uses a modified distance with lower penalties for substitutions among the vowels ι, υ, and η, drawing on examples of copying errors discussed by Reinsch. These substitutions are relevant to itacism, the convergence in pronunciation of several Greek vowels and diphthongs on the sound /i/. The score captures a specific connection between written difference and a historically plausible confusion.

distance = d(wᵢ, argmax over w of p(w | w₋ᵢ))

Here d takes the modified distance between the strings supplied as its arguments. The first string, wᵢ, is the observed word. The second is the result of argmax, which returns a word w attaining the highest value of p for the context w₋ᵢ. Thus max returns the strength of the best prediction, whereas argmax supplies the word whose spelling is to be compared.

Turn the scores into a shortlist

The principal ranking begins by building a neighborhood around each observed word. A word belongs to this neighborhood if its scribal distance from the observed word is within a fixed bound. Each position gets its own neighborhood because the observed spelling changes from one position to the next.

𝒲ₖ(wᵢ) = {w : d(w, wᵢ) ≤ k}

Here 𝒲ₖ(wᵢ) denotes the set of candidate words close to wᵢ, and the braces describe its membership rule. The colon in the set means such that. The distance d compares the candidate w with the observed word wᵢ. The symbol ≤ permits any distance at or below the bound k.

ρᵢ(s) = p(wᵢ | w₋ᵢ) / max over w ∈ 𝒲ₖ(wᵢ) of p(w | w₋ᵢ)

Here s is the sentence being evaluated, and ρᵢ(s) is its chance-confidence ratio at word position i. The numerator scores the observed word wᵢ. The denominator is the largest contextual probability among the candidates w in the neighborhood 𝒲ₖ(wᵢ), as indicated by ∈. Both probabilities use the same surrounding words w₋ᵢ. If the probabilities are explicitly conditioned on membership in the neighborhood, both are scaled by the same amount, which cancels in the ratio.

The ratio is small when a close candidate attracts substantially more probability than the observed form. An unusual reading can survive the ranking if its close alternatives are similarly weak. Conversely, a very probable completion that would require a large change has no effect on the ratio outside the chosen bound. Logion orders positions from low ratios upward. The winning candidate at a high-priority position is a potential emendation, meaning a proposed correction to the transmitted reading.

The paper offers an argument for comparing such ratios across a sentence. Suppose there is a joint distribution over complete sentences and its conditional probabilities agree with those used to score the words. For any change made at a single position, the sentences being compared have the same context at that position. Under Bayes’ rule, each sentence probability factors into the probability of that context and the probability of its particular word given the context. The context term cancels when the sentence probabilities are divided. This lets the authors connect local word substitutions with the best-scoring nearby sentence.

s* = argmax over s′ ∈ 𝒲₁(s) of p(s′)

Here s* is a sentence attaining the maximum. The variable s′ ranges over the local neighborhood 𝒲₁(s) of the input sentence s, formed by allowing a change at a single word within distance 1. The function p in this expression gives joint probabilities to complete sentences, and argmax selects a sentence rather than its probability.

max over s′ ∈ 𝒲₁(s) of p(s′) = p(s) × max over 1 ≤ i ≤ n of 1/ρᵢ(s)

Here the left side is the highest joint probability attained in the sentence neighborhood. On the right, p(s) is the joint probability of the input sentence. The factor following × is the largest reciprocal of the chance-confidence ratio across the word positions i, from 1 through n, with n now counting words. The identity is the endpoint of the appendix’s factorization. Each reciprocal gives the relative gain from the locally strongest candidate at that word.

i* = argmin over i of ρᵢ(s)

Here i* is the position chosen for an improving local change, and argmin selects an index at which the ratio ρᵢ(s) is smallest. The actual replacement is the highest-probability word in that position’s neighborhood. The same reasoning supplies the motivation for a larger neighborhood when the allowed edit affects only one word.

There is a convention worth making explicit in reading the theorem. Its strict comparison for keeping the sentence as written treats the alternatives in that comparison as actual changes. The displayed word neighborhood also admits the observed word, because its distance from itself is zero. If the denominator uses that inclusive set, its value is at least the numerator, and ρᵢ(s) cannot exceed 1. An unchanged winner can then give a ratio of 1. Comparing the observed reading strictly against changed candidates requires excluding it when taking the maximum over those candidates and handling ties separately. The ranking motivation remains straightforward in the case where an eligible replacement scores higher than the observed word. The paper also notes that a joint distribution with the required properties has not been established for these BERT conditionals.

The authors make a second connection to statistical testing. They consider the original word an unknown parameter and the surrounding words evidence about it. They assume a uniform prior across the eligible readings, assigning no prior probability to words beyond the distance bound. With that prior, comparing candidate probabilities given the context is equivalent to comparing how likely the context would be under those candidates. The observed word can be tested against an alternative whose original form lies in the same neighborhood.

H₀: wᵢ is the original reading
H₁: the original reading belongs to 𝒲ₖ(wᵢ) ∖ {wᵢ}

Here H₀ is the hypothesis that the observed word wᵢ is correct. H₁ is the hypothesis that it was changed from a word in the distance-bounded set 𝒲ₖ(wᵢ). The set difference symbol ∖ removes wᵢ itself, so every reading under H₁ is a change from what survives. This formulation concerns a restricted family of errors. It gives an interpretation to a low score under the rules of the test.

The companion philological work also used a threshold method. An editor can require a minimum confidence for the leading replacement and a maximum scribal distance from the transmitted word, then sort the qualifying positions by increasing chance.

Rank by chance where distance ≤ 3 and confidence ≥ 1/2

Here chance is the contextual probability of the observed word. Distance is the modified edit distance to the leading candidate, with a maximum of 3. Confidence is the probability of that candidate, with a minimum of 1/2. The authors use 50% as the equivalent confidence threshold and explain why it is convenient for retaining the leading suggestion among positions that satisfy the conditions. The threshold approach makes it possible to tune the size and selectivity of the reading list.

The paper illustrates this flexibility with two sets of possible thresholds. A tightly filtered list can require confidence of 90%, cap chance at 10⁻⁶, and cap distance at 2. A broader list can allow confidence of 50%, chance up to 10⁻⁴, and distance up to 4. The intended tradeoff is between precision, the share of flags that are genuine errors, and recall, the share of existing errors that the flags capture. These values describe suggested settings for different editorial purposes. The paper’s principal detection experiment evaluates rankings within paragraphs.

Search a gap with a known character count

A lacuna is a stretch of missing text. In Logion’s restoration pipeline, the visible context and a specified character count are given. The system needs to decide how many token masks to put in the gap and what to put under each mask. Giving it a single number of masks would commit the search to one tokenization length before there is any text to tokenize. The authors instead run beam searches at several possible token counts and learn how to compare their results.

ℙ(s | c) = ℙ(s | gap_toks = toks(s), c) × ℙ(gap_toks = toks(s) | c)

Here s is a candidate span from Sₙ, the set of spans of n characters, and c is the visible context around the gap. The symbol ℙ denotes probabilities in the gap-filling calculation. The variable gap_toks is the unknown token count of the original span, and toks(s) is the count obtained by tokenizing candidate s. The first factor is the probability of s given the context and the appropriate number of masks. The second factor is the estimated probability that this number of masks is correct given the context. The vertical bars mark conditioning, and × combines the factors. This works because a particular completion implies a particular token count.

The paper illustrates gap_toks with the value 2 to show that token count is a separate property from character length. In the actual search, the authors use the following range of counts.

[1, n//2 + 2]

The bracketed expression specifies the smallest and largest token counts searched for a gap of n characters. The operation // is integer division, so the upper bound is the integer part of n divided by 2, with 2 added. The paper notes that the true count is at most n and reports that it is at most n/2 in more than 99% of cases considered for this choice. Searching the shorter range reduces computation while leaving room for spans split into more pieces than usual.

A fully connected neural network estimates how much weight to give each possible token count. For each count searched, it receives the ten highest probabilities from the corresponding beam search. Those probabilities tell it something about how well the context supports words of that token length. The input also tells it the number of missing characters, using a one-hot encoding in which the position for the observed length is active. The paper reports flattening a probability array of size 7 × 10 and concatenating it with that length encoding for an input dimension of 78. The network has one hidden layer. Its 7 outputs represent the possible token counts.

To train this network, the authors generate examples in the Psellus training set. They choose a target character count between 3 and 10, then mask consecutive whole words until the chosen count has been exceeded. Punctuation is excluded from the character count even if it falls inside the masked span. The input to the network comes from beam-search scores and the character length. The label is the number of tokens in the actual hidden span. Cross-entropy, the training loss, penalizes assigning low probability to that known count. At inference the true count is hidden, so the network supplies a distribution over possible counts from 1 through 7. Candidates can then be ranked by the product in the probability expression, with the final list limited to spans matching the specified character length.

The search creates another training issue. Ordinary masked prediction exposes BERT to relatively sparse masks. At a masking rate of 15%, the authors put the chance of five consecutive masked tokens in a training iteration on the order of 10⁻⁵. A restoration request may deliberately present a run that long or longer. To give the system practice on such inputs, the authors fine-tune separate versions for sequences of 2, 3, 4, and 5 masked tokens. During beam search the length of the consecutive masked run determines which version to use. The version trained with 5 masks handles runs of at least 5. This adaptation changes the context seen around a mask: several of the neighboring positions can now be unknown, as they are at the start of a gap search.

Read grammatical choices from attention

The attention study uses a different output from the same architecture. BERT has 12 layers with 12 heads each, for 144 attention heads. A head assigns weights that describe how much information from each input position contributes to the representation it produces for a particular position. The weights for a given position are between 0 and 1 and sum to 1 across the positions receiving attention.

oᵢ = ∑ⱼ₌₁ⁿ αᵢⱼ vⱼ

Here oᵢ is the head’s output vector for token i. The index j ranges over the n positions in the input, and ∑ indicates a sum over those positions. The weight αᵢⱼ describes how much position i attends to position j. The vector vⱼ is a linear transformation of the input at j. Multiplying by αᵢⱼ weights that vector before it is added to the output.

j = argmax over j′ of αᵢⱼ′

Here j is the position receiving the greatest attention from token i, j′ ranges over possible destinations, and αᵢⱼ′ is the corresponding weight. The operation argmax returns a position attaining the maximum. The authors use that choice as a prediction of the word to which the source word is grammatically related.

Greek words can contain several sub-word tokens, so the authors convert token attention to word attention before making such comparisons. For attention sent by a word, they average across that word’s tokens. For attention received by a word, they add the weights assigned to its constituent tokens. This preserves the total attention sent by each word. They then compare a head’s choice with a corresponding particle or annotated syntactic relation. The procedure reads choices from an existing head, with no additional training for these grammatical tasks.

Experiments and results

Predicting hidden tokens in the larger Greek collection

The paper reports three test-set results for the larger premodern Greek corpus. In the task of predicting 1 token, top-1 accuracy is 84.4%, meaning that the first candidate is the hidden token on that share of trials. Top-5 accuracy is 95.2%, meaning that the correct token occurs somewhere among the first 5. The reported pseudo-perplexity is 2.162. Pseudo-perplexity describes how much support a masked predictor gives the observed material using conditional predictions. It is a measure of fit on that tokenization, distinct from the fraction of trials where the correct answer wins a ranking.

These tests establish how well BERT recovers tokens when their positions are known and one target is hidden. The editorial tasks introduce other decisions. The detector has to locate an unexpected word among many intact words. The gap filler receives a character length and has to infer how many tokens it represents. A successful test-set token prediction provides the basic capability needed for both tasks. The figures for a single hidden token give a baseline for that capability within the particular input representation used in the paper.

Finding an artificial error in a paragraph

For the controlled detection test, the authors needed corrupted and intact readings whose status was known. They made a single character substitution in one word per paragraph. The word produced by the edit had to occur at least 10 times in the vocabulary drawn from Psellus’s works. They kept trying substitutions until that condition was met. The resulting word could pass a vocabulary check, which forced the detector to use context and other evidence to distinguish it from a legitimate occurrence of that word. The paragraphs averaged 230 words.

Within each paragraph, the authors scored the words by the chance-confidence ratio with a distance bound of 1. This simulates an editor receiving a list of suspect positions. Top-1 accuracy asks how often the deliberately altered word was at the head of that list. Logion placed it first in 556 of 615 cases, yielding 90.5% top-1 accuracy. Among the cases in which the corrupted word came first, the proposed replacement at the top of its local candidate list retrieved the known original 98.1% of the time. This conditional result concerns a second decision once the system has already localized the corruption successfully.

Top-1 detection accuracy for artificial character substitutions in Psellus paragraphs

The chance-confidence ratio places the edited word first more often than chance alone.

Top-1 detection accuracy for artificial character substitutions in Psellus paragraphsChance alone: 59.7Chance alone59.7Chance-confidence ratio (this paper): 90.5Chance-confidence ratio (this paper)90.5
The numbers
System or settingaccuracy %
Chance alone59.7
Chance-confidence ratio (this paper)90.5

The paper also treats top-10 accuracy as relevant to the editorial use of a shortlist. That metric asks whether an editor would encounter the altered word among the first ten positions flagged. Its value as a use case depends on the possibility of checking several candidates. The human can frequently assess a flagged reading quickly compared with the time it would take to discover the position by examining the whole paragraph. A detector that often puts the error near the top can therefore assist review even when its first flag is a legitimate word.

A separate analysis compares the distribution of scores under intact and simulated corruption conditions. The paper plots the chance-confidence ratio, chance, and confidence on transformed scales.

−log T

Here T stands for whichever score is being plotted, log is the logarithm, and the leading minus sign negates it. For positive scores, the transformation puts smaller values farther along the scale. In the figure each comparison uses approximately 500,000 samples under the intact-word hypothesis H₀ and 1,000 under the altered-word hypothesis H₁. The simulated errors in this analysis are restricted to single-token replacements for efficiency. The authors find that the ratio has distinct distributions under the two conditions, which motivates formal testing for the kind of alteration generated in the experiment.

Following a flag back to a manuscript

The paper situates the controlled test alongside the companion study’s discoveries in premodern Greek, which include manuscript copying problems, typographical errors in editions, and digitization errors. These can look similar to a contextual detector because each can place an unexpected word in an otherwise coherent passage. Establishing the cause requires identifying where the unexpected reading entered the record. The example the authors explain in detail concerns an edition’s misreading of its manuscript.

At lines 81.89–90 of Psellus’s Hist. brev., Aerts’ edition divides a short part of the text as ἦ δὲ. The passage describes a ruler who had held power twice and hoped to rule again. In the printed wording, the words near the reference to sunshine after clouds were difficult to construe. The token δε scored very low under the threshold-based ranking, and in the illustrated surrounding context it had the smallest chance-confidence ratio. Logion’s suggestions joined the adjacent pieces by dropping the space. Its third suggestion was the joined form the authors found in the manuscript, ἡδὺ.

That Greek word contributes the sense of sweetness or pleasure, making the reference to sunshine after clouds intelligible as an explanation for the ruler’s wish. The manuscript shows that the written witness already contained this reading. For the editorial decision, the low score for the printed form helped locate the anomaly and the list supplied a direction for looking. The confirmation then came from rereading the source. The authors specifically note the low probability assigned to the correct suggestion, which illustrates the different demands of proposing a plausible change and judging its textual support.

Comparing independent and assisted gap restoration

For the human comparison, the authors made 48 gaps in the Psellus validation set. They randomly concealed spans made up of consecutive whole words and used gaps of 3-10 characters. The visual absence in a manuscript can cut through a word. Whole-word masking gave the experiment clean boundaries for sub-word tokenization. In every case the authors retained the hidden original so they could check answers against it.

The passages provided an average of 234 words of context. Johannes Haubold, who had previously proposed emendations to Psellus using traditional methods, also received the title of each passage’s source. He could search a corpus of Greek literature that excluded the source of the particular passage. This preserved access to comparative material while withholding the place where the exact answer could be looked up. He spent 7 hours on the 48 cases. The authors describe this as a fast rate for the sort of work the task was intended to represent, and the time demands shaped the number of items they used.

Haubold first submitted a conjecture without seeing BERT’s answers. He then received the ten highest-ranked suggestions and their likelihoods. He could keep his first answer or make a new conjecture. The experiment scored an answer as correct only when it exactly matched the hidden reading. This gave the authors a common criterion for the initial conjecture, the revised conjecture, and any candidate from the system.

The expert’s initial answers were more accurate than the system’s first choices. Allowing the system’s ten suggestions to count as a list made its performance substantially stronger. The best accuracy was achieved by the expert after seeing that list. In one sense the measures answer different questions. The system’s top-10 result asks whether a recoverable answer appears among the suggestions. The expert’s final accuracy asks whether a reader given those suggestions can arrive at the exact restoration. The paper describes the direction of these results in prose without giving the numerical accuracies there, so the comparison establishes the ordering of the conditions without fixing the size of the improvement.

Measuring attention to Greek grammatical relations

The authors examine a construction built around the particles μέν and δέ. These small words often signal the relationship between parallel clauses, with μέν marking the first part and δέ introducing its answering part. An instance of μέν can also function adverbially, and some uses are answered by a different particle. The authors use head 5-0 to see how well its strongest attention from μέν tracks those possibilities.

In 99% of the cases considered for its overall distribution, the head directs the strongest attention from μέν to δέ, its elided form, or μέν itself. Within the analysis of cases with no answering δέ, μέν directs its strongest attention to itself 92.2% of the time and to a suitable alternative particle 5.8% of the time. These are rates for observed attention choices in their respective groups. The examples with alternative particles allow a closer comparison with descriptions of Greek usage. In all five occurrences of πρῶτον μέν in the test sample, the head selects ἔπειτα or εἶτα, particles associated with the next part of a sequence. The paper also reports 3 instances in which the head selects μήν in the absence of a following δέ, all in the expression οὐ μήν.

For a wider test, the authors draw on passages by Plato and Thucydides whose annotations come from Perseus’s Ancient Greek and Latin Dependency Treebank. A treebank marks grammatical relations so the researchers can ask whether the word chosen by a head is the word indicated by an annotation. The authors report limited performance across the treebank’s dependency classifications in general. Restricting attention to particular parts of speech or construction types reveals stronger patterns. Head 1-3 appears to connect helper particles with governing verbs. Heads 9-1 and 9-2 perform relatively well on broader patterns including attributive relationships. Those targeted tests are compared with a control based on word position. Treebanks

What the ablations show

What the distance-bounded ratio adds

The paper’s explicit ablation study compares the full error ranking with two partial rankings on the same simulated task. Ranking by chance alone uses the observed word’s contextual probability. Ranking by confidence within scribal distance 1 uses the strength of a nearby candidate. The full chance-confidence ratio uses both probabilities and defines the competition within the distance bound. Each ranking is applied at every position in the paragraph. The authors then ask where each puts the known corruption.

All three scores bring many of the errors into a relatively small part of the passage. More than 85% of the altered words fall in the bottom 10% by score under each ranking, the end of the ordering inspected for suspicious words. The paper plots the cumulative distribution of ranks within paragraphs and computes uncertainty bands with 99% coverage using the DKW inequality. A broad shortlist therefore benefits from each scoring approach. The sharper difference appears at its head. Chance alone is first on 59.7% of paragraphs, and each partial ranking is first in less than 60% of cases. The full ratio has 90.5% top-1 accuracy.

A low probability for the written form can detect a mismatch between a word and its surroundings. Since ordinary prose can also contain rare usages, this score may leave an editor with several plausible flags. A high probability for a close candidate supplies a different piece of information: the local context supports a particular reading strongly. That can also occur in an intact passage. Using the probability of the observed word relative to the best eligible reading brings both considerations to the same decision. In the simulation, that combination is especially effective at prioritizing the position of the one intentionally introduced change.

The comparison is informative about the complete scoring rules that the authors tested. Chance alone drops information about the nearby candidate, whereas restricted confidence drops the observed word’s score. Because these are complete alternative rankings, the experiment does not isolate the effect of the vowel-specific edit costs or compare different distance rules with both probability terms kept fixed. It also establishes the comparison on the single-character corruption generator. Changes produced by other mechanisms could lead to different rankings.

What carrying over earlier training contributes

The initialization experiment compares an existing set of Greek BERT weights with random initialization. The two runs keep the same tokenizer, which was designed for Modern Greek sub-words. The authors report that the validation losses converge to the same value after a small number of epochs. They find no discernible benefit from the inherited weights on that criterion. This result addresses the training route they tested, including the earlier use of Modern Greek in the lineage of the initialized system.

The fixed tokenizer is important in reading the result. Reusing the same segmentation makes the validation loss comparison meaningful between the runs. It also leaves a different question open: how training would behave with a vocabulary and segmentation designed specifically for older Greek. The authors identify that as a direction for future work. Their comparison of initializations neither tests alternative segmentations nor provides a separate downstream result for error finding or assisted restoration under each initialization.

What changes when the expert sees the list

The gap experiment has an internal comparison in which the same expert considers the same passages before and after receiving suggestions. The initial answer gives the study an independent conjecture for each item. The revised answer shows what the expert can do with the additional information and a chance to reconsider. The system’s first choice supplies a comparison with automated selection. Its longer list measures candidate coverage, an important condition for recovering a reading through collaboration.

The outcome is consistent with a workflow in which automated search and expert assessment make different contributions. The beam searches explore possibilities across token counts, and the expert can judge the resulting words in a much broader philological setting. Seeing the suggestions can bring a construction or expression to mind, even when the expert does not take the first candidate. The experiment measures the final answer after that opportunity. It does not separate the influence of reading particular suggestions from the influence of additional time and reconsideration. The paper also describes the specialized consecutive-mask training as a response to the mismatch between training and inference, without reporting a gap-filling ablation that quantifies its independent contribution.

What the offset control reveals about attention

The attention analysis asks whether a head that appears to follow grammar could be succeeding by choosing a position at a habitual distance. The paper’s fixed-offset control checks how often the head attends to a word at each fixed displacement, and retains the best result across the range.

−10 ≤ k ≤ 10

Here k is a signed integer offset in word positions. Negative offsets lie before the source word and positive offsets lie after it. The inequalities indicate the range over which the paper looks for the strongest fixed-offset performance. This use of k refers to word position in the attention analysis. In the error detector, k is a bound on scribal distance between strings.

Some relations frequently involve nearby words. The authors describe interjections and vocatives as an example where the best offset performance is concentrated at short distances. Head 5-0, which performs well on μέν and its answering particle, has relatively low performance for any fixed offset. A corresponding δέ can be far away, and its distance is variable. The head’s behavior across this construction is therefore harder to account for as a rule that always points a fixed number of words away. The paper suggests that the flexibility of Greek word order helps explain why grammatical performance can exceed a positional control.

The particle examples give additional evidence about the character of the behavior. An attention head could direct μέν to a nearby δέ and seem successful across many regular instances. Selecting ἔπειτα or εἶτα in the relevant sequential construction, or μήν in the environment identified in the grammatical literature, shows useful selectivity in cases where the standard answer is absent. The authors’ broader results temper the interpretation. The same procedure probes chosen relationships, and its success varies with the relation and the parts of speech included in the test.

Limitations

Limits the authors identify

Scribal errors are difficult to generate realistically. The paper emphasizes the role of an individual copyist, the context of the work, and the copyist’s response to the text. Its simulation changes a character and requires the result to be a familiar word in the author’s vocabulary. That captures a family of small alterations that can evade a dictionary check. Omissions, normalizations, and larger changes can arise under different conditions. The discovery in the printed Psellus shows a more complicated case involving a word boundary, where an editorially decisive proposal can receive a low system probability.

The authors also point out a tension between contextual probability and historical authenticity. A scribe who simplifies an unusual phrase can create a reading that BERT considers more probable than the original. Philological preference for a harder reading in some circumstances reflects the possibility that copying tends to smooth a text. An expectation that the original will maximize contextual probability can therefore point in the wrong direction. The paper proposes exploring models of successive scribal changes, including a diffusion formulation in which a text changes repeatedly under a learned transition process. It also discusses extending ELECTRA’s generator and discriminator approach to repeated substitutions, with visual and phonetic constraints on what the generator can change. These are research proposals motivated by the limitations of direct contextual scoring.

The mathematical motivation for the ratio depends on having compatible conditional and joint probabilities. The paper acknowledges that the required joint distribution over sentences has no theoretical guarantee in this setting. The ratio is directly usable as a ranking statistic, and the artificial experiment tests how that ranking performs. Treating it as proof that the highest-scoring local edit maximizes a well-defined sentence probability requires the additional assumption. Even a valid probability comparison would still leave the historical question of how a particular reading arose.

For restoration, the authors acknowledge that they chose whole-word gaps for convenience with sub-word tokenization. The experiments supply the exact character count, whereas the practical motivation is that editors can sometimes estimate it from physical dimensions. They also identify fixed-character infilling and the segmentation of premodern Greek as opportunities for improvement. The restricted access to part of the corpus is a separate constraint. The Thesaurus Linguae Graecae license limits redistribution, although the authors can share some training material on request. The paper identifies the Logion repository for the framework and describes the main training settings.

The authors caution that token prediction accuracy and pseudo-perplexity depend on tokenization. Hiding a different unit changes what must be predicted and which information remains visible in the context. For example, a single hidden sub-word can leave another part of the same word in view. With a segmentation that keeps the word intact, a single hidden token can remove that useful clue. The reported test figures thus characterize prediction under the segmentation used in training. Comparing them with figures from a different tokenizer would require care about the underlying task.

Limits of the experimental designs

In the corruption experiment, each test paragraph contains a deliberately inserted error and the evaluated system can rank every word. An editor inspecting an ordinary passage usually lacks that knowledge about how many corruptions are present. A first-ranked word exists even in a sound paragraph. Accordingly, the reported top-1 detection accuracy does not supply precision for a continuous run over an edition, where many high-ranked positions might need to be checked. Similarly, the replacement accuracy of 98.1% is conditional on the artificial error having ranked first. It is evidence about repair after a particular success at localization.

The use of Psellus helps the system learn an author-specific reference and gives the expert comparison a coherent body of work. It also limits the range of the direct evidence. A corpus for another author might be smaller, or the surviving language might vary in ways that make author-specific probabilities harder to estimate. The paper’s broad aim is to help with Greek manuscript traditions. The controlled studies establish performance in the author-specific setting they report. The separate attention experiments on classical writers investigate selected grammatical behavior and do not test editorial detection or restoration on those writers’ works.

The restoration experiment measures exact recovery of the hidden wording. On a constructed gap this gives a clear standard, and it can mark a grammatically sound conjecture wrong if a different phrase actually appeared in the source. In an authentic loss, several restorations may be viable and the original may remain unavailable for direct comparison. Physical estimates can also admit a range of possible lengths, while the experiment gives the search a definite target. The artificial test measures how well the expert and the system recover known text under controlled constraints. It leaves open how the quality and usefulness of suggestions change as those constraints become less certain.

The expert experiment uses one experienced reader, the same 48 examples for the two judgments, and a fixed order in which supported judgments come second. The comparison demonstrates that assistance and revision together can improve answers in this setting. It gives limited evidence about the size of the benefit for other readers, and there is no separate condition measuring what would happen if the expert reviewed the first answers again without seeing suggestions. Showing the title and giving access to external Greek material make the exercise closer to the working conditions the authors wanted, while keeping the result tied to that particular arrangement.

Finally, a head’s strongest attention is an observable feature of the network’s computation. Agreement with a grammatical annotation shows that the feature can be read as a classifier for selected examples. Establishing that the head is causally responsible for a restoration or an error flag would require examining how predictions change when that head’s contribution is altered. The reported study compares head behavior with grammatical descriptions, annotations, and positional controls. Its strongest evidence is that some relationships are reflected in particular attention patterns. The weaker performance across the broader dependency classifications gives a sense of how selective that evidence is.

What came after

The Patrologia Graeca Corpus (2026) cites Logion in work on optical character recognition, annotation, and open release of nineteenth-century polytonic Greek editions. Optical character recognition turns images of printed writing into machine-readable text. Annotation adds information to the resulting corpus. In this case the source material consists of printed Greek editions whose digital text is described as noisy. The report concerns making that material available as a corpus rather than applying the Psellus restoration experiment to a new set of passages.

The connection is clearest in the kinds of errors that can intervene between an earlier text and the text a reader searches today. Logion discusses corruptions introduced in copying and also identifies problems arising in print and digitization. The Patrologia Graeca work focuses on the digital processing and release of editions, where the difference between what is on the printed page and what appears in a digital transcription is directly relevant. The citation establishes a connection between these projects. The identity of any particular Logion score, training procedure, or restoration method reused in the later project is unspecified.

Cite

Cite as Charlie Cowen-Breen, Creston Brooks, Johannes Haubold and Barbara Graziosi. 2023. Logion: Machine Learning for Greek Philology. arXiv (Cornell University).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2305.01099 · arXiv 2305.01099

@misc{cowenbreen2023logion,
  title = {{Logion: Machine Learning for Greek Philology}},
  author = {Charlie Cowen-Breen, Creston Brooks, Johannes Haubold and Barbara Graziosi},
  year = {2023},
  doi = {10.48550/arxiv.2305.01099},
  eprint = {2305.01099},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2305.01099}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/breen-2023-logion-machine-learning-greek-philology/

References

24 references, from the paper's own bibliography.

  1. Y. Assael, T. Sommerschield, B. Shillingford. 2022. Restoring and Attributing Ancient Texts Using Deep Neural Networks. Nature. OpenAlex ↗ · Scholar ↗
  2. B. Graziosi, J. Haubold, C. Cowen-Breen, C. Brooks. 2023. Machine Learning and the Future of Philology: A Case Study. TAPA. OpenAlex ↗ · Scholar ↗
  3. J. Devlin, M.-W. Chang, K. Lee, K. Toutanova. 2019. Pre-Training of Deep Bidirectional Transformers for Language Understanding. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. OpenAlex ↗ · Scholar ↗
  4. P. Singh, G. Rutten, E. Lefever. 2021. A Pilot Study for BERT Language Modelling and Morphological Analysis for Ancient and Medieval Greek. Proceedings of the 5th Joint SIGHUM Workshop on Computational Linguistics for Cultural Heritage, Social Sciences, Humanities and Literature. OpenAlex ↗ · Scholar ↗
  5. A. Wang, K. Cho. 2019. BERT has a Mouth, and it Must Speak: BERT as a Markov Random Field Language Model. Proceedings of the Workshop on Methods for Optimizing and Evaluating Neural Language Generation. our card
  6. P. Etoori, C. Manoj, M. Radhika. 2018. Automatic Spelling Correction for Resource-Scarce Languages Using Deep Learning. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics. Student Research Workshop. OpenAlex ↗ · Scholar ↗
  7. M.\bibnamedelimi Can Ganiz. 2020. Grammar and Spell Checking For Turkish Language. http://cse.eng.marmara.edu.tr/dosya/eng/cse/documents/grad_proj/add_3.pdf OpenAlex ↗ · Scholar ↗
  8. D. Naber. 2003. A Rule-Based Style and Grammar Checker. http://www.danielnaber.de/languagetool/download/style_and_grammar_checker.pdf OpenAlex ↗ · Scholar ↗
  9. J. Ren, P.\bibnamedelimi J. Liu, E. Fertig, J. Snoek, R. Poplin, M.\bibnamedelimi A. DePristo, J.\bibnamedelimi V. Dillon, B. Lakshminarayanan. 2019. Likelihood Ratios for Out-of-Distribution Detection. Advances in Neural Information Processing Systems 32 (NeurIPS 2019). OpenAlex ↗ · Scholar ↗
  10. D.\bibnamedelimi R. Reinsch. 2014. Michaelis Pselli Chronographia. OpenAlex ↗ · Scholar ↗
  11. R.\bibnamedelimi A. Wagner, J.\bibnamedelimi M. Fischer. 1974. The String-to-String Correction Problem. Journal of the Association for Computational Linguistics. OpenAlex ↗ · Scholar ↗
  12. V. Gangal, A. Arora, A. Einolghozati, S. Gupta. 2020. Likelihood Ratios and Generative Classifiers for Unsupervised Out-of-Domain Detection in Task Oriented Dialog. Proceedings of the Thirty-Fourth AAAI Conference on Artificial Intelligence (AAAI-20). OpenAlex ↗ · Scholar ↗
  13. Y. Assael, T. Sommerschield, J. Prag. 2019. Restoring Ancient Text Using Deep Learning: A Case Study on Greek Epigraphy. Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP): System Demonstrations. our card
  14. J. Haubold. 2023. Konjekturen zu Michael Psellos, \em De Philosophia. Byzantion. OpenAlex ↗ · Scholar ↗
  15. J.\bibnamedelimi D. Denniston, K.\bibnamedelimi J. Dover. 2005. The Greek Particles. OpenAlex ↗ · Scholar ↗
  16. K. Clark. 2019. What Does BERT Look at? An Analysis of BERT's Attention. Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP. OpenAlex ↗ · Scholar ↗
  17. R. Guarasci, S. Silvestri, G. De\bibnamedelima Pietro. 2023. Assessing BERT's Ability to Learn Italian Syntax: A Study on Null-subject and Agreement Phenomena. Journal of Ambient Intelligence and Humanized Computing. OpenAlex ↗ · Scholar ↗
  18. V. Ravishankar. 2021. Attention Can Reflect Syntactic Structure (If You Let It). Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume. OpenAlex ↗ · Scholar ↗
  19. A. Vaswani. 2017. Attention Is All You Need. Proceedings of the 31st International Conference on Neural Information Processing Systems (NeurIPS'17). our card
  20. D. Bamman, G. Crane. 2011. The Ancient Greek and Latin Dependency Treebanks. Language Technology for Cultural Heritage. Theory and Applications of Natural Language Processing. OpenAlex ↗ · Scholar ↗
  21. S. Gururangan. 2021. Demix Layers: Disentangling Domains for Modular Language Modeling. OpenAlex ↗ · Scholar ↗
  22. M.\bibnamedelimi L. West. 1973. Textual Criticism and Editorial Technique Applicable to Greek and Latin Texts. OpenAlex ↗ · Scholar ↗
  23. J. Sohl-Dickstein. 2015. Deep Unsupervised Learning Using Nonequilibrium Thermodynamics. Proceedings of the 32nd International Conference on Machine Learning. our card
  24. K. Clark. 2020. ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators. Proceedings of the 8th International Conference on Learning Representations. https://openreview.net/group?id=ICLR.cc/2020/Conference OpenAlex ↗ · Scholar ↗