Neural Representation Learning for Scribal Hands of Linear B

In this work, we present an investigation into the use of neural feature extraction in performing scribal hand analysis of the Linear B writing system. While prior work has demonstrated the usefulness of strategies such as phylogenetic systematics in tracing Linear B's history, these approaches have relied on manually extracted features which can be very time consuming to define by hand. Instead we propose learning features using a fully unsupervised neural network that does not require any human annotation. Specifically our model assigns each glyph written by the same scribal hand a shared vector embedding to represent that author's stylistic patterns, and each glyph representing the same syllabic sign a shared vector embedding to represent the identifying shape of that character. Thus the properties of each image in our dataset are represented as the combination of a scribe embedding and a sign embedding. We train this model using both a reconstructive loss governed by a decoder that seeks to reproduce glyphs from their corresponding embeddings, and a discriminative loss which measures the model's ability to predict whether or not an embedding corresponds to a given image. Among the key contributions of this work we (1) present a new dataset of Linear B glyphs, annotated by scribal hand and sign type, (2) propose a neural model for disentangling properties of scribal hands from glyph shape, and (3) quantitatively evaluate the learned embeddings on findplace prediction and similarity to manually extracted features, showing improvements over simpler baseline methods.


Introduction
Neural methods have seen much success in extracting high level information from visual representations of language. Many tasks from OCR, to handwriting recognition, to font manifold learning have benefited greatly from relying on architectures imported from computer vision to learn complex features in an arXiv:2108.04199v1 [cs.CV] 14 Jul 2021 automated, end-to-end trainable manner. However much of the emphasis of this field of work has been on well-supported modern languages, with significantly less attention paid towards low-resource, and in particular, historical scripts. While self-supervised learning has seen success in these large scale settings, in this work we demonstrate its utility in a low data regime for an applied analysis task. Specifically, we propose a novel neural framework for script analysis and present results on scribal hand representation learning for Linear B.
Linear B is a writing system that was used on Crete and the Greek mainland ca. 1400-1200 BCE. It was used to write Mycenaean, the earliest dialect of Greek, and was written on leaf or page-shaped clay tablets for accounting purposes. Linear B is a syllabary, with approximately 88 syllabic signs as well as a number of ideograms, which are used to indicate the commodity represented by adjacent numerals. The sites which have produced the most material to date are Knossos, Pylos, Thebes, and Mycenae (see Palmer [15] for more detail) but for the purposes of this paper, we focus specifically on Knossos and Pylos from which we collect a dataset of images of specific instances of glyphs written by 74 different scribal hands. Many signs exhibit slight variations depending on which scribe wrote them. Therefore, being able to uncover patterns in how different scribes may write the same character can inform us about the scribes' potential connections with one another, and to an extent even the ways in which the writing system evolved over time. This is a process that has previously been performed by hand [18], but to which we believe neural methods can provide new insights.
Rather than building representations of each scribe's writing style based on the presence of sign variations as determined by a human annotator, we propose a novel neural model that disentangles features of glyphs relating to sign shape and scribal idiosyncrasies directly from the raw images. Our model accomplishes this by modeling each image using two separate real-valued vector embeddings -we share one of these embeddings across glyphs written by the same scribe, and the other across glyphs depicting the same sign, thereby encouraging them to capture relevant patterns. These embeddings are learned via three networks. The first is a decoder that attempts to reconstruct images of glyphs from their corresponding embeddings using a series of transpose convolutional layers. We penalize the reconstructed output based on its mean squared error (MSE) vs. the original. In addition, we also use two discriminator networks, which attempt to predict whether a given image-embedding pair actually correspond to one another or not, both for scribe and sign embeddings respectively. These losses are backpropagated into those original vectors to encourage them to capture distinguishing properties that we care about. This model has many potential downstream applications, as paleography has long been an integral part of the study of the Linear B texts [14]. For a handful of examples from prior work, Bennett's study of the Pylos tablets [1] revealed the existence of a number of different scribal hands, all identified on the basis of handwriting, since scribes did not sign their work. This research was carried out even before the decipherment of Linear B. Later, Driessen [5] used the archaic sign forms on Linear B material from the Room of the Chariot Tablets at Knossos, in conjunction with archaeological evidence, to argue that these tablets pre-dated the remainder of the Linear B tablets from Knossos. Skelton [18] and later Skelton and Firth [20] carried out a phylogenetic analysis of Linear B based on discrete paleographical characteristics of the sign forms, and were able to use this analysis to help date the remainder of the Linear B tablets from Knossos, whose relative and absolute dates had already been in question. Our hope is that leveraging the large capacity of neural architectures can eventually lead to further strides in these areas.
Additionally, qualitative assessments of Linear B paleography have long been used to date tablets whose history or findplaces are uncertain. This has been vital in the case of the Knossos tablets, which were excavated before archaeological dating methods were well-developed [7], and the tablets from the Pylos megaron, which seem to date to an earlier time period than the rest of the palace [19]. While qualitative techniques have been fruitful, a key motivating question in our work is to what extent we can use quantitative methods to improve on these results.
Going back further, Linear B was adapted from the earlier writing system Linear A, which remains undeciphered. There is a hundred-year gap between the last attestation of Linear A and the first attestation of Linear B. With a more thorough understanding of the evolution of these two writing systems, can we reconstruct the sign forms of the earliest Linear B, and elucidate the circumstances behind its invention? With this in mind, our approach explicitly incorporates a decoder network capable of reconstructing glyphs from learned vector representations, that we hope can eventually be useful for such investigation.
In total, three writing systems related to Linear B remain undeciphered (Cretan Hieroglypic, Linear A, and Cypro-Minoan), and a fourth (the Cypriot Syllabary) was used to write an unknown language. One motivating question is whether a better understanding of the evolution of sign forms would help contribute additional context that could make a decipherment possible. In particular, scholars are not yet in agreement over the sign list for Cypro-Minoan, and how many distinct languages and writing systems it may represent [6]. Understanding variation in sign forms is foundational for this work [14], and it makes sense to test our methods on a related known writing system (i.e. Linear B) before attempting a writing system where so much has yet to be established.
Overall these are just some of the applications that we hope the steps presented here can be directed towards.

Prior Work
One of our primary points of comparison is the work of Skelton [18], who manually defined various types of systematic stylistic variations in the way signs were written by different scribal hands, and used these features to analyze similarity between scribes via phylogenetic systematics. In a sense this work can serve as our human baseline, giving insight into what we might expect reasonable While neural methods have not previously been used in analyzing this particular writing system, there is established literature on applying them to typography more broadly. For example, Srivatsan et al. [21] used a similar shared embedding structure to learn a manifold over font styles and perform font reconstruction. There has also been extensive work on writer identification from handwritten samples [2,17,25,4], as well as writer retrieval [3]. However these approaches rely on supervised discriminative training, in contrast to ours which is not explicitly trained on predicting authorship, but rather learning features.

Methods
In this section we describe the layout of our model and its training procedure. At a high level, our goal is to train it on our dataset of images of glyphs, and in doing so learn vector embeddings for each scribe that encode properties of their stylistic idiosyncrasies -for example which particular variations of each sign they preferred to use -while ignoring more surface level information such as the overall visual silhouettes of the signs we happen to observe written by them. To do this, we break the roles of modeling character shape and scribal stylistic tendencies into separate model parameters, as we now describe.
Our model, depicted in Figure 2, assigns each sign and each scribal hand a vector embedding to capture the structural and stylistic properties of glyphs in our data. These embeddings are shared by glyphs with the same sign or scribe, effectively factorizing our dataset into a set of vectors, one for each row and column. The loss is broken into two parts, a reconstruction loss and a discriminative loss. The reconstruction loss is computed by feeding a pair of sign and scribe embeddings to a decoder, which then outputs a reconstruction of the original glyph that those embeddings correspond to. A simple MSE is computed between this and the gold image. The discriminative cross-entropy loss is computed by the discriminator, a binary classifier which given an image of a glyph and a scribe embedding must predict whether or not the two match (i.e. did that scribe write  Fig. 2. Diagram of the model -each row is assigned a scribe embedding, and each column is assigned a sign embedding, which feed into a decoder and discriminator to collectively compute the loss function. that glyph). We train this on equally balanced positive and negative pairs. A similar discriminator is applied to the sign embeddings. In our experiments, we ablate these three losses and examine the effects on performance.
More formally, suppose we have a corpus of images of glyphs X, where X i ∈ [0, 1] 64×64 depicts one of J characters and is authored by one of K scribes. We define a set of vectors Y , where each Y j ∈ R d represents features of sign j. Similarly we define a set of vectors Z, where each Z k ∈ R d represents features of scribe k. Thus, a given X i depicting sign j and authored by scribe k is represented at a high level in terms of its corresponding Y j and Z k , each of which is shared by other images corresponding to the same character or scribal hand respectively.
For a given X i , the decoder network takes in the corresponding pair of vectors Y j and Z k , and then passes them through a series of transpose convolutional layers to produce a reconstructed imageX i . This reconstruction incurs a loss on the model based on its MSE compared to the original image.
Next, the scribal hand discriminator with parameters φ passes X i through several convolutional layers to obtain a feature embedding which is then concatenated with the corresponding Z k and passes through a series of fully connected layers, ultimately outputting a predicted p(Z k |X i ; φ) which scores the likelihood of the scribal hand represented by Z k being the true author of X i . Similarly, a sign discriminator with parameters ψ predicts p(Y j |X i ; ψ), i.e. the likelihood of X i depicting the sign represented by Y j . These discriminators are shown both one true match and one false match for an X i at every training step, giving us a basic cross-entropy loss.
These components all together yield the following loss function for our model: where j and k are randomly selected such that j = j and k = k .
The format of this model lends itself out of the box to various downstream tasks. For example, when a new clay tablet is discovered, it may be useful to determine if the author was a known scribal hand or someone completely new. The discriminator of our model can be used for exactly such as a purpose, as it can be directly queried for the likelihood of a new glyph matching each existing scribe. Even if this method is not exact enough to provide a definitive answer, we can at least use the predictions to get a rough sense of who the most similar known scribes are, despite never having seen that tablet during training.
Also, while our model treats the scribe and sign embeddings as parameters to be directly learned, one could easily imagine an extension in which embeddings are inferred from the images using an encoder network. Taking this further, we could even treat those embeddings as latent variables by adding a probabilistic prior, such as in Variational Autoencoders [9]. This would let us compute embeddings without having trained on that scribe's writing, taking the idea from the previous paragraph one step further, and letting us perform reconstructions of what we expect a full set of signs by that new scribe to look like.

Architecture
We now describe the architecture of our model in more detail. Let F i represent a fully connected layer of size i, T represent a 2x2 transpose convolutional layer, C be a 3x3 convolution, I be an instance normalization layer [23], R be a ReLU, M be a 2x2 blur pool [24]. The decoder network is then F 1024 * 4 * 4 → 4 × (T → 2 × (C → I → R)), where each convolutional layer C reduces the number of filters by half. The discriminator's encoder network is then C → 4 × (3 × (C → R) → M ) → F 16 , where each convolutional layer C increases the number of filters by double, except for the first which increases it to 64. Having encoded the input image, the discriminator concatenates the output of its encoder with the input scribe/sign embedding, and then passes the result through 7 fully connected layers to obtain the final output probability.

Collection
There has been previous work on transcribing the tablets of Knossos by Olivier [11] and Pylos by Palaima [13]. These authors present their transcriptions in form of a rough table for each hand containing every example of each sign written by them. While these are an important contribution and certainly parseable by a human reader, they are not of a format readily acceptable by computer vision methods. Since our model considers the atomic datapoint to be an individual glyph, we must first crop out every glyph from each table associated with a scribal hand. This is a nontrivial task as the existing tables are not strictly grid aligned, and many glyphs overlap with one another, which requires us to manually paint out the encroaching neighbors for many images. Ultimately we were able to convert the existing transcriptions into a digital corpus of images of individual glyphs, labeled both by scribal hand as well as sign type. This process was carried out by two graduate students under the guidance of a domain expert. Before being fed into our model, images were also binarized via Otsu's thresholding [12].
The digitization of this dataset into a standardized, well-formatted corpus is of much potential scientific value. While this process was laborious, it opens the doors not just to our own work, but also to any other future research hoping to apply machine learning methods to this data. Of course had this been a high-resource language such as English, we would have been able to make use of the multitude of available OCR toolkits to automate this preprocessing step. As such, one possible direction for future work is to train a system for glyph detection and segmentation, for which the corpus we have already created can serve as a source of supervision. This would be useful in more efficiently cropping similarly transcribed data, whether in Linear B or other related languages.

Augmentation
Due to the limited size of this corpus, there is a serious risk of models overfitting to spurious artifacts in the images rather than properties of the higher level structure of the glyphs. To mitigate this, we perform a data augmentation procedure to artificially inflate the number of glyphs by generating multiple variants of each original image that differ in ways we wish for our model to ignore. These are designed to mimic forms of variation that naturally occur in our data -for example, glyphs may not always be perfectly centered within the image due to human error during cropping, and strokes may appear thicker or thinner in some images based on the physical size of the sign being drawn relative to the stylus' width, or even as a result of inconsistencies in binarization during preprocessing. Following these observations, the specific types of augmentation we use include translation by 5 pixels in either direction horizontally and/or vertically, as well as eroding or dilating with a 2x2 pixel wide kernel (examples shown in Figure 4). All together we produce 27 variations of each image. Doing this theoretically encourages our model to learn features that are invariant to these types of visual differences, and therefore more likely to capture the coarser stylistic properties we wish to study.

Statistics
Our dataset represents 88 Linear B sign types, written by 74 scribal hands (of these 48 are from Knossos and 26 are from Pylos). For each scribal hand, we observe an average of 56 glyph images, some which may represent the same sign.
Conversely each sign appears an average of 47 times across all scribal hands. This gives us a total of 4, 134 images in our corpus, which after performing data augmentation increases to 111, 618.

Experiments
Having trained our model, we need to be able to quantitatively evaluate the extent to which it has learned features reflective of the sorts of stylistic patterns we care about, something which is nontrivial given the lack of any supervised ground truth success criteria. There are two metrics we use to accomplish this.
First, given that we expect scribes of the same findplace to share stylistic commonalities, we train a findplace classifier based on our scribal hand embeddings to probe whether our model's embeddings contain information that is informative for this downstream task. Secondly, since we have human generated scribal hand representations in the form of Skelton's manual features [18], we can measure the correlation between them and our model's learned manifold to see how well our embeddings align with human judgements of relevant features. We now describe these evaluation setups in more detail.

Findplace Classification
The first way we evaluate our model is by probing the learned embeddings to see how predictive they are of findplace, a metadata attribute not observed during training. Since our goal is to capture salient information about broad similarities between scribal hands, one coarse measure of our success at this is to inspect whether our model learns similar embeddings for scribes of the same findplace, as they would likely share similar stylistic properties. One reason for this underlying belief is that such scribes would have been contemporaries of each other, as can be infered from the fact that existing Linear B tablets were written "days, weeks, or at most months" before the destruction of the palaces [14]. For any scribes working together at the same place and time, we observe similar writing styles, likely as a result of the way in which they would have been trained. The number of scribes attested at any one palatial site is quite low, which would seem to rule out a sort of formal scribal school as attested in contemporary Near Eastern sources, and instead suggests that scribal training took place as more of a sort of apprenticeship, or as a profession passed from parents to children, as is attested for various sorts of craftsmen in the Linear B archives [14]. Thus, we expect that scribes found at the same findplace would exhibit similar writing styles, and therefore measuring how predictive our model's embeddings are of findplace serves as a reasonable proxy for how well they encode stylistic patterns.
To this end, we train a supervised logistic regression classifier (one per model) to predict the corresponding findplaces from the learned embeddings, and evaluate its performance on a held out set. In principal, the more faithfully a model's embeddings capture distinguishing properties of the scribal hands, the more accurately the classifier can predict a scribe's findplace based solely on those neural features. We perform k = 5 fold cross validation, and report average F 1 score over the 5 train/test splits. Our final numbers reflect the best score over 15 random initializations of the classifier parameters for each split.
Findplaces for the Knossos tablets were described in Melena and Firth [10], and for Pylos in Palaima [13]. However, there are some findplaces from which we only have one or two scribal hands in our corpus. As supervised classification is not practically possible in such cases, we exclude any findplaces corresponding to 2 or fewer scribal hands from our probing experiments. This leaves us with 63 scribal hands, labeled by 8 different findplaces to evaluate on.

QVEC
While findplace prediction is a useful downstream metric, we also wish to measure how well the neural features our model learns correlate with those extracted by expert humans. In order to do this, we use QVEC [22] -a metric originally developed for comparing neural word vectors with manual linguistic featuresto score the similarity between our learned scribal hand embeddings and the manual features of Skelton [18]. At a high level, QVEC works by finding the optimal one-to-many alignment between the dimensions of a neural embedding space and the dimensions of a manual feature representation, and then for each of the aligned neural and manual dimensions, summing their Pearson correlation coefficient with respect to the vocabulary (or in our case the scribal hands). Therefore, this metric provides an intuitive way for us to quantitatively evaluate the extent to which our learned neural features correlate with those extracted by human experts. As a side note, while the original QVEC algorithm assumes a one-to-many alignment between neural dimensions and manual features, we implement it as a many-to-one, owing to the fact that in our setting we have significantly more manual features than dimensions in our learned embeddings, implying that each neural dimension is potentially responsible for capturing information about multiple manual features rather than vice versa as is the case in the original setting of Tsvetkov et al. [22].

Baselines
Our primary baseline is a naive autoencoder, that assumes a single separate embedding for every image in the dataset, therefore not sharing embeddings across signs or scribal hands. Its encoder layout is the same as that of our discriminator, and its decoder is identical to that of our main model so as to reduce differences due to architecture capacity. In order to obtain an embedding for a scribal hand using this autoencoder, we simply average the embeddings of all glyphs produced by that scribe. We report several ablations of our model, indicating the presence of the reconstruction loss, scribal hand discriminator loss, and sign discriminator loss by +Recon, +Scribe, and +Sign respectively. Finally, we provide the F 1 score for a naive model that always predicts the most common class to indicate the lowest possible performance.

Training Details
We use sign and scribe embeddings of size 16 each for all experiments. Our model is trained with the Adam [8] optimization algorithm at a learning rate of 10 −4 and a batch size of 25. It is implemented in Pytorch [16] version 1.8.1 and trains on a single NVIDIA 2080ti in roughly one day. The classifier used for evaluation is trained via SGD at a learning rate of 10 −3 and a batch size of 15. Table 1. (Left) Best cross validated F1 achieved by logistic regression findplace classifier on embeddings produced by ablations of our model, compared to an autoencoder, and naive most common label baseline. (Right) QVEC [22] score between models' embeddings and manual features of Skelton [18].

Model
Findplace  Table 1 shows results of a findplace classifier trained on our system's output vs. that of an autoencoder, with the score for a most common baseline as a lower bound. We see that our full model with all three losses achieves the highest score, with reduced performance as they are successively removed. The worst score comes from the model trained on purely discriminative losses with no decoder, suggesting that the reconstruction loss provides important bias to prevent overfitting given the limited dataset size. This also makes sense given the strong performance by the vanilla autoencoder. For reference, Skelton [18] provides manual feature representations for 20 of the scribal hands in our corpus (17 of which are from the 6 findplaces shared by at least one other scribe in that set). If we perform a similar probing experiment with the hand crafted features for those 17 scribes, we get an F 1 score of 0.37. While this result is useful as an indicator of where the upper bound on this task may be, it is very important to note that this experiment is only possible on a small subset of the scribes we evaluate our model on and is therefore not directly comparable to the results in Table 1. A more direct comparison to the neural features of our model would require extracting manual features for the remaining 54 scribal hands, which is beyond the scope of this work. Table 1 also shows the QVEC similarity between each of the models' learned embeddings and the manual features of Skelton [18]. Once again, our system ranks highest, with the autoencoder also performing more strongly than our ablations. Interestingly, we see here that our discriminative losses appear more important than the reconstructive loss, suggesting that by encouraging the model to focus on features that are highly distinguishing between scribes or signs we may end up recovering more of the same information as humans would. Figure 5 shows example reconstructions from our decoder. These reconstructions are based solely on the scribe and sign representations for the corresponding row and column. We see that the model is able to realistically reconstruct the glyphs, showing that it is very much capable of learning shared representations for sign shape and scribal hand styles, which can then be recombined to render back the original images. This would imply that our embedding space is able to adequately fit the corpus, and perhaps requires some additional inductive bias in order to encourage those features to be more high level.
There are also additional downstream tasks we have not yet evaluated on that may be worth attempting with our system. The most obvious is that of phylogeny reconstruction. Now that we have trained scribal hand embeddings, it remains to be seen how similar a phylogenetic reconstruction based on these features would resemble that found by Skelton [18]. This may give us a better idea as to whether the embeddings we have computed are informative as to the broader hierarchical patterns in the evolution of Linear B as a writing system. Example reconstructions from our model for various scribal hands. The model manages to capture subtle stylistic differences, but we see a failure mode in the middle row right column where the output appears as a superposition of two images.

Conclusion
In this paper we introduced a novel approach to learning representations of scribal hands in Linear B using a new neural model which we described. To that end, we digitized a corpus of glyphs, creating a more standardized dataset more readily amenable to machine learning methods going forwards. We benchmarked the performance of this approach compared to simple baselines and ablations by quantitatively measuring how predictive the learned embeddings were of held out metadata regarding their findplaces. In addition, we directly evaluated the similarity of our scribal hand representations to those from existing manual features. We believe this work leaves many open avenues for future research, both with regard to the model design itself, as well as to further tasks it can be applied towards. For example, one of the key applications of manual features in the past has been phylogenetic analysis, something which our neural features could potentially augment for further improvements. This type of downstream work can further be used in service of dating Linear B tablets, understanding the patterns in the writing system's evolution, building OCR systems, or even analyzing other related but as of yet undeciphered scripts.