Explainability of machine learning approaches in forensic linguistics: a case study in geolinguistic authorship profiling (2024)

Abstract: Forensic authorship profiling uses linguistic markers to infer characteristics about an author of a text. This task is paralleled in dialect classification, where a prediction is made about the linguistic variety of a text based on the text itself. While there have been significant advances in recent years in variety classification, forensic linguistics rarely relies on these approaches due to their lack of transparency, among other reasons. In this paper we therefore explore the explainability of machine learning approaches considering the forensic context. We focus on variety classification as a means of geolinguistic profiling of unknown texts based on social media data from the German-speaking area. For this, we identify the lexical items that are the most impactful for the variety classification. We find that the extracted lexical features are indeed representative of their respective varieties and note that the trained models also rely on place names for classifications.

## introduction forensic authorship analysis is a key area of research within forensic linguistics that seeks to gain information about the author(s) of a text. generally, there are two central domains of research within authorship analysis: comparative authorship analysis uses various methodologies to compare questioned and known documents to attribute authorship, while sociolinguistic or authorship profiling relies on the analysis of questioned texts alone to infer characteristics of an author @xcite . both areas of authorship analysis can be approached qualitatively and/or quantitatively if the amount of available data permits it. for example, quantitative work in authorship profiling has researched inferring age or gender @xcite or native language influence @xcite ) from questioned documents. nevertheless, forensic authorship profiling is often carried out in a manual or qualitative way, relying on the expertise of the forensic linguist. this is evident in famous examples like the unabomber analysis @xcite or the devil strip ransom note @xcite . in both cases, law enforcement was interested in the regional origin of the authors. this background can be inferred through analyzing the regional linguistic variation, i.e., the use of regional dialect, in the questioned documents. this is referred to as regional or geolinguistic profiling @xcite and is a task parallel to inferring the regional variety of a document as is done in language identification @xcite . even though research in forensic linguistics works more and more with statistical and computational approaches (e.g., @xcite @xcite , authorship profiling often remains a manual task. this is at times credited to the black-box approaches in current nlp research, meaning that the lack of explainability precludes these approaches from being used in legal settings (see @xcite ). ## related work the interest in explainability of machine learning (and in particular, neural) approaches is not only a relevant research area for forensic linguistics. previous work, including on language identification, has focused on understanding how classifiers come to their predictions. research started by creating an interpretable model around the actual classification approach to explain the predictions of the classifier @xcite . @xcite employed representation erasure to propose a methodology for interpretability research while @xcite explored how filters in cnns can be understood in text classification research, finding that filters do in fact learn different classes of ngrams. furthermore, @xcite showed that by training on hu-man explanation data, models can learn to translate their inner states into understandable explanations. @xcite thus summarised the main sub-fields of interest in interpretability research as focusing on "probing classifiers, behavioral studies and test suites, and interactive visualizations". @xcite were the first to research explainability in a dialect classification context. in order to analyze the classifier, they extracted lexical features that were highly relevant to the classification, aiming to use this knowledge for dialect research and not only as a means to explore machine learning approaches. they relied on lexical items, owing to the complex nature of handling preprocessing like tokenisation or pos-tagging in low(er)-resourced varieties. they indicated that refined approaches would be beneficial. however, previous research on regional variation using social media data has shown that approaches using lexical features provided excellent results (e.g., @xcite @xcite @xcite . @xcite proposed two different approaches, one intrinsic and one post-hoc, to extract features relevant to the dialect classification. in the intrinsic approach, the authors added a local interpretability layer to the dialect classifier which was trained together with the model and output the relevance of a feature for the classification. for the post-hoc approach, xie et al. used a leave-oneout (loo) method, where the change in prediction probability if a feature was left out was interpreted as a "relevance score" of that particular feature. in a forensic authorship profiling setting, an approach like this appears beneficial as it reaches high accuracies in language identification, while similarly providing explanations by extracting the features that influenced the classification. while the original study focused on improving research methods in dialectology, we apply the method to evaluate its usefulness in a forensic context. additionally, the approach has the advantage of eliminating or at least minimising researcher bias as the models learn the relevant features themselves, whereas it is the forensic linguist's expertise that culls the features in a qualitative analysis (see @xcite foot_0 . while the approach does not fully explain the inner workings of the model, experts can use the extracted features to a) verify that the model indeed reached a sound decision, for example by evaluating the features against previous dialectological findings, and b) use the explanations to introduce the method to law enforcement or jurisprudence. even if the classifiers themselves do not meet court admissibility standards @xcite , extracted features can be used for authorship work to contribute to a more objective analysis. ## data we work with a corpus of german social media data from the platform jodel. the corpus was collected by @xcite ; @xcite . it has also been used in vardial classification tasks @xcite . jodel is structurally similar to twitter/x, however it only allows anonymous posts. users of jodel can interact with other users in a 10-15 km radius around their own location, so all posts are geolocated. the corpus contains posts from austria, germany and switzerland. while most of the data is written in standard german, it shows clear regional patterns. especially in switzerland, austria and, in parts, bavaria writing is considerably further from standard german @xcite . posts from romandy contain substantial amounts of french. this data differs from the corpus used in the original study (see @xcite in terms of register and genre. the corpus consists of approximately 240 million tokens from about 8500 locations, however only 388 locations have a token count of over 10k. for our classification experiments, we mapped these locations onto wider dialect regions following three settings with 3, 4 and 5 classes respectively. the 3-class distinction is based on national borders, so the classes reflect austria, germany and switzerland. in the 4-class setting germany is additionally divided into two parts, north and south (at latitude 50.33°n) and for the 5-class setting the southern region of germany is further split into east and west (at longitude 9.97°e) (see figure 1 ). these divisions were operationalized based on knowledge from traditional dialectology @xcite . we randomly sampled 200k posts per class for training, and 20k posts per class for development and testing, respectively. on average, a post contains 11.5 tokens. besides some simple whitespace normalization (i.e., removing line breaks and tabs inside a post), we did not perform any preprocessing. ## methods and experiments the basis for our analysis is the post-hoc loo approach proposed by @xcite . while we replicate most of the methodology, we mark any changes from the original in our explanations below. crucially, and in contrast to the original dialectal research interest, we apply the approach with the goal of evaluating its usefulness in a forensic setting. additionally, we work with data that is different in terms of register and genre and thus adds to our overall understanding of the approach. ## results following the method described above, we produce a list of 100 words with the highest impact scores per class in all settings. a manual inspection of the lists quickly shows a prevalence of place names and related items like zürich or österreicher (g 'austrian') 10 . therefore, as a first step, we count the amount of these words among the top 100 and find that, on average, 14% of words are local references. in terms of classification, these results are expected (see, e.g., @xcite and it is apparent how these words are indicative of location given what they denote. although it does not take a forensic linguist to understand the connection of these items 7 xie et al. (2024) omit this step in the description of their work, but it is present in their code. to location, it is noteworthy that the classification models pick up on these words and that they match the region they are impactful for. given that the results are similar for classes based on country borders across the three settings, we focus our analysis on the 5-class setting. as a reminder, in this setting, austria and switzerland form individual classes, whereas germany is split into three regions (see figure 1 ). generally, the results show that a large proportion of extracted words are regionalized and some are prototypical dialect items. for switzerland, we find both swiss german and french lexical items to be the most impactful, such as kei (swg 'not a/no'), isch (swg 'is') and bim (swg 'at the'), or pourquoi (fr 'why'), avec (fr 'with') and raison (fr 'reason'). whereas for austria, the data shows that some of the most impactful lexical items are oasch (ag 'ass'), gspusis (ag 'affairs'), and matura (ag 'high-school diploma'). these three items are examples of a textualization of regional pronunciation, a regional item and a standard austrian variant, respectively. also, items such as jus (ag 'law (studies)'), which are relevant to the jodel demographic of mostly students under the age of 27, are extracted. this indicates that an automated classification between the three countries, for instance to clarify jurisdiction, seems reasonable. for the three german classes we find that a large proportion of top words appear textualized in standard german as opposed to more colloquial spellings including abbreviations and ellipses, which we may expect. examples of this include dankeschön (g 'thank you') or vorname (g 'first name'). considering the division within germany, we find that several forms of the verb gucken (g 'to look/watch') are impactful for the northern class, which is a variant we know to be regionalized and appearing in varieties in central and northern germany @xcite . for the south-east class the data shows items like ritter (g 'knight'), #traudel (female first name) and local beer types. for the south-west we find that items identified as relevant by @xcite , are also extracted by the loo model, like möppes (g 'breasts' or 'female user') and lörres (g 'penis' or 'male user'), although the authors argue that these forms are more jodel-than region-specific. these items are also impactful for the germany-class in the 3-class setting. ## conclusion in this paper, we employed @xcite 's approach as a means of geolinguistic profiling to understand how a method like this could be applied in a forensic context given its explainability. we have found that the dialect classifiers outperform the random baseline by a large margin in all settings, but that accuracy decreases for settings with more closely-related classes. while we recognize that in forensic contexts the focus needs to be on false predictions and hard-to-classify cases, this paper considers the explainability of the approach. to this end we have found that the loo model extracts meaningful regional features reflecting the variety used in the corresponding area. on average, 14% of extracted features are place names or similar items. while an analysis for a place name like wien does not need a forensic linguist, extracting features that are not based on a linguist's expertise is a valuable contribution of this approach even if it is not directly used for automated classification.