Margherita Bazzoni

Célia Lhoste

Justine Bonnet

Kouakou Eric Konan

Prof Aurélie P Bernard

Patrick Giraudeau

François-Xavier Felpin

Jean-Nicolas Dumez
email: jean-nicolas.dumez@univ-nantes.fr

Prof. F.-X Giraudeau

Dr J.-N Felpin

Dumez

In-line multidimensional NMR monitoring of photochemical flow reactions

Keywords: Analytical methods, Flow Photochemistry, In-line monitoring, NMR spectroscopy, Ultrafast 2D NMR

This work demonstrates the in-line monitoring of a flow photochemical reaction using 1D and ultrafast 2D NMR methods at high magnetic field. The reaction mixture exiting the flow reactor is flown trough the NMR spectrometer and directly analysed. In the case of simple substrates, suitable information can be obtained through 1D 1 H spectra, but for molecules of higher complexity the use of 2D experiments is key to address signal overlaps and assignment issues.

Here we show the usefulness of ultrafast 2D COSY experiments acquired in 70 s or less, for the in-line monitoring of photochemical reactions, and the possibility to obtain reliable quantitative information. This is a powerful framework to, e.g., efficiently screen reaction conditions.

.

Introduction

Continuous flow chemistry is an enabling technology in chemical synthesis, with several advantages over traditional batch chemistry. Flow chemistry can make chemical reactions safer, more efficient, easier to scale up, and easier to automate. [1] Photochemical reactions are certainly the class of chemical transformations that benefits the most from a continuous flow transfer. [2,3] Photochemical reactions in batch typically suffer from a lack of reproducibility upon scaling up due to the narrow penetration depth of light and the difficulty in dissipating efficiently the heat generated by the light source. [4] Flow photochemical reactions benefit from improved exposition to light and faster heat dissipation thanks to the narrow channels typically used as reactors, that provide high surface to volume ratio. [5] High reaction rates and cleaner reactions resulting from efficient photon absorption and excellent temperature control are then decisive advantages for performing photochemical reactions in flow. This is particularly relevant considering that photochemical reactions are often complementary to thermal transformations and can allow to operate in milder conditions and/or achieve specific selectivity. [5] Reaction monitoring provides information on reaction progress and kinetics and is crucial for mechanistic understanding and optimization. Real-time analysis makes it possible to observe reactions without going through sometimes expensive and timeconsuming downstream processes that could also perturb the state of the reaction. A wide range of analytical techniques providing often complementary information is available for reaction monitoring. [6] Nuclear magnetic resonance (NMR) spectroscopy has many relevant features such as the fact that it is non-destructive, and provides accurate quantitative and structural information. It has proven highly useful for applications to photochemical batch reactions. [7] Flow chemistry offers the possibility to analyse reaction composition on the fly using in-line detection. In this approach, the output of the reactor, which is already a homogeneous solution, flows through the detector. [6,8] This is in contrast to the more classical online monitoring of batch reactions, in which a fraction of the reaction medium is circulated between the reactor and the detector. In-line detection opens the possibility to implement efficient reaction/process monitoring and optimisation methods, as it allows fast reaction screening thanks to the time efficient coupling of the reactor and the detector [9,10] In-line NMR spectroscopy for flow chemistry is becoming widespread thanks to the use of benchtop NMR systems. [11][12][13][14][15] The possibility to install the spectrometer under the fume hood makes the implementation straightforward. The modest resolution and sensitivity of benchtop instruments, however, strongly limit the range of applications.

The development of flow apparatus for high-field NMR spectroscopy opens opportunities for reaction monitoring. [16][17][18][19] Compared to benchtop NMR, high-field NMR provides better resolution and sensitivity and this is often crucial for the analysis of complex mixtures, especially in cases in which the difference in the structure of reagents and products is not particularly marked leading to strong signal overlap. More generally, high-field NMR is the workhorse analytical method in organic chemical synthesis, and using it for in-line detection can provide an unprecedented level of information. Flow NMR at high field has been used for applications to the online monitoring of batch reactions. [18,[20][21][START_REF]Photocatalytic α-Tertiary Amine Synthesis via C-H Alkylation of Unmasked Primary Amines -Ryder -2020[END_REF] However, only few examples of in-line monitoring of flow reactions at high field have been described, [23][24][25] and none, to our knowledge, for photochemical reactions. 1 Even at high magnetic field, 1 H 1D experiments can be insufficient to address the complexity of reaction mixtures. They are often plagued with overlap issues, that make it difficult to identify, integrate, and interpret signals. 2D NMR experiments are useful to address overlap issues and provide additional structural information, but the duration of conventional 2D experiments is hardly compatible with in-line analysis, which ideally requires short analysis durations for high throughput, and efficient process control and automation. Ultrafast (UF) 2D NMR make it possible to accelerate experiments by one order of magnitude or more, [START_REF] Frydman | Proc. Natl. Acad. Sci[END_REF] and is a powerful tool for reaction monitoring. [START_REF] Lhoste | [END_REF] Notably, UF NMR methods can provide broadband 2D spectra in less than 1 minute at mM concentrations at high field, and this is comparable to the duration of a 1D experiment. [START_REF] Lhoste | [END_REF] UF 2D NMR has never been used, however, for the in-line analysis of a flow reaction.

In this work we describe the in-line monitoring of a flow photochemical reaction, using 1D and ultrafast 2D NMR experiments at high field. We first describe an experimental setup to couple a flow photochemical reactor with a high-field NMR spectrometer. We then use this setup to screen reaction conditions efficiently, and to obtain quantitative insight into several photoactivated thiol-ene additions, using stopped flow acquisition. The combination of in-line analysis and photochemistry provides an accurate description of the reaction outcome, with well controlled reaction parameters. Together, these methods open the way towards many applications to guide the design and optimisation of flow reactions.

Results and Discussion

The experimental setup used in this work is represented schematically in Fig. 1. The custom-made flow reactor is connected to a commercial flow tube (InsightMR, Bruker) inserted in a 500 MHz spectrometer, and a HPLC pump is used to flow the sample. The flow tube consists of a 5 mm NMR tube tip, and two 7 m long 0.5 mm I.D. peek capillaries that run to and from the tube tip through a thermostatic line. The entire flow tube has a volume of ca. 4 mL. The reaction mixture is introduced through the 5 mL injection loop, flown through the reactor and to NMR detection. The flow is stopped during NMR experiments. Note that in the case of photochemical reactions, the reactivity is restrained to the section of capillary exposed to light, and this allows accurate estimation of the residence time even in presence of a rather long capillary connecting the flow-reactor to the analytical system.

In order to assess the in-line monitoring of flow photochemical reactions using in-line 1D and UF 2D NMR experiments at high field, we focussed on the thiol-ene addition of 2-mercaptoethanol to three unsaturated organic compounds: 2,4,4-trimethyl-1-pentene 1, camphene 2 and quinine 3, as shown in scheme 1. These three substrates provide a relevant array of chemical and NMR complexity, and we chose to measure the influence of the residence time on the reaction conversion and rates.The same setup would allow to screen, for example, the effect of stoichiometry or other parameters. For each run a freshly prepared reaction mixture was injected into the flow reactor, after equilibrating the system at the desired flowrate for about 10 minutes. The reaction outcome was analysed through 1D proton and 2D ultrafast COSY spectra, stopping the flow during acquisition. Reactions were carried out at 30°C, using (undeuterated) chloroform as solvent, while the analysis were carried out at room temperature (25°C). The difference in temperature between the transfer line and the detection region was small, and no delay for temperature stabilization was used. Shortly after stopping the flow the shimming procedure led to good field homogeneity and spectra of good quality.

A series of 1D 1 H spectra for the thiol-ene reaction of quinine 3, obtained with residence times in the range of 35 s to 10 min, are shown in Fig. 2. An additional spectrum obtained without irradiation (t = 0), is also shown (spectra for the other substrates are shown in the supporting information). The 1D 1 H spectra are acquired with 4 scans and 2 dummy scans each, resulting in an experiment duration of 90 s. All the experiments were carried out with undeuterated solvents (CHCl3), and the solvent signal was suppressed using the WET pulse sequence element (see methods). Optimisation of the flip angle of the WET shaped pulses ensured spectra of really good quality. Some signals are straightforward to identify in this case, such as those arising from the quinine double bond, and can be used for quantification. However, these experiments are also limited by extensive overlap. This can for example be seen in the 1.3-1.5 ppm region in Fig. 2.

UF NMR, relying on spatial parallelisation of the t1 increments of 2D experiments (different increments are obtained from different slices of the sample), is a powerful way to accelerate 2D NMR experiments. [START_REF] Lhoste | [END_REF] In-line UF 2D COSY spectra obtained for the three thiol-ene reactions studied here are shown in Fig. 3. The increased dispersion of signals in the 2D spectra addresses the overlap issues of the 1D spectra. For example, (see also expansion in Fig S5) the crosspeaks at 3.1/2.6 ppm, belonging to the quinine 3, are well resolved while the corresponding diagonal peaks are strongly overlapped with signal from the thiol and the product 6. The analysis of the 2D spectra also provides important structural information. In the 1D spectra from trimethylpentene 1 and camphene 2, a triplet is well visible at 1.45 ppm. The analysis of the corresponding 2D spectra shows the correlations with the signal at 2.7 ppm belonging to 2-mercaptoethanol allowing to assign the triplet at 1.45 ppm as the thiol -SH function. While UF 2D NMR spectra can be acquired in a single scan, such single-scan experiments are limited in terms of spectral width. Hybrid experiments based on the acquisition of a few scans make it possible to alleviate these constraints. Another less explored approach would be to combine UF experiments and nonlinear sampling. [28] Each 2D COSY spectrum was acquired here with 4 interleaved scans to cover the required spectral width, [START_REF] Lhoste | [END_REF] and either 1 or 2 averages, resulting in a total experiment duration of 35 or 70 s or less. This is more than 10 times faster than the corresponding conventional experiment. Importantly, it is comparable to the duration of 1D experiments. There is thus little overhead in terms of NMR experiment duration to acquire 2D data using this method. Also, it is of the same order of magnitude or smaller as the reaction time, meaning that NMR acquisition would not be the rate determining step in an automation process. It should be noted that the duration of the NMR analysis plays a different role in the cases of in-line monitoring and online monitoring. In online monitoring, if the NMR analysis lasts 1 min, then a spectrum can be collected every 1 min throughout the reaction. For in-line monitoring, the reaction is sampled at the reactor outlet at a fixed residence time for a single run. The frequency with which different reaction conditions can be screened is governed by both NMR experiment duration and residence time.

In the present study, the most time-consuming part is the transport between the reactor and the detector, when the flow rate is low. At the lowest flow rate value used here, of 0.1 mL/min, it takes about 15 min to travel along the 7 m capillary and about 15 min for the filling and equilibration of the NMR tube tip. That sums to the 10 min of residence time in the flow reactor, and about 10 min for travelling from the pump to the reactor and from it to the flow tube, the total time required for the experiment at 0.1 mL/min being thus of about 50 min. The long transport and filling time are a limitation of the analysis at high field with a flow tube, but an automation increasing the flow rate at the reactor outlet should mitigate this issue.

Figure 3. 2D UF COSY spectra for the three tested substrates acquired for 3 reaction runs. The rectangles highlight the decreasing in intensity of some reagent correlations (red), and the increasing in intensity of correlations from the product (blue) as a function of increasing residence time. The spectra have been acquired using spatial encoding along Z axis and a WET block for solvent suppression. In the case of quinine 3, a delay to optimize the sensitivity based on J-modulation has been used. For this display, the intensity of each 2D spectrum was normalized based on the intensity of the standard. For 1 and 2 the spectra at t=0 have been acquired on the reaction mixture in a standard NMR tube, for 3 on the reaction mixture injected in the flowtube with a flow rate of 1.5 mL/min but without exposition to light.

To allow for quantitative measurements and comparison among different runs, a standard (1,3,5-trimethoxybenzene) was introduced in the system. This is because the reaction mixtures, which enter the flow reactor from the injection loop, undergo some unknown and flow-rate dependent degree of dilution during transport especially when reaching the NMR tube tip (which has an inner diameter 10 times larger than that of the capillary, see fig. S6 for a schematic representation). The integrals of selected peaks in the 1D and UF 2D spectra (divided by the integral of a peak of the standard in the corresponding spectrum) are shown in Fig. 4, as a function of the residence time, for the three reactions (each residence time in Fig. 4 corresponds to a different reaction run). Note that the integrals provide here relative rather than absolute changes in concentrations, since flow effects and, in the case of 2D experiments, the effect of pulses and delays, were not accounted for.

For the reactions analysed here, one resolved signal at least can be found for both the -ene substrates 1-3 and the products 4-6, in the 1D 1 H spectra. This is useful to validate the results obtained through the UF 2D experiments, used for the first time for this application. From this data, and specifically the integrals obtained for the starting material the reaction conversion can be accessed, as illustrated in Fig. S9, S12 and S15. This shows good agreement the information obtained from 1D and 2D NMR. The final conversion is actually underestimated in the 1D case, because of overlap with broad resonances.

The fitting of the data from runs with different residence times on a same substrate can also provide kinetic information. Thiolene reactions are known to be pseudo first order kinetic with respect to thiol, alkene or with respect to both based on the alkene reactivity. [29] The data shown in Fig. 4 were fitted with a pseudofirst order model: [29] 𝐹(𝑥) = 𝐴 × exp(-𝐵 × 𝑥) + 𝐶 The resulting rate constants (𝐵) and errors are shown in Fig. 5, and the individual experimental and fitted curves are shown in the supporting information. There is very good agreement between the data obtained from the 1D spectra, and from the diagonal and cross peaks of the 2D spectra. Notably, cross peaks in the 2D spectrum can be used to reliably monitor the reaction conversion and determine reaction kinetic constants. Interestingly, in several instances, a cross-peak can be integrated in the 2D spectra while the corresponding diagonal peaks are severely overlapped in the 1D spectra (for example peak 4 in the 2D spectrum for the reaction of 3). In some instances, peaks in the 1D spectra overlap with a very broad peak, while this is not the case for the corresponding diagonal peak in the 2D spectra (for example peak 5 for the reaction of 2 and peak 4 for the reaction of 1). This is simply because of the delay between excitation and detection in the 2D experiments, which acts as a filter. Also, some of the cross peaks in the UF 2D spectra had low SNR leading to random and/or systematic errors in the integration. The resulting rates are inaccurate (peak 4 and 6 in the 2D spectra for the reaction of 3), but this can be avoided by applying an SNR threshold. Note that the somewhat simplistic analysis provided here is meant to assess the information content of the 2D cross peaks with respect to the 1D/diagonal peaks, with a further kinetic analysis being out of the scope of this study.

The studied thiol-ene reaction is rather clean, however it is possible to identify in all the spectra a triplet at ca. 2.8 ppm belonging to the major side-product observed. The COSY spectra show a correlation of this peak with a signal at ca. 3.8 ppm, which, in the case of quinine 3 as the starting material, overlaps with a strong singlet from 3. 2 and3 for the three tested reactions. Some signals, labelled as $ are in the 1D spectra affected by overlap with broad resonances, as explained in the main text this effect is mitigated in the case of 2D spectra. Peaks with a too low SNR leads to inaccurate fitting, as shown from the peaks 4 and 6 for the 2D spectra of compound 3 labelled as *. In the case of compound 1, peak 3 for the 1D data and peak 4 for the 2D data, labelled as #, behave as outlier but there is very good agreement between 1D and 2D data. Based on this NMR information, augmented with a selective 1D TOCSY experiment (Fig. S16), and the reaction conditions, we hypothesised that this side-product resulted from the thiol dimerization. The rate of formation of this side reaction is affected by the reactivity of the used alkene. The dimerization of 2mercaptoethanol is faster for the reaction on 2, and in this case consumes about 35% of the starting thiol for the longest residence time used. It is interesting to notice how, in this case, NMR allows to follow the formation of a rather small amount of side-product. Note that the experiments described here were performed with a triple-axis gradient probe. While this is highly convenient (and sometimes mandatory [30] ) for UF 2D NMR experiments, it is possible here to also work with a single gradient axis. This is illustrated in Fig. S17, which compares UF 2D spectra obtained with either gradients pulses along several axes, or all the gradient pulses along Z. It can be seen that, while solvent suppression is not as good with a single axis, and there are a few artefacts left, the data are still mostly comparable to the multi-axis case.

The methodology presented here may also be extended to other types of 2D spectra, including, e.g., HSQC spectra, depending on sample concentration, and with a trade-off between sensitivity and sample throughput.

Conclusion

In summary, we have shown that in-line detection with high-field NMR spectroscopy can be used for the in-line monitoring of photochemical flow reactions, and provides a powerful platform to screen reaction conditions, and get quantitative information on conversion and reaction rates for an array of reactions. These systems and concentrations would be impossible to analyse with benchtop NMR, and more generally this approach provides access to the full power of analytical NMR for organic chemical synthesis. Using UF NMR, 2D spectra are obtained with an experiment duration that is comparable to that of 1D experiments. Improved signal dispersion and additional structural information are thus obtained with minimal overhead for the duration of the analysis. The in-line monitoring strategy described here lends itself particularly well to automation, and opens many perspectives in flow and digital chemistry.

Experimental Section

Instrumentation Flow reactor. The flow reactor is custom-made and consists of a FEP tubing (1 mL) wrapped around a double wall cylindrical glass support able to host the UV light emitting at 365 nm, a thermometer and an air flow used to control the temperature. FEP tubing has good chemical compatibility and is transparent to UV light, thus it guarantees efficient illumination of the reaction mixture. A HPLC (Jasco, model PU-2080) pump, equipped with a 5 mL loop for sample injection is used to flow the sample. Flow tube. In-line detection is made possible here by the use of a commercial flow tube (InsightMR, Bruker). The flow tube consists of a 5 mm NMR tube tip, connected to the output of the flow reactor by a 7 m long 0.5 mm I.D. peek capillary. A further 7 m capillary returns from the NMR tube tip to the sample collector. The two capillaries run through a thermostatic line, and the entire flow tube has a volume of ca. 3.5 mL. The length of the capillary is justified by the fact that we use an unshielded NMR magnet. A shielded magnet would allow for a shorter line. The Bruker InsightMR flow tube is straightforward to insert in the magnet guide, simply by sliding the end of the transfer line inside the magnet. The end of the transfer line consists of an NMR tube tip held by a plastic support shaped as a conventional spinner, and the diameter of the tube connected to it perfectly fits in the magnet bore. NMR. NMR experiments were carried out with a spectrometer operating at frequency of 500.13 MHz (Bruker, Avance III), with an inverse-detection probe equipped with triple-axis gradients. While not compulsory, triple-axis gradients are useful for spatial parallelisation experiments. A comparison of spectra acquired with and without the use of three gradient axes is shown in section 4 of this document. NMR experiments were recorded at a temperature of 298 K. Reactions Reagents: Reagents were all commercially available chemicals and were used as received unless otherwise noted. High resolution mass spectrometry (HRMS) was recorded on a microTOF spectrometer equipped with orthogonal electrospray interface (ESI). Analytical thin-layer chromatography (TLC) was carried out on silica gel 60 F254 plates and visualized with a UV lamp at 254 nm or stained with a basic potassium permanganate solution. Flash column chromatography was performed using silica gel 60 (40-63 µm). General procedure: Reagent stock solutions were prepared dissolving each reagent in CHCl3 using volumetric flasks to reach the desire volumes. Before each reaction run, the apparatus consisting of the flow reactor and flowtube was stabilized flowing pure solvent for about 15 minutes at the desired flowrate before the injection. For each substrate, multiple reaction runs were performed, varying the residence time inside the flow reactor with the aim to sample different stages of reaction progress. Stock solution for 3: 2.45 g, 7.56 mmol of 3 were dissolved in CHCl3 in a volumetric flask adjusting the volume to 10 mL, 1.18 g, 7.00 mmol of TMB were dissolved in CHCl3 in a volumetric flask adjusting the volume to 2 mL, 2.03 g, 7.32 mmol of DMPA were dissolved in CHCl3 in a volumetric flask adjusting the volume to 10 mL. 1.06 mL, 15.1 mmol of 2-mercaptoethanol were dissolved in CHCl3 in a volumetric flask adjusting the volume to 5 mL. The TMB solution was then added to the quinine solution. Reactions for 3: for each reaction run, a freshly made reaction mixture was obtained mixing 1.80 mL of 3 and TMB solution, 0.795 mL of thiol solution and 1.59 mL of DMPA solution in a volumetric flask, to have a 1:2:1.05 stoichiometric ratio. The volume was adjusted to 10 mL adding CHCl3. The solution was then filtered to assure its homogeneity, charged into the sample loop and injected in the flow reactor stabilized at a temperature of 304 K. Stock solution for 2: 932 mg, 6.84 mmol of 2 and 959 mg, 5.7 mmol of TMB were dissolved in CHCl3 in a volumetric flask adjusting the volume to 10 ml. 1839 mg, 7.18 mmol of DMPA were dissolved in CHCl3 in a volumetric flask adjusting the volume to 10 mL. 961 µL, 13.7 mmol of 2-mercaptoethanol were dissolved in CHCl3 in a volumetric flask adjusting the volume to 5 mL. Reactions for 2: Following the same procedure described for 3, using 1.75 mL of 2 + TMB solution, 1.75 mL of DMPA solution, and 0.88 ml of thiol solution mixed in a graduated flask adjusting the volume to 10 mL.

Stock solution for 1: 1078 µL, 6.84 mmol of 1 and 959 mg, 5.7 mmol of TMB were dissolved in CHCl3 in a volumetric flask adjusting the volume to 10 mL. 1839 mg, 7.18 mmol of DMPA were dissolved in CHCl3 in a volumetric flask adjusting the volume to 10 mL. 961 µL, 13.7 mmol of 2-mercaptoethanol were dissolved in CHCl3 in a volumetric flask adjusting the volume to 5 mL. Reaction for 1: Following the same procedure described for 3, using 1.75 mL of 1 + TMB solution, 1.75 mL of DMPA solution, and 0.88 mL of thiol solution mixed in a graduated flask adjusting the volume to 10 mL. NMR acquisition NMR spectra were acquired when the reaction mixtures reached the tube tip of the flow tube, stopping the flow during acquisition. 1D 1H spectra: The spectra were acquired with 4 scans, 2 dummy scans, a spectral width of 20 ppm, an acquisition time of 1.64 s and a relaxation delay of 10 s. The total experimental time was 1 min 40 s. Solvent suppression was achieved with a WET block using 4 seduce shaped pulses of 17 ms each, with nominal tip angles of 81.4°, 101.4°, 69.3° and 161°, and four gradient pulses of amplitude 0.434 T/m, 0.217 T/m, 0.108 T/m and 0.050 T/m and duration 1.0 ms, applied along the X axis. UF COSY spectra: The spectra were acquired using the pulse sequence shown in Fig. 6, with 4 interleaved scans and 1 dummy scan, either 1 or 2 scans per interleave, and a relaxation delay of 7 s, resulting in a total experimental duration of 36 s or 69 s. The spatial encoding block consisted of a pair of 180° chirp pulses with a duration of 15 ms and a bandwidth of 25 kHz, applied together with bipolar encoding gradients (Ge) of ±0.021 T/m along Z. The acquisition block consisted of 64 bipolar gradient (Ga) pulses of or ±0.58 T/m, for a duration of 0.065 s. In the case of starting material 3, two delays τj of 15 ms each were used to account to Jmodulation effects and optimize the SNR of cross peaks. [31] Solvent suppression was achieved with a WET block using 4 seduce shaped pulses of 17 ms each, with nominal tip angles of 81.4°, 101.4°, 69.3° and 161°, and four gradient pulses of amplitude 0.434 T/m, 0.217 T/m, 0.108 T/m and 0.050 T/m and of duration 1.0 ms, applied along the X axis. Coherence selection gradient pulses were applied around the second chirp pulse, with a duration of 1.2 ms and an amplitude of ±0.034 T/m, and around the mixing pulses, with a duration of 1.0 ms and an amplitude of 0.060 T/m. They were applied along the X axis. [32] were used for the excitation and mixing pulses.

NMR processing and analysis. 1D 1 H data were processed using MestReNova (Mnova), after phase and baseline correction the spectra were referenced to the peak of TMB at 6.1 ppm. Integration was performed using the data analysis tool on the stacked spectra.

UF COSY data were processed and integrated using a custom-made script in Matlab. The data are imported and rearranged into a 2D matrix. Odd and even echoes are separated, processed separately, then co-added. Along the spatial dimension, the data are inverse Fourier transformed, apodised with a Gaussian window, [33] zero-filled and Fourier transformed. Along the spectral dimension the data are apodised with a sine window, zero-filled and Fourier transformed. Magnitude spectra are used in all cases. For build-up curves, the integration regions were selected on the first spectrum, and their position was adjusted for subsequent spectra.

Data fitting to determine kinetic constants was performed using a non-linear least-squares fit function, with custom-written Matlab scripts.

Figure 1 .Scheme 1 .

 11 Figure 1. Schematic representation of the used experimental setup.

Figure 2 .

 2 Figure 2. 1D 1 H spectra acquired for 6 reaction runs on quinine 3 with different residence times in the flow reactor. The rectangles highlight the peaks selected to follow the evolution of quinine 3 (red) and the product 6 (blue) as a function of the residence time.

1 HFigure 4 .

 14 Figure 4. Integrals of selected reagent (red) and product (blue) correlations as a function of the residence time for the 6 reaction runs on compounds 1-3. Integration regions are shown in Fig. 2 and 3.

Figure 5 .

 5 Figure5. Kinetic constant measured for product formation (blue) and reagent consumption (red) from 1D and 2D spectra based on the signals highlighted in the spectra reported in Fig.2 and 3for the three tested reactions. Some signals, labelled as $ are in the 1D spectra affected by overlap with broad resonances, as explained in the main text this effect is mitigated in the case of 2D spectra. Peaks with a too low SNR leads to inaccurate fitting, as shown from the peaks 4 and 6 for the 2D spectra of compound 3 labelled as *. In the case of compound 1, peak 3 for the 1D data and peak 4 for the 2D data, labelled as #, behave as outlier but there is very good agreement between 1D and 2D data.

Figure 6 .

 6 Figure 6. UF COSY pulse sequence used in this work. The interleaving delay is indicated as Ti. Composite pulses[32] were used for the excitation and mixing pulses.

Note that "flow NMR" means that the sample is flown to/through the spectrometer. It can be used for the "online" monitoring of batch reactions, and

Acknowledgements

This work has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (grant agreements no 801774/DINAMIX and 814747/SUMMIT) the Region Pays de la Loire (Connect Talent HPNMR), the Agence Nationale de la Recherche (ANR-21-CE07-0056-02), and the I-SITE NExT (iChem4.0). The NExT initiative is supported by Nantes Université, the Région des Pays de la Loire and Nantes Métropole in the frame of the Programme d'Investissement d'Avenir (PIA). The authors also acknowledge the French National Infrastructure for Metabolomics and Fluxomics MetaboHUB-ANR-11-INBS-0010 (www.metabohub.fr) and the Corsaire metabolomics core facility (Biogenouest). This work includes NMR experiments carried out on the CEISAM NMR platform.

Entry for the Table of Contents

This work demonstrates the in-line monitoring of a flow photochemical reactor using 1D and ultrafast 2D NMR methods at high magnetic field. Ultrafast 2D NMR experiments acquired in line yield useful quantitative information in just 40 s.

Institute and/or researcher Twitter usernames: @CeisamLab ; @MargheB4 ; @celia_lhoste ; @PatGiraudeau


Léo Andéol
email: leo.andeol@math.univ-toulouse.fr

Thomas Fel
email: thomasfel@brown.edu

Florence De Grancey
email: florence.de-grancey@irt-saintexupery.com

Luca Mossina
email: luca.mossina@irt-saintexupery.com

Conformal Prediction for Trustworthy Detection of Railway Signals

We present an application of conformal prediction, a form of uncertainty quantification with guarantees, to the detection of railway signals. State-of-the-art architectures are tested and the most promising one undergoes the process of conformalization, where a correction is applied to the predicted bounding boxes (i.e. to their height and width) such that they comply with a predefined probability of success. We work with a novel exploratory dataset of images taken from the perspective of a train operator, as a first step to build and validate future trustworthy machine learning models for the detection of railway signals.

Introduction

In this paper we focus on building a trustworthy detector of railway light signals via Machine Learning (ML) 1 . We apply Uncertainty Quantification (UQ) to the problem of Object Detection (OD) [START_REF] Zhao | Object Detection With Deep Learning: A Review[END_REF]) via the distribution-free, non-asymptotic and model-agnostic framework of Conformal Prediction (CP). CP is computationally lightweight, can be applied to any (black-box) predictor with minimal hypotheses and efforts, and has rigorous statistical guarantees.

We give a brief overview of UQ for OD and the CP method we apply to our use case. After selecting a pretrained model among the state-of-the-art architectures, we give some insights on how UQ techniques can quantify the trustworthiness of OD models, which could be part of a critical Artificial Intelligence (AI) system, and their potential role in certifying such technologies for future industrial deployment.

The Industrial Problem

AI can work as a complementary tool to enhance existing technologies, like in the automotive industry [START_REF] Alecu | Can we reconcile safety objectives with machine learning performances?[END_REF]. We can draw a parallel with the railway sector. While main lines (e.g. high-speed lines) already have in-cabin signaling and can be automatized [START_REF] Singh | Deployment of Autonomous Trains in Rail Transportation: Current Trends and Existing Challenges[END_REF], this is too costly to apply to the whole network. Consequently, on secondary lines, drivers can be subject to a larger cognitive With respect to Figure 1, our application corresponds to point (1) of their process based on multiple ML tasks: trustworthiness concerns can grow with the number of ML components. For a recent overview on the technical and regulatory challenges raised by the safety of ML systems in the railway and automotive industries, see [START_REF] Alecu | Can we reconcile safety objectives with machine learning performances?[END_REF].

Building an exploratory dataset

Currently, there is no standard benchmark for railway signaling detection. Stemming from the dataset FRSign of [START_REF] Harb | FRSign: A Large-Scale Traffic Light Dataset for Autonomous Trains[END_REF] and their insights, our own iterations made us aware of some additional needs. Notably, our new dataset aims for images to be independent and identically distributed (i.i.d), and therefore, raw sequences cannot be considered. Moreover, our new dataset features increased variability (more railway lines, environmental and weather conditions, etc.) which could enable more accurate predictions in real-world scenarios. Finally, we generalize the task from single to multi-object detection, laying the foundations for future work in instance segmentation.

We would expect a deployable system to work whenever a human operator is successful: at night, with rain, or even when the signals are partially occluded by foliage. Within our exploratory dataset, we included different light conditions but this is far from exhaustive; these issues will be As source data, we used some video footage taken on French railway lines, with the approval of the creators 2 . To extract the samples, we acted as follows. On 25 videos of average duration about 1.5 hour, we extract on average 55 images per video by running a pretrained object detector with a low objectness threshold, and we keep a minimum interval of 3 seconds between detections, to prevent excessive dependence between images. We kept the images without the associated detections. We then manually annotated all visible railway signals. In Table 1 we report the statistics of our dataset.

Related Works

Among the OD architecture, we point out YOLO [START_REF] Redmon | You only look once: Unified, real-time object detection[END_REF]) and its variants: they propose a one-stage detection combining convolution layers with regression and classification tasks. [START_REF] Howard | Mobilenets: Efficient convolutional neural networks for mobile vision applications[END_REF], with MobileNets, introduced the concept of depth-wise separable convolutions to reduce the number of parameters and accelerate the inference. As for the recent introduction of transformer layers, we find DETR [START_REF] Carion | End-to-end object detection with transformers[END_REF] and ViT [START_REF] Dosovitskiy | An image is worth 16x16 words: Transformers for image recognition at scale[END_REF], among others. These networks reach state-of-the-art performances, and seem well-suited to transfer learning. Finally, DiffusionDet Chen et al. ( 2022) recently formulated OD as a denoising diffusion problem, from random noisy boxes to real objects, with state-of-the-art performance.

Uncertainty Quantification in Object Detection

UQ is an important trigger to deploy OD in transport systems. We find probabilistic OD [START_REF] Hall | Probabilistic object detection: Definition and evaluation[END_REF], where the probability distributions of the bounding boxes and classes are predicted; Bayesian models like in [START_REF] Harakeh | Bayesod: A bayesian approach for uncertainty estimation in deep object detectors[END_REF] and Bayesian approximations [START_REF] Deepshikha | Monte carlo dropblock for modelling uncertainty in object detection[END_REF]) are also found in the literature. We point out the distribution-free approach of [START_REF] Li | Towards PAC Multi-Object Detection and Tracking[END_REF]: they build probably approximately correct prediction sets via concentration inequalities, estimated via a held-out calibration set. They control the coordinates of the boxes but also the proposal and objectness scores, resulting in more and larger boxes. Finally, de [START_REF] De Grancey | Object Detection with Probabilistic Guarantees: A Conformal Prediction Approach[END_REF] proposed an extension of CP to OD, which will be the framework of choice in our exploratory study. 2 We would like to thank the author of the Youtube channel: https://www.youtube.com/@mika67407

Conformalizing Object Detection

Conformal Prediction (CP) [START_REF] Vovk | Algorithmic Learning in a Random World[END_REF][START_REF] Angelopoulos | A Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification[END_REF]) is a family of methods to perform UQ with guarantees under the sole hypothesis of data being independent and identically distributed (or more generally exchangeable). For a specified (small) error rate α ∈ (0, 1), at inference, the CP procedure will yield prediction sets C α (X) that contain the true target values Y with probability:

P Y new ∈ C α (X new ) ≥ 1 -α.
(1)

This guarantee holds true, on average, over all images at inference and over many repetitions of the CP procedure. However, it is valid for any distribution of the data P XY , any sample size and any predictive model f , even if it is misspecified or a black box. The probability 1 -α is the nominal coverage and the empirical coverage on n test points is

ntest i=1 I{Y i ∈ C α (X i )}/n test .
We focus on split CP [START_REF] Papadopoulos | Inductive confidence machines for regression[END_REF][START_REF] Lei | Distribution-Free Predictive Inference for Regression[END_REF], where one needs a set of calibration data D cal drawn from the same P XY as the test data, with no need to access the training data. At conformalization, we compute the nonconformity scores, to quantify the uncertainty on held-out data. At inference, CP adds a margin around the bounding box predicted by a pretrained detector f . In de Grancey et al. ( 2022) their nonconformity score, which we refer to as additive, is defined as:

Split conformal object detection

R k = (x k min -x k min , ŷk min -y k min , x k max -xk max , y k max -ŷk max ). (2)
We further define the multiplicative one as:

R k = xk min -x k min w k , ŷk min -y k min h k , x k max -xk max w k , y k max -ŷk max h k (3)
where the prediction errors are scaled by the predicted width w k and height h k . This is similar to [START_REF] Papadopoulos | Inductive confidence machines for regression[END_REF], and a natural extension to de Grancey et al. ( 2022).

Split conformal object detection goes as follows:

1. choose a nonconformity score: e.g. Equation ( 2) or (3); 2. Run a pairing mechanism, to associate predicted boxes with true boxes (see following paragraphs); 3. For every coordinate c ∈ {x min , y min , x max , y max }, let Rc = (R c k )

n box k=1 ; 4. compute q c 1-α 4 = (n box + 1)(1 -α 4
) -th element of the sorted sequence Rc , ∀c ∈ {x min , y min , x max , y max }.

Since we work with four coordinates, for statistical reasons, we adjust the quantile order from (1 -α) to (1 -α 4 ) using the Bonferroni correction. We conformalize box-wise: we want to be confident that when we detect correctly an object ("true positive"), we capture the entire ground-truth box with a frequency of at least (1 -α), on average. During calibration (point 2. above), for all the true positive predicted boxes ( Y T P cal ), we compute the nonconformity score between the true box and the prediction. The pairing mechanism is the same as the NMS used in OD, that is, for each ground-truth bounding box, the predicted bounding boxes (not already assigned to a ground truth) are tested in decreasing order of their confidence scores. The first predicted box with an IoU above a set threshold is assigned to the ground truth box. Note that while building ( Y T P cal ), we do not consider false negatives (due to f ) which cannot be taken care of by box-wise CP.

At inference, the additive split conformal object detection prediction box is built as:

C α (X) = { x min -q xmin 1-α 4 , y min -q ymin 1-α 4 , (4)
x max + q xmax 1-α 4 , y max + q ymax 1-α 4 }.
The multiplicative conformal prediction box is:

C α (X) = { x min -w • q xmin 1-α 4 , y min -h • q ymin 1-α 4 , (5)
x max + w • q xmax 1-α 4 , y max + h • q ymax 1-α 4 }.

Experiments

We split our dataset into three subsets: validation, calibration and test (respectively of size 300, 700, 395). We compare, using the validation set, the performance of YOLOv5, DETR and DiffusionDet, pretrained on COCO [START_REF] Lin | Microsoft coco: Common objects in context[END_REF], as candidate base predictors f , restricting the detection to the class "traffic light". Commonly, OD models are evaluated using the Average Precision (AP), which is the Area Under the recall-precision Curve. AP incorporates the precision-recall trade-off, and the best value is reached when precision and recall are maximized for all objectness thresholds. In our application (Table 2), the AP for YOLOv5 is low, while DETR gives better results, and DiffusionDet is significantly superior to the others. We therefore use the DiffusionDet model for our conformalization. However, AP metrics alone do not give a complete picture to select OD architecture.

Detector evaluation with box-wise conformalization

We evaluate OD performances (Table 3) by box-wise conformal prediction, reporting the estimated quantiles q c 1-α 4 at the desired risk level. A higher quantile reveals a higher uncertainty of OD predictions.In order to compare additive and Figure 2: Bounding boxes as predicted by the ML predictor (blue), their conformalized version with additive scores (green) and the ground truth (red). Example of images used in conformalization and testing, cropped for readability.

q x min 1-α q y min 1-α q xmax 1-α q ymax 1-α

Results

Empirically, CP works as expected: in Table 4, we see that conformalized coverage is close to the nominal level of (1α) = 0.9. Remark that the guarantee holds on average over multiple repetitions, hence we cannot expect to attain the requested nominal coverage with just one dataset.

Interpretation of conformal bounding boxes

A conformalized predictor is only as good as its base predictor f . If the latter misses many ground truth boxes, guaranteeing (1 -α) 100% correct predictions of a few boxes will still be a small number. tional: our ML pipeline could rely on a conservative estimation of the ground-truth to carry out a control operations (e.g. running a ML subcomponent on the detection area).

Conclusion & perspectives

Given the insights from this exploratory study, we plan on building and publishing an augmented version of the dataset.

The objective is to have a dedicated, high-quality benchmark for the scientific community and the transport industry. As mentioned above, CP works with exchangeable data. In the long term, if trustworthy AI components are to be deployed, the UQ guarantees will need to be adapted to streams of data: this will pose a theoretical challenge and one in the construction and validation of the dataset. So far, the underlying criterion for successful prediction has been whether the ground truth box is entirely covered by the predicted box. This is strict, as having a system that guarantees to cover a big part of the truth, seems to be equally useful in practice. [START_REF] Bates | Distribution-Free, Risk-Controlling Prediction Sets[END_REF], with their risk controlling prediction sets, and [START_REF] Angelopoulos | Conformal Risk Control[END_REF], with conformal risk control, go in this direction. They extend the guarantee of CP to arbitrary losses, that can incorporate other operational needs.

Figure 1 :

 1 Figure 1: Example of pipeline where an AI system acts following ML-based predictions. Source: Alecu et al. (2022).

  We follow de[START_REF] De Grancey | Object Detection with Probabilistic Guarantees: A Conformal Prediction Approach[END_REF]. Let k = 1, . . . , n box index every ground-truth box in D cal that was detected by f , disregarding their source image. Let Y k = (x k min , y k min , x k max , y k max ) be the coordinates of the k-th box and Y k = (x k min , ŷk min , xk max , ŷk max ) its prediction.

Figure 3 :

 3 Figure 3: Bounding boxes as predicted by the ML predictor (blue), their conformalized version with multiplicative scores (green) and the ground truth (red). Example of images used in conformalization and testing, cropped for readability.

Table 2 :

 2 Comparing models via AP for two IoU threshold levels.

† : v5s and v5x respectively correspond to a small and a large configurations of YOLOv5.

Table 3 :

 3 Conformalization margins on DiffusionDet. * : average increase in the area of the boxes after conformalization. : fraction of w or h. multiplicative quantiles which are qualitatively different, we report the stretch: the ratio of the areas of the conformalized and predicted boxes. We display examples of additive and multiplicative conformalized boxes respectively on Figure 2 and Figure 3.

† : pixels; ‡

Table 4 :

 4 Empirical coverage before and after conformaliza-

		That is, conformalization is not a
	substitute for careful training and fine-tuning of a detection
	architecture, but a complementary tool for certification.
	The interest of capturing the whole box can be opera-
	CP method	None Additive Multiplicative
	Empirical coverage 0.106	0.921	0.894

tion, nominal coverage: 1 -α = 0.90. This replies to: "how many true boxes, when detected, were entirely covered by the predicted box?"