Eleni Metheniti

Chloé Braud

Philippe Muller

Laura Rivière

DisCut and DiscReT: MELODI at DISRPT 2023

This paper presents the results obtained by the MELODI team for the three tasks proposed within the DISRPT 2023 shared task on discourse: segmentation, connective identification, and relation classification. The competition involves corpora in various languages in several underlying frameworks, and proposes two tracks depending on the presence or not of annotations of sentence boundaries and syntactic information. For these three tasks, we rely on a transformer-based architecture, and investigate several optimizations of the models, including hyper-parameter search and layer freezing. For discourse relations, we also explore the use of adapters-a lightweight solution for model fine-tuning-and introduce relation mappings to partially deal with the label set explosion we are facing within the setting of the shared task in a multi-corpus perspective. In the end, we propose one single architecture for segmentation and connectives, based on XLM-RoBERTa large, freezed at lower layers, with new stateof-the-art results for segmentation, and we propose 3 different models for relations, since the task makes it harder to generalize across all corpora.

Introduction

Discourse analysis consists in building a discourse structure representing the organization of a document -a monologue or dialogue -, as the discourse tree in Figure 1. First, the document is split into minimal sub-units, called Elementary Discourse Units (EDU): the text in the example, consisting of two sentences, is divided into 5 EDUs (from 2 to 6). The EDUs are then attached together, forming larger discourse units -such as the pair (EDU2, EDU3) -that are recursively linked to form a tree or a graph, depending on the underlying framework. The links between the discourse units are semantic-pragmatic relations, such as CONCES-SION, EVIDENCE, SEQUENCE etc. These relations can be triggered by an explicit lexical item, a connective such as BECAUSE, WHILE, or WHEN for CONDITION in the example. Relations can also be "implicit", when no such marker is present, such as the CONCESSION between EDU2 and EDU3.

There are mainly three frameworks for discourse: Rhetorical Structure Theory (RST) [START_REF] Mann | Rhetorical Structure Theory: Toward a functional theory of text organization[END_REF]) -from which the example in Figure 1 is derived -, Segmented Discourse Theory (SDRT) [START_REF] Asher | Logics of Conversation[END_REF] -where structures are graphs -, and the Penn Discourse Treebank (PDTB) [START_REF] Prasad | The penn discourse treebank as a resource for natural language generation[END_REF], where discourse relations are sparsely annotated without constraints on the overall structure. Alternatively, there have been proposals to transform discourse structure into simpler dependency structures (dep), e.g. in RST [START_REF] Hirao | Singledocument summarization as a tree knapsack problem[END_REF][START_REF] Hayashi | Empirical comparison of dependency conversions for RST discourse trees[END_REF] or SDRT [START_REF] Muller | Constrained decoding for textlevel discourse parsing[END_REF]. Recently, this view has been taken to annotate directly new data in the SciDTB corpus [START_REF] Yang | SciDTB: Discourse dependency TreeBank for scientific abstracts[END_REF], proposing a set of relations and segmentation rules inspired by RST but producing trees of dependency relations between EDUs.

Several corpora have been annotated under each framework for different languages: however, even within the same framework, annotation guidelines and relation sets might be different for each corpus. The DISRPT shared task intends to provide a unified format for researchers to evaluate their systems against varied languages, domains, and frameworks. Three tasks were proposed: (1) discourse segmentation into EDUs, (2) identification of discourse connectives, and (3) classification of discourse relations based on attached units. The first two tasks are encoded with a BIO scheme over tokens, the latter corresponds to a multi-class classification between pairs of textual segments. The benchmark provided within DISRPT allows us to verify the robustness of our approach through 13 languages, 4 frameworks, and varied domains, including multi-party dialogues and speech transcriptions.

In this paper, we address the three tasks through two systems: DisCut1 for tasks (1) and ( 2) and DiscReT2 for task (3). These systems both rely on Transformer architectures and we thoroughly investigate different variations of the pre-trained model and the hyper-parameters values, while also varying the level of frozen layers. This latter parameter allows for lighter models, and also improvements in most cases. For task (3), we also investigate adapters [START_REF] Houlsby | Parameter-efficient transfer learning for NLP[END_REF] that provide a lightweight solution for transferring to new tasks. For all tasks, we favor multilingual pretrained models, in order to better generalize and experiment with corpus merging for relations, with the aim of providing a generic model that can be used for any corpus.

In the end, we ranked first on discourse segmentation on the treebanked track (+0.87 on the average, compared to the other system) but second for connectives (-0.47), and we are the only system with results on the plain track, with higher performance than the winner of DISRPT 2021. For relations, our system is the only one trying to mix all corpora, thus even if the performance are lower than other proposed approaches, it is possibly better at generalization.

Related work

Discourse parsing is the task of building the full trees/graphs. Most work focuses on attachment or discourse relation identification, and on English. Recently, a multilingual RST discourse parser has been proposed [START_REF] Liu | DMRST: A joint framework for document-level multilingual RST discourse segmentation and parsing[END_REF], building on previous work (Braud et al., 2017a;[START_REF] Liu | Multilingual neural RST discourse parsing[END_REF] but proposing to jointly learn attachment and EDU segmentation and adding a cross-lingual strategy, rather than English only. It shows that multilingualism is a key component to improve performance, since data scarcity affects even English, and that good segmentation is crucial, with a loss of up to 8% with predicted EDUs for full parsing.

Discourse segmentation was considered a solved task, with scores as high as 94% [START_REF] Ngo | A reranking model for discourse segmentation using subtree features[END_REF], but it was later shown that performance drops for languages other than English, -linked to smaller corpora and lesser resources -, and when gold sentences are not given, due to sentence segmenters far from being perfect (Braud et al., 2017b). The first edition of the DISRPT shared task [START_REF] Zeldes | The DIS-RPT 2019 shared task on elementary discourse unit segmentation and connective detection[END_REF] also revealed the same trend with performance above 95% for some corpora, but also issues with others such as the Spanish SCDT (82.5% at best) or the Russian RRT (86.2%). The bestperforming system in 2019 [START_REF] Muller | ToNy: Contextual embeddings for accurate multilingual discourse segmentation of full documents[END_REF] was using a single model based on multilingual BERT for every corpus [START_REF] Devlin | BERT: Pre-training of deep bidirectional transformers for language understanding[END_REF], while in the second edition [START_REF] Zeldes | The DISRPT 2021 shared task on elementary discourse unit segmentation, connective detection, and relation classification[END_REF], the best system [START_REF] Gessler | Dis-CoDisCo at the DISRPT2021 shared task: A system for discourse segmentation, classification, and connective detection[END_REF] relied on varied language models, either mono-or multilingual, associated to hand-crafted features: best overall performance was around 91.5% on average, with a loss of about 2% when the sentences are not given.

Connective identification was first seen as a word disambiguation task, where the goal was, starting with a list of candidates, to decide whether each occurrence is used in a discourse reading or not [START_REF] Pitler | Easily identifiable discourse relations[END_REF]. It has been then recast as a sequence labeling one, where we need to decide whether a token starts, is within, or is outside a discourse connective [START_REF] Stepanov | UniTN end-to-end discourse parser for CoNLL 2016 shared task[END_REF]. As for segmentation, performance drops when existing systems are trained on new domains or languages [START_REF] Xue | CoNLL 2016 shared task on multilingual shallow discourse parsing[END_REF][START_REF] Scholman | Comparison of methods for explicit discourse connective identification across various domains[END_REF], but fewer studies investigated this task since implicit relations are more an issue for discourse parsing. The first two editions of DISRPT demonstrated rather high performance: between 92 -94 for the English and Turkish corpora, and 87 for the Chinese one, with only a small drop when sentences are not given.

Discourse relations are the main object of study within the domain, with a specific focus on implicit ones since the connective is considered a very strong clue for guessing the relation [START_REF] Pitler | Easily identifiable discourse relations[END_REF]. However, again, performance drops, even for explicit relations when data are scarce (Jo-hannsen and Søgaard, 2013). Moreover, a real-life scenario has to deal with both implicit and explicit relations, it is thus interesting to see results combining all types of relations, and for several languages. Only two systems were presented in 2021, and the winning model was based on Transformers, with a specific pretrained model depending on the target language and additional hand-crafted features: best overall performance is still low, with 61.8%.

Data

The 2023 DISRPT shared task, including suprise datasets, provides 26 corpora for 13 languages and 4 theoretical frameworks: 9 correspond to the PDTB framework (thus connective and relations), the others are either RST (12), dependency (3) or SDRT (2) (thus segmentation and relations). Among these, 10 new corpora are introduced in the 2023 edition: 6 are released as surprise datasets, with one new language (Thaï), and out-of-domain (OOD) data for English (COVID-DTB and TED), Portuguese (CRPC and TED) and Turkish (TED).

All statistics are given in Table 1. The largest corpora are the English PDTB (1, 992 training documents), dep SciDTB (492 documents), and RST DT (309 training documents), and, for SDRT, the French Annodis (64 documents). In total, 8 corpora have less than 100 documents and are thus considered very small. The OOD corpora have no training set: the English COVDTB is rather large, with 150 in the dev set, but the other ones, based on TED talks for English, Portuguese, and Turkish are very small, their dev sets contain only 2 documents, around 100 connectives, and 200 relations to predict. For relations, label sets contain between 9 and 32 different relations, and we note that almost no corpus has the same set as another one.

We have 6 corpora for English [START_REF] Prasad | Penn Discourse Treebank Version 3[END_REF][START_REF] Zeldes | The GUM corpus: Creating multilayer resources in the classroom[END_REF][START_REF] Carlson | Building a discourse-tagged corpus in the framework of Rhetorical Structure Theory[END_REF][START_REF] Asher | Discourse structure and dialogue acts in multiparty dialogue: the STAC corpus[END_REF][START_REF] Yang | SciDTB: Discourse dependency TreeBank for scientific abstracts[END_REF][START_REF] Nishida | Out-ofdomain discourse dependency parsing via bootstrapping: An empirical analysis on its effectiveness and limitation[END_REF], 4 for Chinese [START_REF] Zhou | Chinese discourse treebank 0.5 ldc2014t21[END_REF][START_REF] Cao | The RST Spanish-Chinese treebank[END_REF][START_REF] Cheng | Zero-shot Chinese discourse dependency parsing via cross-lingual mapping[END_REF][START_REF] Yi | Unifying discourse resources with dependency framework[END_REF], 2 for Spanish [START_REF] Iria Da Cunha | On the development of the RST Spanish Treebank[END_REF][START_REF] Cao | The RST Spanish-Chinese treebank[END_REF], 2 for Portuguese [START_REF] Christina | CST-News -a discourse-annotated corpus for single and multi-document summarization of news texts in Brazilian Portuguese[END_REF][START_REF] Mendes | Crpc-db a discourse bank for portuguese[END_REF], 1 for German [START_REF] Stede | Potsdam commentary corpus 2.0: Annotation for discourse research[END_REF], 1 for Basque [START_REF] Iruskieta | The RST Basque TreeBank: An online search interface to check rhetorical relations[END_REF], 1 for Farsi [START_REF] Shahmohammadi | Persian Rhetorical Structure Theory[END_REF], 1 for French [START_REF] Afantenos | Developing a corpus of strategic conversation in the settlers of catan[END_REF], 1 for Dutch [START_REF] Redeker | Multilayer discourse annotation of a Dutch text corpus[END_REF], 1 for Russian [START_REF] Toldova | Rhetorical relations markers in Russian RST treebank[END_REF], 1 for Turkish [START_REF] Zeyrek | A discourse resource for Turkish: Annotating discourse connectives in the METU corpus[END_REF][START_REF] Zeyrek | TDB 1.1: Extensions on Turkish discourse bank[END_REF], 1 for Italian [START_REF] Tonelli | Annotation of discourse relations for conversational spoken dialogs[END_REF][START_REF] Riccardi | Discourse connective detection in spoken conversations[END_REF] and 1 for Thai. In addition, OOD datasets come from the multilingual TED Discourse Bank with data for English, Portuguese and Turkish [START_REF] Zeyrek | Multilingual extension of PDTB-style annotation: The case of TED multilingual discourse bank[END_REF][START_REF] Zeyrek | TED Multilingual Discourse Bank (TED-MDB): a parallel corpus annotated in the PDTB style[END_REF].

4 DisCut: segmentation and connectives 4.1 DisCut: Model architecture Identifying EDU boundaries and connectives (Tasks 1 and 2) corresponds to different corpora: PDTB-based datasets have connectives annotated, but not segmentation, while the others have no connectives. However, they can be both modeled as sequence labeling tasks (only "Beginning" labels for segmentation, "Beginning" and also "Inside" for connectives, to take into account multi-words markers). Our systems for these tasks are thus based on the same architecture with transformers pretrained models, fine-tuned on the task at hand.

The model is based on a pretrained language model (LM), with an additional linear layer for token classification. The LM is multilingual, allowing it to be used for all corpora. Contrary to systems proposed in 2019 and 2021 based on a similar architecture, we removed the CNN at the character level, and the LSTM outer layer, as additional experiments demonstrated no improvements.

The LM is based on a Transformer architecture with several layers within the encoder. It has been shown that, broadly speaking, lower layers mostly encode morpho-syntactic information, while upper contain more semantic ones [START_REF] Rogers | A primer in BERTology: What we know about how BERT works[END_REF][START_REF] Kovaleva | Revealing the dark secrets of BERT[END_REF][START_REF] Bender | Climbing towards NLU: On meaning, form, and understanding in the age of data[END_REF]. We thus experiment with freezing some lower layers while continuing the fine-tuning on higher levels, in order to have lighter models. "Freezing a layer" is the process of disallowing the update of weights for the target layer during the finetuning process, meaning that the layer preserves its learned information from pretraining.

Models are fed with sentences, the documents being too long for the LMs. We detail below our setting when sentences are not given ('Plain' track).

Settings

We chose to focus on multilingual LMs and experimented with mBERT [START_REF] Devlin | BERT: Pre-training of deep bidirectional transformers for language understanding[END_REF] and XLM-RoBERTa [START_REF] Conneau | Unsupervised cross-lingual representation learning at scale[END_REF]. We present results using XLM-RoBERTa, as preliminary experiments demonstrated improvements over mBERT. We experimented with both base and large versions, and tested the freezing of lower layers, aiming at possibly improved performance, with a lighter training.

With XLM-RoBERTa base, we tested no freezing, or freezing of either the first 3 or 8 layers (out of 12); for the large version, we increased to 6 and 12 layers (out of 24). We tested several values for the learning rate ∈ [10 -5 , 2•10 -5 , 10 -4 ] and chose 10 -5 . We tested different batch sizes ∈ [1, 4, 8, 16] -only the value 1 fitted our GPU for the large version -, with a gradient accumulation of 4 and a maximum of 30 epochs with patience of 10 over the performance on the development set. The input size is limited to 180. Our implementation relies on and extends the Jiant library 3 [START_REF] Phang | jiant 2.0: A software toolkit for research on general-purpose text understanding models[END_REF].

After evaluation on the dev set, we found that most models perform better with RoBERTa-large and with freezing the first 6 layers. Small improvements could be observed for some corpora with either the base version or other freezing values, but the increase was limited to less than 1.2%, and in 3 https://jiant.info/ general less than .5%, and we thus decided to favor one single model in order to make it easier to use, and better at generalizing to new data.

Dealing with raw data: The DISRPT shared task proposes two tracks for tasks 1 and 2: you can either use data segmented into sentences and syntactically parsed (Treebanked) -either gold or obtained with Stanza -, or raw tokenized documents (Plain). As the LMs have limitations on the size of their input, we can not give directly the documents as input: we thus decided to split the raw documents into sentences.

However, having observed issues with Stanza segmentation, we tried alternatives: Ersatz [START_REF] Wicks | A unified approach to sentence segmentation of punctuated text in many languages[END_REF][START_REF] Wicks | A unified approach to sentence segmentation of punctuated text in many languages[END_REF]Trankit (Nguyen et al., 2021), and chose the latter based on better performance. Note that, with the evaluation being based on tokens, we had to realign tokens when the tool was modifying the tokenization. We were unable to obtain a correct sentence segmentation for the Italian ita.pdtb.luna, composed of speech transcripts, and thus cut every 120 tokens for this corpus.

Dealing with surprise and OOD data: Dealing with the surprise Thai (tha.pdtb.tdtb) and English (eng.dep.covdtb) datasets were straightforward: since our model configuration is the same across all corpora, we retrain new models using the training data made available. This year, the organizers also include out-of-domain (OOD) data as surprise datasets, for which data are only available for evaluation (dev and test sets only). The corpora have, however, corresponding datasets within the same framework and language: we use our model trained on these available data to make predictions on the OOD ones (e.g. training on eng.pdtb.pdtb to test on eng.pdtb.tedm).

Experiments and results

We present our results in Table 2 for segmentation and connective identification. Current comparison with 2021, considering only the corpora available in 2021, demonstrate general improvements for all tasks except connective for the Plain track were results are on par: for segmentation, the average on test sets for Treebanked is 91.77% (vs 91.48 for DiscoDisco 2021) and for Plain 91.22% (vs 89.79); for connective: 91.81% (vs 91.22) for Treebanked and 91.05% (vs 91.49) for Plain. Note that our approach uses a similar architecture with much simpler inputs (only tokens), and different optimizations. When comparing the reproduced results with the ones we produced, we observed a large variance between the scores, especially for small corpora, with for example a difference of about 2 to 5 points for the TEDm corpora, and about 2 to 3 points also for other small datasets such as the spa.rst.sctb, the zho.rst.sctb, demonstrating the importance for future work to make multiple runs and indicate variance. Interested readers can find our own results on the test sets in Appendix A.

As shown in Table 2, compared to 2021, we observe a large drop in mean performance of about 10% for connective detection, for which many new corpora were added, including several OOD datasets making the task more challenging.

For segmentation, the results for the two settings, Treebanked and Plain are in general very similar, except for the Chinese zho.rst.sctb and English eng.sdrt.stac for which the Treebanked setting is clearly better (+3 to 5%). On the other hand, we have an important improvement for the French corpus fra.sdrt.annodis (almost +3%) using our new segmented files (Plain): these results are in line with the bad performance observed for Stanza. For the Russian corpus, we found that the segmentation of some parts of the documents was strange: bibliography entries were merged into very large EDUs that were split by all sentence segmenters, thus modifying the tool did not bring any improvement. For connective detection, results are rather high for large corpora already present in the previous campaigns, even if the Chinese corpus is still challenging. As expected, the Italian Luna is associated with low performance, because it is composed of speech transcriptions of dialogues. Note that the performance for the new Thai corpus is on par, but they drop on the out-of-domain TEDm corpora for which we used the model trained on a corpus with the same language and framework, but that corresponds to a domain shift. Interestingly, the use of Trankit for sentence segmentation (Plain track) leads to large improvements for Luna (almost +6%) and also allows a small increase for the Chinese zho.pdtb.cdtb (+1.4), with, on the other hand, a loss of about 2% for the English PDTB, and an impressive drop of about 16% for Thai for which the model of sentence segmentation is probably faulty. Overall, the Plain setting would lead to average results on par with the treebanked ones for connective identification, without the Thai dataset (80.54 on average for Plain against 80.59 for Treebanked, without Thai). These results indicate that the good performance of the sentence segmenter is a key component of a well performing discourse segmenter or connective identifier.

5 DiscReT: Discourse Relation Tagging

Introduction

For the third proposed task, Discourse Relation Classification across Formalisms, we submit a multilingual approach to discourse relation tagging that spans across frameworks, powered by transformerbased architectures. Our goal is to test the capacities and weaknesses of these models, given the large variety of languages and relation labels, without sacrificing the multilingual setting or the unique information captured in coarse-/fine-grained labels. Our results vary vastly between languages and frameworks but present interesting pointers for future work and model improvements.

Dataset

In order to stay faithful to the multilingual nature of the task, we decided to use all the datasets in parallel for training. Extensive earlier experiments with translations of the datasets to English, training with groups of corpora per language family, or training per annotation framework were not as successful or did not significantly outperform the accumulative approach.

We aimed to reduce label space and maximize label coverage, i.e. not having a label that only exists in one corpus if it can be rewritten as a more general one. First, we lower-cased all labels in all datasets (but preserved our modifications, in order to reverse them for the final results in accordance with the Shared Task data). Second, we manually merged labels that were either spelling variants or simplified versions of existing labels. For example, the label "qap" means "question-answer pair", which already exists as the label "question_answer_pair". Mean- while, the label "conjunction" is a simplified version of the label "expansion.conjunction" found in RST corpora in both forms, therefore by changing the label to its more verbose form, we are preserving its information and making the labels more uniform. However, we decided against the large-scale conversion of labels based on their meaning, e.g. merging the "conjunction" and "joint" labels.These conversions reduced the number of unique labels from 163 to 135; while the number was not significantly reduced, we wanted to make the results more interpretable without sacrificing important information. We present the implemented conversions in Table 3. We make use of the directional information of the relations, available in the datasets in the column "dir". We do not change the input in sentences with the direction "1>2", but we switch the input position of sentences with the direction "1<2" to "2>1". An example can be found in Table 4. Even though the models we use in this task are bidirectional, we observed an increase in performance when the direction of relations was unified.

We do not further process the text input, as the In the first example, the direction of the relation is 1>2, therefore the model input is in the same order as in the data. In the second example, the direction is 1<2, so the model input has the two sentences in reversed order.

necessary conversions (e.g. tokenization, lowercasing) are specified by each model. However, at the tokenization stage, we ensured that the input length complied with the restrictions of maximum input length that transformer-based models impose; each sentence is truncated to half of the maximum input length, if necessary.

DiscReT: Model architectures

We opted for transformer-based architectures for our experiments and tested several of them (mBERT, xml-RoBERTa, DistilBERT) in order to decide on which one to focus our research effort on. After preliminary tests, the multilingual BERT base cased model (mBERT) [START_REF] Devlin | BERT: Pre-training of deep bidirectional transformers for language understanding[END_REF] was the most successful overall and included all the languages of the Shared Task in its pretrained version available from Huggingface. 4As a "baseline" for our experiments, we trained an mBERT classifier built with PyTorch [START_REF] Paszke | Pytorch: An imperative style, high-performance deep learning library[END_REF], without frozen layers, and trained for a maximum of 5 epochs.

In order to inject additional information in the finetuning process of the classifier, without further changing the input data, we used adapters along-side our mBERT classifier. Adapters [START_REF] Houlsby | Parameter-efficient transfer learning for NLP[END_REF] are an alternative lightweight method to finetuning with equivalent good results on most NLP tasks. An adapter is a transformer architecture with layer-specific pretrained parameters Θ l which are frozen and a small set of new parameters Φ l (where l is the transformer layer). During finetuning, only the adapters' Φ l parameters are updated from the loss function L on dataset D (see Equation 1). This enables efficient parameter sharing between tasks, languages, etc.

Φ * l ← arg min Φ l L(D; {Θ l , Φ l }) (1)
We are using the tool AdapterHub [START_REF] Pfeiffer | AdapterHub: A Framework for Adapting Transformers[END_REF] which allows for easier finetuning and integration of adapters to transformer-based models. After several experiments, we observed that the finetuning process of an adapter is quite different than that of a model; the adapter set of parameters learns most effectively with more finetuning epochs than a normal model and the training process per epoch is longer. Additionally, we experimented with freezing the parameters of certain layers for the models and the adapters, in order to determine the best model.

We trained multiple mBERT adapters, out of which the most successful were:

1. mBERT adapter trained on the entire dataset for 15 epochs and with frozen layer 1 (A1)

2. mBERT adapter trained on the entire dataset for 15 epochs and with frozen layers 1-3 (A1-3)

Results

Shared Task results

While evaluating our models, we observed that the best accuracy in each development set was not always achieved by one model. Our final submission is composed of three models:

1. the "baseline" finetuned mBERT model without adapter with multiple epochs (B)

2. the finetuned mBERT model for 3 epochs with an mBERT adapter trained for 15 epochs and layer 1 frozen (A1)

3. the finetuned mBERT-cased model for 4 epochs with an mBERT adapter trained for 15 epochs and layers 1-3 frozen (A1-3)

The results on the test set, as recreated and reported by the organizers of the Shared Task, are found in Table 5. Our poor performance is, to some extent, due to the problems we faced to convert the lower-cased and converted labels back to their upper-cased format, which was required for the Shared Task evaluation. This dramatically lowered the test results reproduced and published for the Shared Task. For clarity, we are reporting the Shared Task results from the organizers, but also include the results on the dev and test sets that were produced before converting the labels to their original in Tables 6 and7 respectively. These results were calculated with scikit-learn [START_REF] Curran Associates | Scikit-learn: Machine learning in Python[END_REF] and the process of calculating them is transparent in our code.

Our goal was to create a truly multilingual approach for discourse relation parsing. We did not aim to establish a new state-of-the-art, but to observe whether multilingual word embeddings can work in synergy (to learn common labels) and specialize at the same time (to learn corpus-unique labels). We also deliberately focused and submitted a combination of three models, instead of proposing the best model for each dataset, thus sacrificing performance for reproducibility. During our experiments, there were other combinations of adapters and models with frozen layers that yielded slightly better results on specific corpora, however, the training times for multiple models would be problematic for a Shared Task entry.

Given that our results are not much worse than approaches with a combination of monolingual models and independent training, it is possible to derive benefits from joint training and evaluating multiple languages. Our multilingual models showed strengths (e.g. in the spa.rst.rstsb dataset) and weaknesses (e.g. in English, Turkish and Chinese datasets) that cannot be pinpointed directly to a specific framework, the size of the corpus, or the size of the specific language data, and will need to be further explored. Our submission was marred by implementation issues, but we are hopeful that in future work we will tackle these issues and implement improvements on our multilingual approach.

Conclusion

In this paper, we presented our submissions for the three tasks of the DISRPT Shared Task. Our main goals were to rely on only a few architectures variants for generality, and experiment with parameter efficient methods. For Tasks 1-2, we employed multi-task, multi-corpora approaches; however, at this stage of our research our results are not opti- mal. In future work, we aim to further explore this strategy, as it seems promising for lower-resource languages. Additionally, we are interested in approaches beyond the scope of this campaign, such as domain transfer. Furthermore, it was possible to perform segmentation and connective detection on datasets without training data, as shown by the surprise TEDm test sets. It would be interesting to examine whether the DISRPT framework could be transferred to new languages, for which there are no training data for segmentation or connective detection, such as the rest of the TEDm corpus. As for Task 3, our focus was on a unified, purely multilingual approach with parameter optimization, as well as dataset preprocessing for unification. Even though we faced problems on the Shared Task submission results, our approach showed promising results compared to language-specific models. In parenthesis is the number of epochs for which the model was trained. 'DiscoDisco' was the best-performing model of DISRPT 2021 [START_REF] Gessler | Dis-CoDisCo at the DISRPT2021 shared task: A system for discourse segmentation, classification, and connective detection[END_REF] and 'Diff.' is the comparison with our models. MEAN (all) provides the mean for the currently available datasets, while MEAN (2021) averages only DISRPT 2021's corpora.

Figure 1 :

 1 Figure 1: Example of an RST tree (Source: RST website -Common Case Analysis)

Table 3 :

 3 List of label conversions that we implemented (apart from lower-casing). Underlined labels were found exclusively in the surprise datasets.

	Original Label	Conversion
	alternation alternative bg-general causation cause-result conditional conjunction correction disjunction evidence exp-evidence expansion.genexpansion expansion expansion.alternative expansion.alternative background cause cause-effect condition expansion.conjunction expansion.correction expansion.disjunction explanation-evidence explanation-evidence expansion.level expansion.level-of-detail findings result goal purpose-goal joint-disjunction expansion.disjunction justify explanation-justify list joint-list motivation explanation-motivation otherwise adversative qap question_answer_pair qap.hypophora hypophora repetition restatement-repetition restatement expansion.restatement sequence joint-sequence temporal.synchrony temporal.synchronous textual-organization organization unconditional expansion.disjunction unless contrast

Table 4 :

 4 Examples of inputs with different directions.

Table 5 :

 5 The results that organizers provided for dis-

	course relation classification (Task 3), evaluating the test sets and reporting accuracy in %. 'DiscoDisco' was the best-performing model of DISRPT 2021 (Gessler et al., 2021) and 'Diff.' is the comparison with our mod-els. MEAN (all) provides the mean for the currently available datasets, while MEAN (2021) averages only DISRPT 2021's corpora.

Table 6 :

 6 Results on the dev set for discourse relation classification, before converting labels to their original form. In parenthesis is the number of epochs for which the model was trained.

	Corpus	B (1)	B (2) B (3)	B (4) B (5) B (6) A1-3 (4) A1 (3)
	deu.rst.pcc eng.rst.gum eng.rst.rstdt eus.rst.ert fas.rst.prstc nld.rst.nldt por.rst.cstn rus.rst.rrt spa.rst.rststb spa.rst.sctb zho.rst.gcdt zho.rst.sctb	25.31 29.46 26.97 31.54 31.54 29.88 48.03 51.66 52.46 53.31 53.76 53.69 46.33 49.85 44.97 47.25 48.49 47.62 41.53 43.65 43.16 44.95 42.18 44.46 53.31 50.1 52.1 51.3 49.5 51.9 43.5 40.79 46.53 41.09 46.53 42.9 54.8 59.51 55.15 60.38 60.56 58.12 57.41 58.84 60.04 60.04 58.77 59.61 51.44 54.31 55.61 62.4 60.05 61.62 47.87 62.77 56.38 58.51 62.77 67.02 53.98 55.57 56.86 57.55 57.75 58.05 40.43 50 46.81 46.81 42.55 50	29.05 55.79 51.02 45.44 52.91 45.92 62.48 61.16 60.31 59.57 58.85 47.87	30.71 56.67 50.28 47.07 52.71 45.32 61.43 60.91 59.01 64.89 59.34 46.81
	eng.sdrt.stac fra.sdrt.annodis	45.5 30.3	55.02 44.32 47.16 53.8	55.28 55.55 54.15 46.4 49.81 47.92	57.82 48.3	56.59 47.54
	* eng.dep.covdtb 40.39 42.81 35.22 36.64 36.18 42.93 eng.dep.scidtb 59.39 59.34 66.48 66.06 70.2 66.17 zho.dep.scidtb 47.33 61.57 62.99 59.79 60.85 62.63	43.56 70.56 66.19	43.1 71.03 65.48
	eng.pdtb.pdtb * eng.pdtb.tedm 10.67 14.04 67.32 67.44 71.39 70.85 70.43 69.41 19.1 15.73 15.17 14.04 ita.pdtb.luna 45.93 53.59 51.67 50.72 54.07 54.07 * por.pdtb.crpc 65.76 66.69 67.39 67.16 67.16 65.29 * por.pdtb.tedm 50 45.79 47.37 49.47 48.95 46.32 * tha.pdtb.tdtb 92.68 93.56 93.08 93.97 93.64 92.76 tur.pdtb.tdb 42.95 39.1 42.95 40.06 39.42 41.67 * tur.pdtb.tedm 42.72 42.72 44.13 42.25 41.31 46.48 zho.pdtb.cdtb 73.8 75.09 76.37 74.62 73.8 74.15	72.4 20.79 54.55 68.25 54.21 93.72 41.03 43.66 75.44	71.09 19.1 56.46 67.94 51.05 93.97 39.1 43.66 73.92
	MEAN		49.18	52.6	52.93 53.24	53.5	53.96	55.42	55.2
	Corpus	B (1)	B (2)	B (3)	B (4)	B (5) B (6) A1-3 (4) A1 (3) DiscoDisco	Diff.
	deu.rst.pcc eng.rst.gum eng.rst.rstdt eus.rst.ert fas.rst.prstc nld.rst.nldt por.rst.cstn rus.rst.rrt spa.rst.rststb spa.rst.sctb zho.rst.gcdt zho.rst.sctb	25.77 30.77 26.54 32.31 32.31 33.08 50.49 54.72 55.96 57.09 57.36 55.69 46.91 50.16 46.73 47.94 48.54 48.77 40.56 43.66 44.99 47.94 46.17 48.97 47.47 47.13 48.31 50.84 47.47 49.16 43.38 42.46 43.38 42.46 43.38 40.31 64.34 65.44 65.07 64.34 63.97 64.71 59.44 60.11 60.75 60.96 60.11 59.41 48.83 51.17 53.76 57.04 54.69 53.76 58.49 64.15 64.78 69.81 64.15 63.52 47.32 49.32 49.32 52.78 53.2 52.47 45.28 53.46 55.35 57.86 44.03 48.43	33.85 58.56 49.84 50.44 50.51 46.15 65.44 62.29 57.75 65.41 53.73 47.8	33.08 58.41 49.88 51.33 49.66 47.38 65.07 61.98 59.15 61.64 54.67 50.31	39.23 66.76 67.1 60.62 52.53 55.21 64.34 66.44 54.23 66.04 -64.15	-5.38 -8.2 -16.94 -9.29 -1.69 -7.83 1.1 -4.15 4.92 3.77 --6.29
	eng.sdrt.stac fra.sdrt.annodis	40.99 50.46 50.73 52.52 52.32 51.19 31.68 42.56 45.92 44 44.8 45.12	55.76 46.88	55.17 45.12	65.03 46.4	-9.27 0.48
	* eng.dep.covdtb 38.09 41.38 33.37 35.11 35.77 39.44 eng.dep.scidtb 59.45 61.38 67.29 67.09 69.65 68.18 zho.dep.scidtb 53.02 61.86 64.19 56.28 60.93 60.93	41.14 69.81 64.65	40.87 70.38 64.19	---	---
	eng.pdtb.pdtb * eng.pdtb.tedm ita.pdtb.luna * por.pdtb.crpc * por.pdtb.tedm * tha.pdtb.tdtb tur.pdtb.tdb * tur.pdtb.tedm zho.pdtb.cdtb	64.91 10.83 12.25 18.23 15.67 12.54 15.67 64.2 68.41 68.01 65.62 64.82 45.53 52.11 52.11 52.37 56.32 53.68 69.15 67.71 70.59 71.07 70.67 68.51 58.24 54.12 58.52 56.04 55.49 56.04 94.12 95.16 95.24 95.39 95.16 94.79 51.9 48.1 48.82 48.58 46.92 50.95 45.33 45.05 44.51 45.33 44.23 46.7 68.34 71.24 73.61 67.41 66.75 65.17	68.85 20.8 57.63 71.07 56.32 94.94 51.42 49.18 68.6	68.63 19.94 57.63 72.04 58.52 95.31 50.71 50.55 66.89	74.44 -----60.09 -86.49	-5.59 ------8.19 --12.88
	MEAN (2021) MEAN (all)	49.3 50.38 53.08 52.49 53.32 54.32 52.41 52.69 54.1 54.47 53.56 53.83	54.97 56.11	54.65 56.1	61.82 -	-7.17 -

Table 7 :

 7 Results on the test set for discourse relation classification, before converting labels to their original form.

Code at https://github.com/phimit/jiant/

Code at https://gitlab.irit.fr/melodi/andiamo/ discret_ST3

https://huggingface.co/bert-base-multilingua l-cased

Acknowledgements

This work is supported by the AnDiaMO project (ANR-21-CE23-0020). This work was partially supported by the ANR (ANR-19-PI3A-0004) through the AI Interdisciplinary Institute, ANITI, as a part of France's "Investing for the Future -PIA3" program. This work is also partially supported by the SLANT project (ANR-19-CE23-0022). Chloé Braud and Philippe Muller are part of the programme DesCartes and are also supported by the National Research Foundation, Prime Minister's Office, Singapore under its Campus for Research Excellence and Technological Enterprise (CREATE) programme. The work was also supported by the ANR grant SUMM-RE (ANR-20-CE23-0017).

A Additional results

The table 8 corresponds to the scores we obtain on the test sets, that can be compared to the ones obtained by the organizers when reproducing our system, as given in Table 2.


Nicolas Devatine

Philippe Muller

Chloé Braud

MELODI at SemEval-2023 Task 3: In-domain Pre-training for Low-resource Classification of News Articles

This paper describes our approach to Subtask 1 "News Genre Categorization" of SemEval-2023 Task 3 "Detecting the Category, the Framing, and the Persuasion Techniques in Online News in a Multi-lingual Setup", which aims to determine whether a given news article is an opinion piece, an objective report, or satirical. We fine-tuned the domain-specific language model POLITICS, which was pre-trained on a large-scale dataset of more than 3.6M English political news articles following ideologydriven pre-training objectives. In order to use it in the multilingual setup of the task, we added as a pre-processing step the translation of all documents into English. Our system ranked among the top systems overall in most language, and ranked 1st on the English dataset.

Introduction

The News Genre Categorization subtask of SemEval-2023 Task 3 [START_REF] Piskorski | Semeval-2023 task 3: Detecting the category, the framing, and the persuasion techniques in online news in a multi-lingual setup[END_REF]) is a classification task that aims to identify the genre of a news article by considering three classes: opinion, reporting, satire. News genre categorization is important because it helps readers to quickly identify the type of content they are reading. It also helps to ensure that readers are not misled by the content they are consuming. The organizers provided articles in six languages for the training phase (English, French, German, Italian, Polish, and Russian) and three surprise languages were revealed for the evaluation on the test sets (Spanish, Greek and Georgian). It is therefore a multilingual task that includes small datasets during training and zero-shot classification for surprise languages.

Our main strategy relies on the fine-tuning of POLITICS [START_REF] Liu | POLI-TICS: Pretraining with same-story article comparison for ideology prediction and stance detection[END_REF], a state-of-the-art language model for political ideology prediction and stance detection, pre-trained on more than 3.6M English news articles. Based on this, a wide variety of strategies were tested, including a sliding window to cover long documents, pooling methods, adapted loss functions, data splitting and hyperparameters tuning. Moreover, as POLITICS is monolingual, and to take advantage of the largescale pre-training in the multilingual setup, we propose as a pre-processing step to translate all articles from other languages into English. Other interesting strategies have also been considered and tested but have been less successful on the development set, including inherently multilingual models such as XLM-RoBERTa [START_REF] Conneau | Unsupervised cross-lingual representation learning at scale[END_REF] or longsequence transformers [START_REF] Beltagy | Longformer: The long-document transformer[END_REF].

We ranked 1st on the English test set with a Macro-F 1 score of 78.43 (+16.8 points above the second ranked system), but were less successful on the other languages with an average of 6th place (out of about 20 systems, depending on languages). We draw several observations from our participation in this task: -the dominance of large-scale pre-trained and domain-specific language models over more adapted but not massively pre-trained approaches; -the need to further develop multilingual language models and datasets rather than having to rely on low performing translation systems for complex tasks; -the importance of considering the whole text in the case of long documents, whereas most language models are limited to the first 512 subtokens.

Background

News genre categorization is a multi-class, singlelabel classification problem that aims to predict the type of content of a news article according to 3 classes [START_REF] Piskorski | Semeval-2023 task 3: Detecting the category, the framing, and the persuasion techniques in online news in a multi-lingual setup[END_REF]:

Opinion An article is an opinion piece when it expresses the writer's opinion on a topic. It is usually written in a persuasive style and is meant to influence the reader's opinion on the subject.

Reporting News reporting is the genre that focuses on providing factual information. It aims to inform readers about the world around them and to provide an objective account of events.

Satire Satire is a form of writing that uses exaggeration, absurdity and obscenity to mock and ridicule people, organizations or events. It is not meant to deceive, but to expose and criticize behavior that is wrong or immoral. Satirical pieces often mimic real articles, using irony to provide humor.

Datasets

The input data for this task are news articles in plain text format, with their title being on the first line. During the first stage, a training split and a development split were provided for each of the 6 known languages: English (en), French (fr), German (ge), Italian (it), Polish (po), and Russian (ru). The annotations were given only for the training sets at first, then also for the development sets when the test sets were released. For the evaluation on the test sets, 3 surprise languages were revealed which involves zero-shot classification (no train or dev sets): Spanish (es), Greek (gr) and Georgian (ka). Given the limited number of news articles available per language, this is a kind of few-shot learning task. This problem is also characterized by a strong class imbalance, especially for the satire genre which is represented only a few dozen times across the datasets. Dataset statistics are summarized in Table 1. The distributions of classes vary a lot between corpora, between train, development, and probably test sets, given the observed performance differences between dev and test. This means there was a (blind) domain-adaptation aspect to the task.

Related Work

Substantial efforts have been made to address the problem of media analysis on a multitude of aspects such as bias analysis [START_REF] Hamborg | Automated identification of media bias in news ar-ticles: an interdisciplinary literature review[END_REF], summarization [START_REF] Eyal | Question answering as an automatic evaluation metric for news article summarization[END_REF], text categorization [START_REF] Pérez-Rosas | Automatic detection of fake news[END_REF][START_REF] Karimi | Learning hierarchical discourse-level structure for fake news detection[END_REF] or propaganda techniques [START_REF] Da | SemEval-2020 task 11: Detection of propaganda techniques in news articles[END_REF]. Recently, [START_REF] Liu | POLI-TICS: Pretraining with same-story article comparison for ideology prediction and stance detection[END_REF] proposed POLI-TICS, a pre-trained language model over RoBERTa [START_REF] Liu | Roberta: A robustly optimized BERT pretraining approach[END_REF], fine-tuned on a large corpus of English news to address both political ideology prediction and stance detection. Their approach has proven to be the most efficient on a wide range of well known datasets for these tasks such as Hyperpartisan [START_REF] Kiesel | SemEval-2019 task 4: Hyperpartisan news detection[END_REF], Allsides1 [START_REF] Baly | We can detect your bias: Predicting the political ideology of news articles[END_REF] or BASIL [START_REF] Fan | In plain sight: Media bias through the lens of factual reporting[END_REF].

System Overview

Our main strategy is based on Liu et al. ( 2022)'s domain-specific pre-trained language model POLI-TICS which has recently demonstrated great success on a variety of news articles ideology and stance prediction datasets. It has several advantages for this task: (i) it was massively pre-trained on more than 3.6M English news articles, (ii) it relies on the comparison of articles on the same story written by media of different ideologies, (iii) it demonstrated its robustness in few-shot learning scenarios. Although predicting political ideology is not the same as detecting the genre of an article, our assumption is that these two notions overlap as in both cases there is a linguistic shift in the way information is conveyed. We can also observe similarities between the genre reporting and articles from the Center political class, or between the genre opinion and Left or Right leaning articles.

Figure 1: Distribution of the number of (POLITICS) tokens per article for the combination of all datasets.

Data Translation

POLITICS was trained solely on articles from English-language media, whereas in the multilingual configuration proposed for this task, we have to classify articles in 9 languages, 3 of which were unknown during training. Because of this strong constraint and the impossibility of re-training POL-ITICS in a multilingual configuration, we decided to resort to translation into English. By translating all texts into English, we end up with an augmented English training set that can be used with POLI-TICS. This solution represents an additional cost due to the pre-processing step, and a loss of information that depends on the quality of the translation system. Several translation models were compared based on performance, language coverage, and accessibility, including GoogleTranslate,2 DeepL3 and OPUS-MT [START_REF] Tiedemann | OPUS-MT -Building open translation services for the World[END_REF], resulting in choosing GoogleTranslate as the most appropriate one. DeepL was the best performing system but had accessibility limitations due to its pricing for handling large amounts of data, we had to fall back on GoogleTranslate which was the second best performing and freely available system.

Fine-tuning

For the classification model, we fine-tuned POLI-TICS on the English dataset augmented with translations. most language models, is limited with respect to the size of the input text, here at most 512 subtokens. News articles are on average much longer (Figure 1), thus truncating the first 512 subtokens would result in a significant loss of information. Rather than truncating the text, we use a sliding window of size 512 with an overlap of size 64, and aggregated the information by mean pooling. That is, we encode the first 512 tokens of the document, then the next 512 with an overlap of 64, and so on, until we reach the end of the document, then we calculate the mean of all these representations to obtain the final representation of the document.

Alternative Approaches

Other approaches of interest for this task were also considered, but proved to be less successful during the training phase on the development split. In particular, on English, POLITICS showed much higher performance than the other models considered and was on average better on the other languages. Thus, we have favored this model for the evaluation although a posteriori we can see that it is less efficient in certain cases (e.g. on surprise languages or on French/Russian, Table 3). [START_REF] Conneau | Unsupervised cross-lingual representation learning at scale[END_REF] The multilingual version of RoBERTa [START_REF] Liu | Roberta: A robustly optimized BERT pretraining approach[END_REF], a state-of-the-art model in natural language processing, pre-trained on 2.5TB of CommonCrawl data containing 100 languages and including the 9 ones covered by this task. Similar to POLITICS, we used a sliding window to consider the entire Table 3: Macro-F 1 scores on the test sets for each language and different approaches. * indicates surprise languages (zero-shot). "512" means that only the first 512 subtokens of the inputs (no sliding window) were used to train the model. All results, except for the main strategy, were obtained when the submission platform reopened after the official submission deadline. We added the rank of the main system with respect to that score, according to the leaderboard published by the organisers. Note that the baseline and XLM-RoBERTa are the only models that have been trained on the original data (not translated).

XLM-RoBERTa

article.

Longformer [START_REF] Beltagy | Longformer: The long-document transformer[END_REF] Transformerbased model designed to process longer sequences, up to 4096 tokens, making it suitable for news article classification, and pre-trained on a variety of large-scale generic datasets, including Wikipedia, BooksCorpus, and CommonCrawl. No sliding window was introduced with this model, as the input length covers the vast majority of texts, cf.

Experimental Setup

First, the train, dev and test split articles for each language are translated using Google Translate. Next, we aggregate the train and dev splits for each language to create an augmented English dataset containing 1234 articles in the training split and 358 in the development split, on which we train a single English model. We built on [START_REF] Liu | POLI-TICS: Pretraining with same-story article comparison for ideology prediction and stance detection[END_REF]'s implementation, 4 and the HuggingFace transformers library [START_REF] Wolf | Transformers: State-of-the-art natural language processing[END_REF]. Hyperparameters were set using grid search on the augmented development split for each of the models considered (Table 2). The hyperparameters for POLITICS and XLM-RoBERTa were found to be the same. We also conducted a control experiment on the sliding window to assess its effectiveness by evaluating the same model trained only on the first 512 tokens of the articles. Control experiments and alternative approaches (see table 3 4 https://github.com/launchnlp/POLITICS were performed on the same set of hyperparameters. Since there is a strong class imbalance in the training set, we weighted the cross entropy on the class distribution, which turned out to give us better performance.

Regarding alternative approaches, we fine-tuned xlm-roberta-large5 using a sliding window on the same set of hyperparameters as POLI-TICS (Table 2). Longformer was trained using longformer-base-40966 and the hyperparameters given in Table 2.

The official evaluation measure used is Macro-F 1 . Micro-F 1 is also given as a secondary evaluation measure on the official leaderboard.

Results

Table 3 summarizes the results obtained by our main strategy, the control experiments, the baseline proposed by the task organizers and the alternative approaches. Our main strategy (POLITICS) obtains the best results for 3 of the 9 languages, with a special distinction for English on which it particularly stands out (+9 points than the second best approach we tested). This shows the benefits of large scale in-domain pre-training on English news articles, but also the limitations of translation. For French, the score is surprisingly low, which was not as pronounced in our experiments on the development split. From the control experiment, we can confirm the interest of the sliding window rather than just truncating the article, with important gains on most training languages. Interestingly, for the surprise languages, removing the sliding window leads to much better results, which shows that in a zero-shot context, introducing too much unseen language-specific information confuses the model. Regarding the alternative approaches, the results obtained by Longformer confirm the previous observations on the importance of considering the whole article, with results close to or even better than POLITICS outside English and without any in-domain pre-training. Furthermore, the XLM-RoBERTa multilingual model performs well against POLITICS without the need for translation, but the lack of in-domain pre-training results in a significant performance drop, especially for English.

These results should be taken with a grain of salt for the following reasons: test sets are small (30-70 instances) hence the huge variance between models and across languages. This problem is compounded by the chosen evaluation : Macro-F 1 scores equalize the contributions of all classes to the final scores, meaning that one instance from the minority class classified one way or the other could swing the evaluation disproportionately. It would probably be informative to evaluate accuracy, and per class metrics, but gold labels were not provided for the test sets. This also makes it hard to estimate the distribution shift between train, development and test sets, although it is already apparent there are large differences between train and dev sets.

Conclusion

We propose to take advantage of in-domain pretraining for detecting the genre of news articles. We fine-tuned the large-scale English language model POLITICS using sliding windows on the multilingual corpus translated into English. Our various experiments have shown the effectiveness of indomain pre-training as well as the importance of approaches adapted to the processing of long documents. We ranked 1st on the English dataset while being among the top systems overall.

Table 1 :

 1 Number of documents for each dataset.

		#Train	#Dev.	#Test. #Total
	en	433 (382;41;10)	83 (20;54;9)	54	570
	fr	157 (103;43;11)	54 (35;15;4)	50	261
	ge	132 (86;27;19)	45 (29;9;7)	50	227
	it	226 (174;44;8)	77 (59;15;3)	61	364
	po	144 (104;25;15)	50 (35;9;6)	47	241
	ru	142 (93;41;8)	49 (32;14;3)	72	263
	es	-	-	30	30
	gr	-	-	64	64
	ka	-	-	29	29
	#Total	1234 (942;221;71)	358 (210;116;32)	457	2049

The class distribution is given in parentheses (#opinion;#reporting;#satire).

Table 2 :

 2 Hyperparameters used to fine-tune POLITICS and XLM-RoBERTa and Longformer. For Longformer, the values that differ are in parentheses and there is no sliding window.

	Hyperparameter
	#Epochs	10
	Learning Rate Batch size	1e -5 (2e -5) 4
	Loss Function	Cross Entropy
	Optimizer	AdamW
	Weight Decay	0.001
	Classifier #Layers	2
	Classifier Hidden Dim. 768
	Classifier Dropout	0.2 (0.1)
	Sliding window size	512
	Sliding window overlap 64

It works by adding a 2-layer perceptron on top of the standard [CLS] classification token representation to predict the distribution over class labels. POLITICS is based on RoBERTa and, like

https://www.allsides.com

https://translate.google.com

https://www.deepl.com/

https://huggingface.co/xlm-roberta-large

https://huggingface.co/allenai/ longformer-base-4096

Acknowledgements

Nicolas Devatine's work is supported by the SLANT project (ANR-19-CE23-0022). This work was partially supported by the ANR (ANR-19-PI3A-0004) through the AI Interdisciplinary Institute, ANITI, as a part of France's "Investing for the Future -PIA3" program. This work is also partially supported by the AnDiaMO project (ANR-21-CE23-0020). Chloé Braud and Philippe Muller are part of the programme DesCartes and are also supported by the National Research Foundation, Prime Minister's Office, Singapore under its Campus for Research Excellence and Technological Enterprise (CREATE) programme.


Isabel Pellicer

Fernando Condal Domingo

Fernando Condal

Microplastic Pollution in the Coast of Tarragona, Spain: A Western Mediterranean Study

des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.


Éric Thiébaut

Michel Tallon

Isabelle Tallon-Bosc

Bernard Gelly

Richard Douet

Maud Langlois

Gil Moretto

Closing the loop as an inverse problem: the real-time control of Themis adaptive optics

Keywords: solar adaptive optics, inverse problems framework, real-time control, iterative methods, sufficient statistic, pseudo-open loop

We have taken advantage of the implementation of an adaptive optics system on the Themis solar telescope to implement innovative strategies based on an inverse problem formulation for the control loop. Such an approach encompassing the whole system implies the estimation of the pixel variances of the Shack-Hartmann wavefront sensor, a novel real-time method to extract the wavefront slopes as well as their associated noise covariance, and the computation of pseudo-open loop data. The optimal commands are computed by iteratively solving a regularized inverse problem with spatio-temporal constraints including Kolmogorov statistics. The latency of the dedicated real-time control software with conventional CPU is shorter than 300 µs from the acquisition of the raw 400 × 400 pixel wavefront sensor image to the sending of the commands.

OUTLINE

The Themis solar telescope has been equipped with an adaptive optics (AO) system comprising a 92-actuator Alpao deformable mirror (DM) and a 10×10 Shack-Hartmann wavefront sensor (SH-WFS) operated at 1 kHz (see Figure 1). Developing the real-time control (RTC) of this AO system was the opportunity to implement innovative strategies studied in our team for a decade [START_REF] Thiébaut | Fast minimum variance wavefront reconstruction for extremely large telescopes[END_REF][START_REF] Béchet | Comparison of minimum-norm maximum likelihood and maximum a posteriori wavefront reconstructions for large adaptive optics systems[END_REF][START_REF] Béchet | Optimization of adaptive optics correction during observations: Algorithms and system parameters identification in closed-loop[END_REF][START_REF] Thiébaut | Innovative realtime processing for solar adaptive optics[END_REF] and all based on an inverse problem formulation of the estimation of the commands applied to the DM. The inverse problem approach is known to yield excellent estimators which optimally combine all available information but is usually not fully used for real-time systems because of the computational burden and of the amount of required information (e.g., all covariance matrices must be provided). Since sufficient statistics are required at all processing stages, we developed specific detector calibration and pre-processing procedures to compensate for the non-uniformity of the WFS detector response and optical throughput and to yield estimated pixel variances. [START_REF] Tallon | Solar wavefront sensing at themis with self-calibrated reference image and estimation of the noise covariance[END_REF] We also developed a novel method to extract, in real-time, the wavefront slopes and the covariance matrix of their noise from the images of the WFS despite the very low contrast and the temporal evolution of the structures at the Sun's surface. [START_REF] Tallon | Solar wavefront sensing at themis with self-calibrated reference image and estimation of the noise covariance[END_REF] For the control, the chosen approach leads to work with pseudo-open loop data, which requires a good model of the so-called interaction matrix of the system. This matrix is calibrated by measuring the effects of sending stochastic commands (Section 3). The optimal commands are eventually estimated by iteratively solving a regularized inverse problem (Section 2). Various spatio-temporal constraints are implemented including a priori Kolmogorov covariance for the wavefront. The dedicated RTC is implemented on a 4-core conventional CPU running under Linux and is able to close the loop even in harsh conditions with a latency shorter than 300 µs from the acquisition of the raw 400 × 400 pixel WFS image to the sending of the commands (Section 4).

OPTIMAL CONTROL

An adaptive optics (AO) system consists in a wavefront sensor (WFS), a deformable mirror (DM), and real time control (RTC) hardware and software to compute and send the commands for the actuators of the DM given the measurements of the WFS. In this section, we aim at deriving optimal control commands for the AO system under clearly specified assumptions.

Further author information: E-mail: eric.thiebaut@univ-lyon1.fr

Model of the Wavefront Sensor Data

At each time frame t, the wavefront sensor delivers data d t ∈ R n dat whose linearized model writes:

d t = S • (w t + M • a t ) + z t (1)
where S ∈ R n dat ×nwav is the linear response matrix of the sensor, w t ∈ R nwav is the wavefront during the exposure of frame t, M ∈ R nwav×nact is the linear response matrix of the deformable mirror, the so-called influence matrix, a t ∈ R nact is the vector of actuators commands during this frame, and z t ∈ R n dat accounts the contribution of the noise. Here n dat is the number of measurements per frame, n act is the number of actuators, and n wav is the size of the wavefront w t which can be arbitrarily large even though it is finite in practice. For a Shack-Hartmann wavefront sensor, the measurements are the wavefront slopes for each sub-pupil, hence n dat = 2 n sub with n sub the number of sub-pupils.

In what follows and for the sake of simplicity, we assume that the mirror linear response M and the wavefront sensor linear response S are stable in time. This can be easily relaxed by adding a subscript t for these matrices.

Optimal Commands

At any time frame t, the best commands are those that will minimize the residual wavefront aberrations w t+δt + M • a t+δt at frame t + δt where δt > 0 is the time delay (in number of frames) for the wavefront sensor to effectively see the effects of given actuators commands. For example, to maximize the Strehl we would like to apply the following commands:

a t+δt = arg min a ∥w t+δt + M • a∥ 2 θ t ( 2
)
where θ t represents known information at time t and ⟨x | θ⟩ denotes the conditional expectation of x knowing θ. In other words, we want to reduce as much as possible the residuals on the mean at time t + δt by exploiting all available information at time t. Thanks to taking the expectation of the residual errors, only the statistics * , not the actual realization, of the future wavefront w t+δt need to be known and the above problem has a closed form solution:

a t+δt = -M † • w t+δt|t , ( 3
)
where

M † = M ⊤ • M -1
• M ⊤ is the pseudo inverse of M , the linear response of the deformable mirror, and w t+δt|t = w t+δt θ t is the expectation of the wavefront at time t + δt knowing information available at time t. This apparently simple solution turns out to be quite challenging to compute in a real-time system. We develop in what follows the equations leading to w t+δt|t with as few assumptions as possible to remain general.

Known Information and Pseudo Open-Loop Data

At every time frame t, new information is brought by the wavefront sensor data d t and by the corresponding commands a t . Hence θ t = θ t-1 ∪ {d t , a t } expresses the information gain between frames t -1 and t and is to be used with Eq. (1). It is however equivalent and simpler to consider the pseudo open-loop 6 (POL) data instead:

y t = d t -G • a t = S • w t + z t ( 4
)
where G = S • M is the so-called interaction matrix. Then, the updating rule for the available information is just:

θ t = θ t-1 ∪ {y t }. (5)
Thanks to this change of variables, the commands will not explicitly appear in the equations leading to w t+δt|t . * in fact, just the first and second moments

Updating Rules

Equation (3) readily shows that obtaining the best commands is a matter of being able to predict the expected shape of the wavefront in a near future. The wavefronts at different times certainly come into play in the problem and, to be as general as possible, we consider the spatio-temporal wavefront x which is the concatenation of the wavefronts in all (future, current, and past) temporal frames:

x = • • • w ⊤ t-2 w ⊤ t-1 w ⊤ t w ⊤ t+1 w ⊤ t+2 • • • ⊤ . ( 6
)
From Eq. ( 4), the spatio-temporal wavefront x is related to the pseudo open-loop data y t in the t-th frame by:

y t = H t • x + z t , (7)
where H t , the extended linear model matrix of the data, has the following block structure with blocks of size n dat × n wav :

H t = • • • 0 0 S 0 0 • • • . • • • t -2 t -1 t t + 1 t + 2 • • • (8)
At arrival of data frame t, the maximum a posteriori (MAP) estimator of x can be expressed as:

x |t def = arg
Cov(y t | x) = Cov(H t • x + z t | x) (from Eq. (7)) = H t • Cov(x | x) • H ⊤ t + Cov(z t | x) (x and z t mutually independent) = Cov(z t ) (idem and since Cov(x | x) = 0). (14)
Assuming Gaussian statistics for all variables, then yields:

x |t = arg min x ∥y t -H t • x∥ 2 Cov(zt) -1 + x -x |t-1 2 Cov(x | θt-1) -1 (15)
where

x |t-1 def = ⟨x | θ t-1 ⟩ and Cov(x | θ t-1
) are the expectation and the covariance of x knowing θ t-1 and where Cov(z t ) is the covariance of the noise. This optimization problem is quadratic in x and has a closed form solution:

x |t = H ⊤ t • Cov(z t ) -1 • H t + Cov(x | θ t-1 ) -1 -1 • H ⊤ t • Cov(z t ) -1 • y t + Cov(x | θ t-1 ) -1 • x |t-1 = x |t-1 + H ⊤ t • Cov(z t ) -1 • H t + Cov(x | θ t-1 ) -1 -1 • H ⊤ t • Cov(z t ) -1 • y t -H t • x |t-1 (16) † note that ⟨zt | x⟩ = 0 =⇒ ⟨zt⟩ = 0
by simple algebra. Now, using a well known matrix identity, 1, 7 we may write:

x |t = x |t-1 + Cov(x | θ t-1 ) • H ⊤ t • Cov(z t ) + H t • Cov(x | θ t-1 ) • H ⊤ t -1 • y t -H t • x |t-1 . ( 17
)
Owing to the particular structure of x and of H t , see Eqs. ( 6) and ( 8), a few simplifications can be done:

H t • x |t-1 = S • w t|t-1 , ( 18
)
H t • Cov(x | θ t-1 ) • H ⊤ t = S • Cov(w t | θ t-1 ) • S ⊤ , ( 19
) with w t|t-1 def = ⟨w t | θ t-1 ⟩ and Cov(w t | θ t-1
) the expectation and covariance of w t knowing θ t-1 . Introducing:

Q t|t-1 = • • • 0 0 Cov(w t | θ t-1 ) -1 0 0 • • • , • • • t -2 t -1 t t + 1 t + 2 • • • (20) it is possible to write H t = S • Cov(w t | θ t-1 ) • Q t|t-1
and putting all together, we obtain:

x |t = x |t-1 + Cov(x | θ t-1 ) • Q ⊤ t|t-1 • Cov(w t | θ t-1 ) • S ⊤ • Cov(z t ) + S • Cov(w t | θ t-1 ) • S ⊤ -1 • y t -S • w t|t-1 = x |t-1 + Cov(x | θ t-1 ) • Q ⊤ t|t-1 • w t|t -w t|t-1 (21)
where w t|t is the MAP estimator of w t knowing θ t . This can be proven using the same rules as before:

w t|t def = arg max wt Pr w t θ t = arg max wt Pr w t , y t θ t-1 = arg min wt ∥y t -S • w t ∥ 2 Cov(zt) -1 + w t -w t|t-1 2 Cov(wt | θt-1) -1 = S ⊤ • Cov(z t ) -1 • S + Cov(w t | θ t-1 ) -1 -1 • S ⊤ • Cov(z t ) -1 • y t + Cov(w t | θ t-1 ) -1 • w t|t-1 = w t|t-1 + S ⊤ • Cov(z t ) -1 • S + Cov(w t | θ t-1 ) -1 -1 • S ⊤ • Cov(z t ) -1 • y t -S • w t|t-1 = w t|t-1 + Cov(w t | θ t-1 ) • S ⊤ • Cov(z t ) + S • Cov(w t | θ t-1 ) • S ⊤ -1 • y t -S • w t|t-1 . ■ (22)
The MAP estimator w t|t linearly depends on the noise and the wavefront which are Gaussian variables. It follows that w t|t is also Gaussian, moreover the MAP estimator is equal to the posterior mean and the associated conditional covariance Cov(w t | θ t ) has a closed form expression:

7 w t|t = ⟨w t | θ t ⟩ = w t|t , (23) Cov(w t | θ t ) = S ⊤ • Cov(z t ) -1 • S + Cov(w t | θ t-1 ) -1 -1 . ( 24
)
The MAP estimator of the wavefront sequence is thus also equal to the posterior mean, that is

x |t = x |t .
Finally, we have demonstrated the following recurrences (or updating rules):

w t|t = w t|t-1 + S ⊤ • Cov(z t ) -1 • S + Cov(w t | θ t-1 ) -1 -1 • S ⊤ • Cov(z t ) -1 • y t -S • w t|t-1 , (25) Cov(w t | θ t ) -1 = Cov(w t | θ t-1 ) -1 + S ⊤ • Cov(z t ) -1 • S, ( 26
)
x |t = x |t-1 + A t|t-1 • w t|t -w t|t-1 , ( 27
)
where

A t|t-1 def = Cov(x | θ t-1 ) • Q ⊤ t|t-1
has the following block structure:

A t|t-1 =             . . . B t-2,t|t-1 B t-1,t|t-1 I B t+1,t|t-1 B t+2,t|t-1 . . .             with B t ′ ,t|t-1 def = Cov(w t ′ , w t | θ t-1 ) • Cov(w t | θ t-1 ) -1 , ( 28
)
where:

Cov(w t ′ , w t | θ t-1 ) def = ⟨(w t ′ -⟨w t ′ | θ t-1 ⟩) • (w t -⟨w t | θ t-1 ⟩) ⊤ | θ t-1 ⟩. (29)
The matrix B t ′ ,t|t-1 encodes the cross-temporal correlation between wavefronts at times t ′ and t knowing information up to time t -1. The updating rules in Eqs. ( 25), ( 26) and ( 27) assume that the variables (wavefront w t and noise z t for any frame t) are Gaussian, that the noise is centered, that the noise and the wavefront are independent, and that the noise terms in different frames are mutually independent.

To close the recurrence, the updating of the wavefront covariance leading to Cov(w t+1 | θ t ) is required. This can be obtained from the updating of the statistics of x resulting from the updating of x in Eq. ( 27).

Remark that while the first rule in Eq. ( 25) is only focused on the updating of the t-th wavefront, Eq. ( 26) shows that the a posteriori covariance of the estimated t-th wavefront is reduced, hence that information has been gained, and last rule in Eq. ( 27) propagates this gain in information to all other frames. In particular, Eq. ( 27) yields the wavefront estimate w t+1|t that will be needed in the next round, that is for frame t + 1, of Eqs. ( 25) and ( 27). Hence Eqs. ( 25), ( 26) and ( 27), implement a complete recurrence for updating complete statistics of the unknowns as data arrive. In fact these equations can be seen as an instance of the well known Kalman filter [START_REF] Kalman | A new approach to linear filtering and prediction problems[END_REF] for the case of an AO system. The variables x and the tall matrix A t|t-1 are the analogous of the so-called state variables and state transition matrix of the Kalman filter.

Taking the t + δt-th wavefront in x |t yields an updating rule for w t+δt|t = w t+δt|t the predicted wavefront required in Eq. ( 3):

w t+δt|t = w t+δt|t-1 + B t+δt,t|t-1 • (w t|t -w t|t-1 ) (30)
which require to solve the MAP problem in Eq. ( 25). How this is implemented in the actual RTC of the Themis AO system is detailed in the next section.

There are several issues for applying the proposed recursion:

(i) The updating rules do not specify how to initiate the recurrence.

(ii) The updating rules do not specify how to derive the cross-temporal covariances Cov(w t ′ , w t | θ t-1 ). These terms may be learned from the available data but this certainly requires some assumptions on their structure.

(iii) In practice, we must work with a truncated sequence, not the virtually infinite sequence x considered so far.

Owing to the recursive structure of the equations, x shall be implemented as a sliding temporal window of given length.

(iv) All necessary computations must be carried out faster than the rate of the AO system loop. Typically in less than 1 ms at 1 kHz for the Themis AO system.

Comparison with Conventional AO Systems

In a simple conventional AO system, the new commands are assumed given by:

a t+δt = a t -γ G ‡ • d t ( 31
)
with a t the commands at time t, G ‡ ≈ G † the WFS data to DM commands matrix which is an approximation of

G † = G ⊤ • G -1
• G ⊤ the pseudo inverse of the interaction matrix G, and γ ∈ (0, 1] the control loop gain.

To achieve a certain level of regularization, G ‡ is usually a truncated SVD version of G † .

Dropping the prediction in the optimal control and directly expressing the wavefront in the basis of the influence functions of the deformable mirror amounts to using the commands a t+δt = -w t|t with w t|t the MAP wavefront estimator given in Eq. (25). Then the commands are given by:

a t+δt = a t -S ⊤ • Cov(z t ) -1 • S + Cov(w t | θ t-1 ) -1 -1 • S ⊤ • Cov(z t ) -1 • y t + S • a t = a t -G ⊤ • Cov(z t ) -1 • G + Cov(w t | θ t-1 ) -1 -1 • G ⊤ • Cov(z t ) -1 • d t , ( 32
)
since S = G in that case and thus

y t + S • a t = y t + G • a t-1 = d t .
Even though:

Note the analogies between Eqs. (31) and (32). The two approaches are equivalent provided:

γ G ‡ ≈ G ⊤ • Cov(z t ) -1 • G + Cov(w t | θ t-1 ) -1 -1 • G ⊤ • Cov(z t ) -1 (33)
holds to a sufficient precision.

The Commands in the Current Themis AO System

In the first version of the Themis AO system, we chose to simplify the computations so that they remain compatible with a real-time system running on a conventional CPU and so that they can be controlled with a very small number of parameters (not all the statistics). To that end, when solving the MAP problem in Eq. ( 25), we approximate the wavefront regularization by:

w t -w t|t-1 2 Cov(wt | θt-1) -1 ≈ µ t ∥w t ∥ 2 C -1 + ρ t w t -w t-1|t-1 2 ( 34
)
where C is the covariance matrix for a Kolmogorov wavefront with a given diameter over Fried's parameter D/r 0 ratio. The first term in the above penalty imposes spatial regularization of the wavefront, the hyper-parameter µ t ∝ (D/r 0 ) -5/3 has to be tuned according to the strength of the turbulence. The second regularization term imposes the temporal continuity of the wavefront. The estimated MAP wavefront at time t is then given by:

w t|t = arg min wt ∥y t -S • w t ∥ 2 Cov(zt) -1 + µ t ∥w t ∥ 2 C -1 + ρ t w t -w t-1|t-1 2 = S ⊤ • Cov(z t ) -1 • S + µ t C -1 + ρ t I -1 • S ⊤ • Cov(z t ) -1 • y t + ρ t w t-1|t-1 , (35)
where the pseudo open-loop data y t are given by Eq. ( 4).

Unrelated to our simplifying assumptions, an important consequence of the MAP approach is that while the commands linearly depend on the wavefront sensor data, the corresponding matrix:

G ⊤ • Cov(z t ) -1 • G + µ t W + ρ t I -1 • G ⊤ • Cov(z t ) -1 (36)
cannot be computed once for all since it depends on the time. In other words the control law changes with time which is an important feature to cope with variable observing conditions.

Measurements from different sub-pupils can be considered as independent so the noise covariance matrix Cov(z t ) has a block-diagonal structure with 2×2 blocks ‡ . Each block accounts for the variances of the horizontal and vertical slopes and for their covariance. The measurements d t and their covariances are estimated by the real-time data processing software of the wavefront sensor (see proceedings by Tallon et al. in this conference [START_REF] Tallon | Solar wavefront sensing at themis with self-calibrated reference image and estimation of the noise covariance[END_REF] ). Owing to its block diagonal structure, the noise covariance matrix Cov(z t ) is very sparse. The linear response matrix S of a Shack-Hartmann wavefront sensor is also very sparse. With such sparse matrices, the solution w t|t can be computed iteratively by means of the FRiM method 1 taking C = K • K ⊤ with K the fractal operator of FRiM.

To further speedup computations, we consider working directly with the wavefronts represented on the basis of the deformable mirror influence functions and with no prediction. This amounts to taking M = I and δt = 0 in Eq. ( 3) and to taking S = G in all other equations. The control commands are then given by:

a t+δt = arg min a ∥y t + G • a∥ 2 Cov(zt) -1 + µ t ∥a∥ 2 W + ρ t ∥a -a t ∥ 2 = G ⊤ • Cov(z t ) -1 • G + µ t W + ρ t I -1 • ρ t a t -G ⊤ • Cov(z t ) -1 • y t , ( 37
)
where the pseudo open-loop data y t are given by Eq. ( 4) and where W is the inverse of the a priori spatial covariance of the commands. The a priori precision matrix W can be based on Kolmogorov statistics but for the actuators. ‡ provided horizontal and vertical measured slopes are contiguous in the data vector dt

To compare our commands with the ones assumed in simple conventional AO systems, and given in Eq. ( 31), and to the ones in Eq. (32), our control commands can be put in the form of an updating of the previous commands involving the wavefront sensor data d t instead of the POL data y t :

a t+δt = a t -G ⊤ • Cov(z t ) -1 • G + µ t W + ρ t I -1 • G ⊤ • Cov(z t ) -1 • d t -µ t G ⊤ • Cov(z t ) -1 • G + µ t W + ρ t I -1 • W • a t . ( 38
)

CALIBRATIONS

The optimal control of an AO system relies on the assumed models of the wavefront sensor, of the deformable mirror, and of the statistics of the wavefront and of the noise. The components of the model of the system have to be carefully calibrated. We exploit the fact that the AO system includes a measuring device (the wavefront sensor) and means to modify the system (the deformable mirror) to perform these calibrations with the AO system itself.

Detector Calibration and Image Pre-Processing

The calibration of the detector of the wavefront sensor is fully described in the proceedings by Tallon et al. in this conference. [START_REF] Tallon | Solar wavefront sensing at themis with self-calibrated reference image and estimation of the noise covariance[END_REF] In a nutshell, this calibration provides 4 pre-processing parameters per pixel. Two of these parameters implement an affine pixel-wise correction to compensate for the non-uniform bias and overall sensitivity of the detector. The two other parameters are needed to estimate the non-uniform precision (reciprocal of the variance) of the pixels in each pre-processed image.

In the RTC of the Themis AO system (see Section 4), a camera server is continuously acquiring raw images from the wavefront sensor camera. As soon as a new raw image is available, the camera server applies the pre-processing and delivers the pre-processed image and the corresponding pixel precisions to other processes via shared memory.

Live Calibration of the Interaction Matrix

The interaction matrix G = S • M encodes the linear relationship between the actuator commands and the wavefront sensor data. In order to calibrate this matrix, we register data frames of the wavefront sensor with perturbed commands and given by:

d t = S • (w t + M • (a t + ε u t )) + z t ( 39
)
with u t ∈ R nact a known vector of random perturbation and ε > 0 the strength of the perturbation. The random perturbations are centered, ⟨u t ⟩ = 0, mutually independent and identically distributed (i.i.d.) with a known covariance U = Cov(u t ) = ⟨u t • u ⊤ t ⟩. We then form the following mean cross-product:

V = 1 n ε n t=1 d t • u ⊤ t ( 40
)
whose expectation is given by:

V = 1 n ε n t=1 S • ⟨w t • u ⊤ t ⟩ -M • ⟨a t • u ⊤ t ⟩ + ε M • ⟨u t • u ⊤ t ⟩ + ⟨z t • u ⊤ t ⟩ = 1 n ε n t=1 S • ⟨w t ⟩ • ⟨u ⊤ t ⟩ -M • ⟨a t ⟩ • ⟨u t ⟩ ⊤ + ε M • ⟨u t • u ⊤ t ⟩ + ⟨z t ⟩ • ⟨u t ⟩ ⊤ = 1 n S • M • n t=1 ⟨u t • u ⊤ t ⟩ = G • U (41)
where the first right-and-side (RHS) comes from Eq. (39) and from the linearity of the expectation, the second RHS follows from the independence of u t with all other variables, and the third RHS from the fact that the perturbations are centered, i.e. ⟨u t ⟩ = 0, and i.i.d., thus ⟨u t • u ⊤ t ⟩ = Cov(u t ) = U for all t, and finally using G = S • M .

An unbiased estimator of the influence matrix is thus:

G = V • U -1 (42)
with U the exact covariance matrix of the perturbations. For the sake of simplicity, the perturbations u t may be chosen so that their covariance matrix is the identity matrix: U = I.

An advantage of this calibration method is that it can be carried out while the AO system is running. Indeed, thanks to the fact that the perturbations are centered and independent to any other variables, the influences of the turbulent wavefront w t , of the actuators commands a t , and of the measurement noise z t cancel on average in V . The only restriction is to choose the strength ε of the perturbation not too high to not destroy the correction § and yet high enough to have a measurable incidence in the wavefront sensor data d t .

Since the perturbations are known, it is possible to compute the conditional expectation of V :

V {u t } t∈1:n = G • U + 1 n ε n t=1 [S • (⟨w t ⟩ -M • ⟨a t ⟩) + ⟨z t ⟩] • u ⊤ t = G • U (43)
provided S • (⟨w t ⟩ -M • ⟨a t ⟩) + ⟨z t ⟩ = 0 holds and with:

U = 1 n n t=1 u t • u ⊤ t . (44)
This yields another estimator (which is unbiased conditionally to the knowledge of the perturbations) for the interaction matrix G:

G = V • U -1 . ( 45
)
From preliminary tests, it seems that Eq. (45) provides a better estimator than Eq. (42).

In practice, we use a binomial law for the perturbations:

[u t ] i = +1 with 50% probability -1 else (46)
and take ε equal to a few percents of the dynamics of the actuators. This choice yields the covariance matrix U = I. The interaction matrix G is mostly sparse because the extension of the influence functions of the deformable mirror are limited. To get rid of the noise in the entries of G of small amplitude, we only keep the most significant coefficients of each column of the interaction matrix (that is for each actuator). For that, we apply a hard thresholding on the coefficients of G as follows:

G sparse i,j = G i,j if G 2 i h (i),j + G 2 iv(i),j > max τ abs , τ rel max j ′ G 2 i h (i),j ′ + G 2 iv(i),j ′ 0 else (47)
to where i h (i) and i v (i) yield the index of the wavefront measurement corresponding to the slopes respectively along the horizontal and vertical axes for the i-th measurement and where τ abs ≥ 0 and τ rel ≥ 0 are chosen absolute and relative threshold levels. Assuming 1-based indexing and that the 2 slopes measured for a given sub-image are contiguous in the data, then i h (i) = 2 ⌊(i -1)/2⌋ + 1 and i v (i) = i h (i) + 1.

REAL-TIME CONTROL

The real time control (RTC) software of the Themis AO system runs on a Linux workstation with a 4 core i7-4790K CPU at 4.2 GHz. The Linux kernel is a low-latency version. The RTC of the Themis AO system consists in multiple processes which collaborate to execute the various tasks (see Fig. 2). The time critical processes (wavefront sensor camera sever, wavefront sensor calculator, control command calculator, and deformable mirror server) run with a real-time priority to avoid jitters and latency in their execution. Other non-critical processes (visualization, telemetry collector, statistics calculator, etc.) run with normal priorities. All theses processes use a common framework called TAO (which is the acronym for a Toolkit for Adaptive Optics systems) which is a set of libraries written in C and bindings for different languages (currently C, Julia, [START_REF] Bezanson | Julia: A fresh approach to numerical computing[END_REF] Yorick, and Unix shell). TAO is meant to be portable and flexible. Several models of devices (cameras, deformable mirrors, LCD phase screens, and step motor controllers) have been interfaced in TAO. Most of the software is publicly available ¶ .

In the TAO framework, devices (the wavefront camera and the deformable mirror) are managed by servers:

• The server owning the wavefront camera continuously acquires images as quickly as possible, applies image pre-processing (affine correction and estimation of the pixel-wise precision) and delivers the resulting weighted images via shared memory to other processes. Shared read/write locks and condition variables are used to notify the other processes that a new image is available. § since the perturbations are known, their impact in the wavefront sensor measurements can be removed provided that the influence matrix G is known with sufficient accuracy ¶ https://git-cral.univ-lyon1.fr/tao

• The server owning the deformable mirror (DM) may receive actuators commands from any other process and apply these commands to the DM accounting for given reference commands preset so as to compensate for non common path aberrations (NCPA). The server stores in shared memory a cyclic history of the commands effectively applied to the DM (taking into account the reference and limitations of the DM such as minimal and maximal command levels). This history is updated immediately after applying the commands and other processes are notified so that they can figure out exactly which commands have been sent. This is needed, in particular, to compute the pseudo open-loop data.

The servers share information and receive commands from other processes via resources stored in shared memory and whose access is controlled by shared read/write locks and condition variables. With critical processes ran with real-time priority, the latency between a condition being notified and the process waiting for this condition to be awaken is small and quite stable (about 6 ± 1 µs). Latency of the same order have been measured for other RTC software like Cacao 10 on semaphores for process synchronization. We chose read/write locks and conditions variables so as to be the most flexible regarding which clients are allowed to connect to which resources and we rely on real-time priorities and the Linux process scheduler to dispatch the available CPU power. Compared to semaphores, read/write locks (like mutexes) may result in dead-locks if incorrectly used.

There are several advantages in the splitting of the tasks among several processes and in the sharing of information in shared memory:

• There are no latency due to transferring/copying of data.

• The available CPU power is better exploited and the latency reduced (in spite of the small delays induced by process synchronization) because a process can deliver the result of its work to others as soon as possible and then executes post-processing tasks.

• Non-sequential coding is more appropriate for implementing an AO system RTC and it turns out that the resulting code is considerably simpler than an equivalent version implemented with sequential coding.

• Once a device server is launched, any other process have access to the device and there is no restrictions on the number of clients accessing a given resources.

Accounting for the synchronization of tasks, Themis AO RTC is able to send commands to the deformable mirror with a delay of ≃ 220 µs after receiving the raw image from the wavefront sensor camera (see Fig. 3). The RTC was tested with a loop frequency up to 1.2 kHz.

FIRST CLOSING OF THE LOOP AND FIRST IMAGES

We closed the loop for the first time on the 8th of December 2020. Figures 456show some images of the Sun in open and closed loop at that time ‖ . Figure 7 shows the benefits of the AO system but also of the post-processing of images acquired in closed loop (here by a Knox-Thompson method). Figures 9 and8 show the results obtained by post-processing images recently acquired in closed loop with the Themis AO system in March and April 2022. These images demonstrate the great potential of this instrument (the fine grains seen between the granules are caused by small scale structures of the magnetic field and have a size of about 0.2" which is close to the diffraction limit of Themis).

Figure 1 .

 1 Figure 1. The Themis AO system. Left: outside view of the Themis telescope. Center: optical layout of the telescope with the AO system and the spectrograph. Top: layout of the sub-pupils of the Shack-Hartmann wavefront sensor and of the actuators of the deformable mirror. Right: the wavefront (camera and optics).

Figure 2 .

 2 Figure 2. The RTC framework of Themis.

Figure 3 .

 3 Figure 3. Scheduling of real-time tasks in Themis AO control. The RTC is able to deliver deformable mirros commands with a delay of ≃ 220 µs from the acquisition of the raw wavefront sensor image

Figure 4 .

 4 Figure 4. First closing of the loop (8 December 2020). Images of a 14.6" field of view (FOV) of the Sun in a Hα filter and centered at the FOV of the wavefront sensor. Left: open loop. Right: closed loop at 1 kHz. Temporal smoothing of 0.5 s, Fried's parameter estimated to be r0 ≃ 5 cm.

Figure 5 .

 5 Figure 5. Same as Fig. 4 but for a larger FOV of 25" and in worse turbulence conditions: Fried's parameter estimated to be r0 ≃ 3 cm. The green cross indicates the center of the wavefront sensor 10" FOV.

Figure 6 .

 6 Figure 6. Sun spot observed on 8th of December 2020. Left: open loop. Right: closed loop at 1 kHz. 25" FOV. The green cross indicates the center of the wavefront sensor 10" FOV.

Figure 7 .

 7 Figure 7. Solar granulation observed with Themis AO system. Left: open loop, granulation contrast: 1.7 %. Middle: closed loop, granulation contrast: 4.2 %. Right: result of post-processing of 100 images in closed loop (Knox-Thompson), granulation contrast: 9.6 %. Fried's parameter estimated to be r0 ≃ 3 -4 cm.

Figure 8 .

 8 Figure 8. Sun spots with Themis AO system and post-processed of images in closed loop.

Figure 9 .

 9 Figure 9. Solar granulation with Themis AO system and post-processed of images in closed loop.

  max

		Pr x θ t		(9)
	x
	= arg max x	Pr x y t , θ t-1	(since θ t = θ t-1 ∪ {y t })	(10)
	= arg max x	Pr x, y t θ t-1	(by Bayes' rule and as Pr y t θ t-1 is constant in x)	(11)
	= arg max x	Pr y t x, θ t-1 Pr x θ t-1	(again by Bayes' rule).	(12)
	For an AO system, the noise and the wavefronts are independent and the noise terms in two different frames are
	mutually independent. As a consequence, the pseudo open-loop data y t only depend on the wavefront w t and
	thus Pr y t x, θ t-1 = Pr y t x . The conditional expectation and covariance of the pseudo open-loop data can
	then be derived as follows:
		⟨y t | x⟩ = ⟨H t • x + z t | x⟩	(from Eq. (7))
		= H t • x + ⟨z t | x⟩	(by linearity of the expectation)
		= H t • x,		(13)

the latter assuming the noise is centered in the sense that ⟨z t | x⟩ = 0 † , and:

‖ For more details and movies, see https://git-cral.univ-lyon1.fr/isabelle.tallon-bosc/tao-news/ and http:

ACKNOWLEDGMENTS

The project has been funded through the FP7 program INFRA-2012-1.1.26, SOLARNET grant agreement n • 312495 of the European Commission. It has also obtained support from the "Action Spécifique Haute Résolution Angulaire" (ASHRA) of CNRS-INSU co-funded by CNES and the Actions Incitatives of the "Centre de Recherches Astrophysiques de Lyon" (CRAL).