11institutetext: BCN Medtech, Universitat Pompeu Fabra, Barcelona, Spain,
11email<EMAIL_ADDRESS>22institutetext: AIML,
University of Adelaide, Australia, 22email<EMAIL_ADDRESS>33institutetext: University of Surrey, Guildford, UK, 33email:
<EMAIL_ADDRESS>44institutetext: Catalan Institution for Research and
Advanced Studies (ICREA), Barcelona, Spain

# Multi-Head Multi-Loss Model Calibration

Adrian Galdran${}^{\textrm{,{\char 0\relax}}}$ 1122 Johan Verjans 22
Gustavo Carneiro 22 Miguel A. González Ballester 1133

###### Abstract

Delivering meaningful uncertainty estimates is essential for a successful
deployment of machine learning models in the clinical practice. A central
aspect of uncertainty quantification is the ability of a model to return
predictions that are well-aligned with the actual probability of the model
being correct, also known as model calibration. Although many methods have
been proposed to improve calibration, no technique can match the simple, but
expensive approach of training an ensemble of deep neural networks. In this
paper we introduce a form of simplified ensembling that bypasses the costly
training and inference of deep ensembles, yet it keeps its calibration
capabilities. The idea is to replace the common linear classifier at the end
of a network by a set of heads that are supervised with different loss
functions to enforce diversity on their predictions. Specifically, each head
is trained to minimize a weighted Cross-Entropy loss, but the weights are
different among the different branches. We show that the resulting averaged
predictions can achieve excellent calibration without sacrificing accuracy in
two challenging datasets for histopathological and endoscopic image
classification. Our experiments indicate that Multi-Head Multi-Loss
classifiers are inherently well-calibrated, outperforming other recent
calibration techniques and even challenging Deep Ensembles’ performance. Code
to reproduce our experiments can be found at
https://github.com/agaldran/mhml_calibration .

###### Keywords:

Model Calibration Uncertainty Quantification

##  1 Introduction and Related Work

When training supervised computer vision models, we typically focus on
improving their predictive performance, yet equally important for safety-
critical tasks is their ability to express meaningful uncertainties about
their own predictions [4]. In the context of machine learning, we often
distinguish two types of uncertainties: epistemic and aleatoric [13]. Briefly
speaking, epistemic uncertainty arises from imperfect knowledge of the model
about the problem it is trained to solve, whereas aleatoric uncertainty
describes ignorance regarding the data used for learning and making
predictions. For example, if a classifier has learned to predict the presence
of cancerous tissue on a colon histopathology, and it is tasked with making a
prediction on a breast biopsy it may display epistemic uncertainty, as it was
never trained for this problem [21]. Nonetheless, if we ask the model about a
colon biopsy with ambiguous visual content, i.e. a hard-to-diagnose image,
then it could express aleatoric uncertainty, as it may not know how to solve
the problem, but the ambiguity comes from the data. This distinction between
epistemic and aleatoric is often blurry, because the presence of one of them
does not imply the absence of the other [12]. Also, under strong epistemic
uncertainty, aleatoric uncertainty estimates can become unreliable [31].

Producing good uncertainty estimates can be useful, e.g. to identify test
samples where the model predicts with little confidence and which should be
reviewed [1]. A straightforward way to report uncertainty estimates is by
interpreting the output of a model (maximum of its softmax probabilities) as
its predictive confidence. When this confidence aligns with the actual
accuracy we say that the model is calibrated [8]. Model calibration has been
studied for a long time, with roots going back to the weather forecasting
field [3]. Initially applied mostly for binary classification systems [7], the
realization that modern neural networks tend to predict over-confidently [10]
has led to a surge of interest in recent years [8]. Broadly speaking, one can
attempt to promote calibration during training, by means of a post-processing
stage, or by model ensembling.

##### Training-Time Calibration

Popular training-time approaches consist of reducing the predictive entropy by
means of regularization [11], e.g. Label Smoothing [27] or MixUp [30], or loss
functions that smooth predictions [25]. These techniques often rely on
correctly tuning a hyper-parameter controlling the trade-off between
discrimination ability and confidence, and can easily achieve better
calibration at the expense of decreasing predictive performance [22]. Examples
of medical image analysis works adopting this approach are Difference between
Confidence and Accuracy regularization [20] for medical image diagnosis, or
Spatially-Varying and Margin-Based Label Smoothing [14, 26], which extend and
improve Label Smoothing for biomedical image segmentation tasks.

##### Post-Hoc Calibration

Post-hoc calibration techniques like Temperature Scaling [10] and its variants
[6, 15] have been proposed to correct over or under-confident predictions by
applying simple monotone mappings (fitted on a held-out subset of the training
data) on the output probabilities of the model. Their greatest shortcoming is
the dependence on the i.i.d. assumption implicitly made when using validation
data to learn the mapping: these approaches suffer to generalize to unseen
data [28]. Other than that, these techniques can be combined with training-
time methods and return compounded performance improvements.

##### Model Ensembling

A third approach to improve calibration is to aggregate the output of several
models, which are trained beforehand so that they have some diversity in their
predictions [5]. In deep learning, model ensembles are considered to be the
most successful method to generate meaningful uncertainty estimates [16]. An
obvious weakness of deep ensembles is the requirement of training and then
keeping for inference purposes a set of models, which results in a
computational overhead that can be considerable for larger architectures.
Examples of applying ensembling in medical image computing include [17, 24].

In this work we achieve model calibration by means of multi-head models
trained with diverse loss functions. In this sense, our approach is closest to
some recent works on multi-output architectures like [21], where a multi-
branch CNN is trained on histopathological data, enforcing specialization of
the different heads by backpropagating gradients through branches with the
lowest loss. Compared to our approach, ensuring correct gradient flow to avoid
dead heads requires ad-hoc computational tricks [21]; in addition, no analysis
on model calibration on in-domain data or aleatoric uncertainty was developed,
focusing instead on anomaly detection. Our main contribution is a multi-head
model that I) exploits multi-loss diversity to achieve greater confidence
calibration than other learning-based methods, while II) avoiding the use of
training data to learn post-processing mappings as most post-hoc calibration
methods do, and III) sidesteping the computation overhead of deep ensembles.

##  2 Calibrated Multi-Head Models

In this section we formally introduce multi-head models [19], and justify the
need for enforcing diversity on them. Detailed derivations of all the results
below are provided in the online supplementary materials.

###  2.1 Multi-Head Ensemble Diversity

Consider a $K$-class classification problem, and a neural network $U_{\theta}$
taking an image $\mathbf{x}$ and mapping it onto a representation
$U_{\theta}(\mathbf{x})\in\mathbb{R^{N}}$, which is linearly transformed by
$f$ into a logits vector
$\mathbf{z}=f(U_{\theta}(\mathbf{x}))\in\mathbb{R^{K}}$. This is then mapped
into a vector of probabilities $\mathbf{p}\in[0,1]^{K}$ by a softmax operation
$\mathbf{p}=\sigma(\mathbf{z})$, where $p_{j}=e^{z_{j}}/\sum_{i}e^{z_{i}}$. If
the label of $\mathbf{x}$ was $y\in\\{1,...,K\\}$, we can measure the error
associated to prediction $\mathbf{p}$ with the cross-entropy loss
$\mathcal{L}_{\textrm{CE}}(\mathbf{p},y)=-\log(p_{y})$.

We now wish to implement a multi-head ensemble model like the one shown in
Fig. 1. For this, we replace $f$ by $M$ different branches $f^{1},...,f^{M}$,
each of them still taking the same input but mapping it to different logits
$\mathbf{z}^{m}=f^{m}(U_{\theta}(\mathbf{x}))$. The resulting probability
vectors $\mathbf{p}^{m}=\sigma(\mathbf{z}^{m})$ are then averaged to obtain a
final prediction $\mathbf{p}^{\mu}=(1/M)\sum_{m}\mathbf{p}^{m}$. We are
interested in backpropagating the loss
$\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)=-\log(p^{\mu}_{y})$ to find the
gradient at each branch,
$\nabla_{\mathbf{z}^{m}}\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)$.

Figure 1: A multi-head multi-loss model with $M$=2 heads. An image
$\mathbf{x}$ goes through a neural network $\mathcal{U}_{\theta}$ and then is
linearly transformed by $M$ heads $\\{f^{m}\\}_{m=1}^{M}$, followed by softmax
operations $\sigma$, into probability vectors
$\\{\mathbf{p}^{m}\\}_{m=1}^{M}$. The final loss $\mathcal{L}_{\textrm{MH}}$
is the sum of per-head weighted-CE losses
$\mathcal{L}_{\bm{\omega}^{m}\textrm{-CE}}(\mathbf{p}^{m},y)$ and the CE loss
$\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)$ of the average prediction
$\mathbf{p}^{\mu}=\mu(\mathbf{p}^{1},...,\mathbf{p}^{m})$. We modify the
weights $\bm{\omega}^{m}$ between branches to achieve more diverse gradients
during training.

##### Property 1:

For the M-head classifier in Fig. 1, the derivative of the cross-entropy loss
at head $f^{m}$ with respect to $\mathbf{z}^{m}$ is given by

$\nabla_{\mathbf{z}^{m}}\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)=\frac{p_{y}^{m}}{\sum_{i}p_{y}^{i}}(\mathbf{p}^{\mu}-\mathbf{y}),$
(1)

where $\mathbf{y}$ is a one-hot representation of the label $y$.

From eq. (1) we see that the gradient in branch $m$ will be scaled depending
on how much probability mass $p_{y}^{m}$ is placed by $f^{m}$ on the correct
class relative to the total mass placed by all heads. In other words, if every
head learned to produce a similar prediction (not necessarily correct) for a
particular sample, then the optimization process of this network would result
in the same updates for all of them. As a consequence, diversity in the
predictions that make up the output $\mathbf{p}^{\mu}$ of the network would be
damaged.

###  2.2 Multi-Head Multi Loss Models

In view of the above, one way to obtain more diverse gradient updates in a
multi-head model during training could be to supervise each head with a
different loss function. To this end, we will apply the weighted cross-entropy
loss, given by
$\mathcal{L}_{\bm{\omega}\textrm{-CE}}(\mathbf{p},y)=-\omega_{y}\log(p^{\mu}_{y})$,
where $\bm{\omega}\in\mathbb{R}^{K}$ is a weight vector. In our case, we
assign to each head a different weight vector $\bm{\omega}^{m}$ (as detailed
below), in such a way that a different loss function
$\mathcal{L}_{\bm{\omega^{m}}\textrm{-CE}}$ will supervise the intermediate
output of each branch $f^{m}$, similar to deep supervision strategies [18] but
enforcing diversity. The total loss of the complete model is the addition of
the per-head losses and the overall loss acting on the average prediction:

$\mathcal{L}_{\textrm{MH}}(\mathbf{p},y)=\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)+\sum_{m=1}^{M}\mathcal{L}_{\bm{\omega}^{m}\textrm{-CE}}(\mathbf{p}^{m},y),$
(2)

where $\mathbf{p}=(\mathbf{p}^{1},...,\mathbf{p}^{M})$ is an array collecting
all the predictions the network makes. Since
$\mathcal{L}_{\bm{\omega}\textrm{-CE}}$ results from just multiplying by a
constant factor the conventional CE loss, we can readily calculate the
gradient of $\mathcal{L}_{\textrm{MH}}$ at each branch.

##### Property 2:

For the Multi-Loss Multi-Head classifier shown in Fig. 1, the gradient of the
Multi-Head loss $\mathcal{L}_{\textrm{MH}}$ at branch $f^{m}$ is given by:

$\nabla_{\mathbf{z}^{m}}\mathcal{L}_{\textrm{MH}}(\mathbf{p},y)=\left(\omega_{y}^{m}+\frac{p_{y}^{m}}{\sum_{i}p_{y}^{i}}\right)(\mathbf{p}^{\mu}-\mathbf{y}).$
(3)

Note that having equal weight vectors in all branches fails to break the
symmetry in the scenario of all heads making similar predictions. Indeed, if
for any two given heads $f^{m_{i}},f^{m_{j}}$ we have
$\bm{\omega}^{m_{i}}=\bm{\omega}^{m_{j}}$ and
$\mathbf{p}^{m_{i}}\approx\mathbf{p}^{m_{j}}$, i.e.
$\mathbf{p}^{m}\approx\mathbf{p}^{\mu}\ \forall m$, then the difference in
norm of the gradients of two heads would be:

$\displaystyle\|\nabla_{\mathbf{z}^{m_{i}}}\mathcal{L}_{\textrm{MH}}(\mathbf{p},y)-\nabla_{\mathbf{z}^{m_{j}}}\mathcal{L}_{\textrm{MH}}(\mathbf{p},y)\|_{1}\approx|\omega_{y}^{m_{i}}-\omega_{y}^{m_{j}}|\cdot\|\mathbf{p}^{\mu}-\mathbf{y}\|_{1}=0.$
(4)

It follows that we indeed require a different weight in each branch. In this
work, we design a weighting scheme to enforce the specialization of each head
into a particular subset of the categories $\\{c_{1},...,c_{K}\\}$ in the
training set.

We first assume that the multi-head model has less branches than the number of
classes in our problem, i.e. $M\leq K$, as otherwise we would need to have
different branches specializing in the same category. In order to construct
the weight vector $\bm{\omega}^{m}$, we associate to branch $f^{m}$ a subset
of $N/K$ categories, randomly selected, for specialization, and these are
weighed with $\omega^{m}_{j}=K$. Then, the remaining categories in
$\bm{\omega}^{m}$ receive a weight of $\omega^{m}_{j}=1/K$. For example, in a
problem with $4$ categories and $2$ branches, we could have
$\bm{\omega}^{1}=[2,\nicefrac{{1}}{{2}},2,\nicefrac{{1}}{{2}}]$ and
$\bm{\omega}^{2}=[\nicefrac{{1}}{{2}},2,\nicefrac{{1}}{{2}},2]$. If $N$ is not
divisible by $K$, the reminder categories are assigned for specialization to
random branches.

###  2.3 Model Evaluation

When measuring model calibration, the standard approach relies on observing
the test set accuracy at different confidence bands $B$. For example, taking
all test samples that are predicted with a confidence around $c=0.8$, a well-
calibrated classifier would show an accuracy of approximately $80\%$ in this
test subset. This can be quantified by the Expected Calibration Error (ECE),
given by:

$\mathrm{ECE}=\sum_{s=1}^{N}\frac{|B_{s}|}{N}|\mathrm{acc}(B_{s})-\mathrm{conf}(B_{s})|,$
(5)

where $\bigcup_{s}B_{s}$ form a uniform partition of the unit interval, and
$\mathrm{acc}(B_{s})$, $\mathrm{conf}(B_{s})$ are accuracy and average
confidence (maximum softmax value) for test samples predicted with confidence
in $B_{s}$.

In practice, the ECE alone is not a good measure in terms of practical
usability, as one can have a perfectly ECE-calibrated model with no predictive
power [29]. A binary classifier in a balanced dataset, randomly predicting
always one class with $c=0.5+\epsilon$ confidence, has a perfect calibration
and $50\%$ accuracy. Proper Scoring Rules like Negative Log-Likelihood (NLL)
or the Brier score are alternative uncertainty quality metrics [9] that
capture both discrimination ability and calibration: a model must be both
accurate and calibrated to achieve a low PSR value. We report NLL, and also
standard Accuracy, which contrary to ECE can be high even for badly-calibrated
models. Finally, we show as summary metric the average rank when aggregating
rankings of ECE, NLL, and accuracy.

##  3 Experimental Results

We now describe the data we used for experimentation, carefully analyze
performance for each dataset, and end up with a discussion of our findings.

###  3.1 Datasets and Architectures

We conducted experiments on two datasets: 1) the Chaoyang
dataset111https://bupt-ai-cz.github.io/HSA-NRL/, which contains colon
histopathology images. It has 6,160 images unevenly distributed in 4 classes
(29%, 19%, 37%, 15%), with some amount of label ambiguity, reflecting high
aleatoric uncertainty. As a consequence, the best model in the original
reference [33], applying specific techniques to deal with label noise,
achieved an accuracy of 83.4%. 2) Kvasir222https://datasets.simula.no/hyper-
kvasir/, a dataset for the task of endoscopic image classification. The
annotated part of this dataset contains 10,662 images, and it represents a
challenging classification problem due a high amount of classes (23) and
highly imbalanced class frequencies [2]. For the sake of readability we do not
show measures of dispersion, but we add them to the supplementary material
(Appendix C), together with further experiments on other datasets.

We implement the proposed approach by optimizing several popular neural
network architectures, namely a common ResNet50 and two more recent models: a
ConvNeXt [23] and a Swin-Transformer [23]. All models are trained for 50
epochs, which was observed enough for convergence, using Stochastic Gradient
Descent with a learning rate of $l=1e$-$2$. Code to reproduce our results and
hyperparameter specifications are shared at github.com/withheld.

###  3.2 Performance Analysis

#### Notation:

We train three different multi-head classifiers: 1) a 2-head model where each
head optimizes for standard (unweighted) CE, referred to as 2HSL (2 Heads-
Single Loss); 2) a 2-head model but with each head minimizing a differently
weighed CE loss as described in section 2.2. We call this model 2HML (2 Heads-
Multi Loss)); 3) Finally, we increase the number of heads to four, and we
refer to this model as 4HML. For comparison, we include a standard single-loss
one-head classifier (SL1H), plus models trained with Label Smoothing (LS
[27]), Margin-based Label Smoothing (MbLS [22]), MixUp [30], and using the DCA
loss [20]. We also show the performance of Deep Ensembles (D-Ens [16]). We
analyze the impact of Temperature Scaling [10] in the appendix B.

What we expect to see: Multi-Head Multi-Loss models should achieve a better
calibration (_low ECE_) than other learning-based methods, ideally approaching
Deep Ensembles calibration. We also expect to achieve good calibration without
sacrificing predictive performance (_high accuracy_). Both goals would be
reflected jointly by a _low NLL_ value, and by a _better aggregated ranking_.
Finally we would ideally observe improved performance as we increase the
diversity (comparing 2HSL to 2HML) and as we add heads (comparing 2HML to
4HML).

#### Chaoyang:

In Table 1 we report the results on the Chaoyang dataset. Overall, accuracy is
relatively low, since this dataset is challenging due to label ambiguity, and
therefore calibration analysis of aleatoric uncertainty becomes meaningful
here. As expected, we see how Deep Ensembles are the most accurate method,
also with the lowest NLL, for two out of the three considered networks.
However, we also observe noticeable differences between other learning-based
calibration techniques and multi-head architectures. Namely, all other
calibration methods achieve lower ECE than the baseline (SL1H) model, but at
the cost of a reduced accuracy. This is actually captured by NLL and rank,
which become much higher for these approaches. In contrast, 4HML achieves the
second rank in two architectures, only behind Deep Ensembles when using a
ResNet50 and a Swin-Transformer, and above any other 2HML with a ConvNeXt,
even outperforming Deep Ensembles in this case. Overall, we can see a pattern:
multi-loss multi-head models appear to be extremely well-calibrated (low ECE
and NLL values) without sacrificing accuracy, and as we diversify the losses
and increase the number of heads we tend to improve calibration.

| ResNet50 | ConvNeXt | Swin-Transformer
---|---|---|---
| ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓
SL1H | 80.71 | 5.79 | 53.46 | 6.0 | 81.91 | 6.94 | 50.98 | 6.3 | 83.09 | 8.73 | 52.75 | 5.0
LS | 74.81 | 2.55 | 64.27 | 6.7 | 79.59 | 6.13 | 55.65 | 7.3 | 79.76 | 3.98 | 55.37 | 6.0
MbLS | 75.02 | 3.26 | 63.86 | 6.7 | 79.53 | 2.94 | 53.44 | 5.3 | 80.24 | 5.06 | 54.18 | 5.7
MixUp | 76.00 | 3.67 | 62.72 | 6.3 | 79.95 | 6.20 | 55.58 | 7.0 | 80.25 | 3.89 | 54.62 | 4.7
DCA | 76.17 | 5.75 | 62.13 | 6.7 | 78.28 | 3.69 | 57.78 | 7.3 | 79.12 | 7.91 | 59.91 | 8.3
D-Ens | 82.19 | 2.42 | 46.64 | 1.0 | 82.98 | 5.21 | 46.08 | 3.3 | 83.50 | 6.79 | 44.80 | 2.7
2HSL | 80.97 | 4.36 | 51.42 | 4.0 | 81.94 | 4.30 | 46.71 | 4.3 | 82.90 | 8.20 | 54.19 | 5.7
2HML | 80.28 | 4.49 | 51.86 | 5.3 | 81.97 | 3.66 | 45.96 | 2.7 | 82.79 | 5.01 | 46.12 | 3.7
4HML | 81.13 | 3.09 | 49.44 | 2.3 | 82.17 | 1.79 | 44.73 | 1.3 | 82.89 | 4.80 | 46.70 | 3.3
Table 1: Results on the Chaoyang dataset with different architectures and
strategies. For each model, best and second best ranks are marked.

#### Kvasir:

Next, we show in Table 2 results for the Kvasir dataset. Deep Ensembles again
reach the highest accuracy and excellent calibration. Interestingly, methods
that smooth labels (LS, MbLS, MixUP) show a strong degradation in calibration
and their ECE is often twice the ECE of the baseline SL1H model. We attribute
this to class imbalance and the large number of categories: smoothing labels
might be ineffective in this scenario. Note that models minimizing the DCA
loss do manage to bring the ECE down, although by giving up accuracy. In
contrast, all multi-head models improve calibration while maintaining
accuracy. Remarkably, 4HML obtains lower ECE than Deep Ensembles in all cases.
Also, for two out of the three architectures 4HML ranks as the best method,
and for the other one 2HML reaches the best ranking.

| ResNet50 | ConvNeXt | Swin-Transformer
---|---|---|---
| ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓
OneH | 89.87 | 6.32 | 41.88 | 5.3 | 90.02 | 5.18 | 35.59 | 5.0 | 90.07 | 5.81 | 38.01 | 5.7
LS | 88.13 | 14.63 | 53.96 | 7.7 | 88.24 | 6.97 | 42.09 | 6.7 | 88.74 | 9.20 | 43.46 | 8.7
MbLS | 88.20 | 16.92 | 57.48 | 8.0 | 88.62 | 8.55 | 43.07 | 7.0 | 89.15 | 8.19 | 41.85 | 7.7
MixUp | 87.60 | 10.28 | 50.69 | 7.3 | 87.58 | 8.96 | 48.88 | 8.7 | 89.23 | 2.11 | 35.52 | 4.3
DCA | 87.14 | 3.84 | 40.50 | 6.0 | 85.27 | 4.11 | 46.78 | 7.3 | 87.62 | 4.38 | 38.44 | 7.3
D-Ens | 90.76 | 3.83 | 32.09 | 2.3 | 90.76 | 3.34 | 29.74 | 3.0 | 90.53 | 3.94 | 29.36 | 3.3
2HSL | 89.76 | 4.52 | 34.34 | 4.7 | 90.21 | 2.63 | 28.69 | 2.7 | 90.40 | 3.65 | 29.14 | 3.0
2HML | 90.05 | 3.62 | 31.37 | 2.0 | 89.92 | 1.49 | 28.15 | 2.7 | 90.19 | 2.73 | 28.66 | 2.7
4HML | 89.99 | 2.22 | 30.02 | 1.7 | 90.10 | 1.65 | 28.01 | 2.0 | 90.00 | 1.82 | 27.96 | 2.3
Table 2: Results on the Kvasir dataset with different architectures and
strategies. For each model, best and second best ranks are marked.

##  4 Conclusion

Multi-Head Multi-Loss networks are classifiers with enhanced calibration and
no degradation of predictive performance when compared to their single-head
counterparts. This is achieved by simultaneously optimizing several output
branches, each one minimizing a differently weighted Cross-Entropy loss.
Weights are complementary, ensuring that each branch is rewarded for becoming
specialized in a subset of the original data categories. Comprehensive
experiments on two challenging datasets with three different neural networks
show that Multi-Head Multi-Loss models consistently outperform other learning-
based calibration techniques, matching and sometimes surpassing the
calibration of Deep Ensembles.

## Acknowledgments

This work was supported by a Marie Sk lodowska-Curie Fellowship (No 892297)
and by Australian Research Council grants (DP180103232 and FT190100525).

## References

  * [1] Bernhardt, M., Ribeiro, F.D.S., Glocker, B.: Failure Detection in Medical Image Classification: A Reality Check and Benchmarking Testbed. Transactions on Machine Learning Research (2022)
  * [2] Borgli, H., et al.: HyperKvasir, a comprehensive multi-class image and video dataset for gastrointestinal endoscopy. Scientific Data 7(1), 283 (Aug 2020). https://doi.org/10.1038/s41597-020-00622-y
  * [3] Brier, G.W.: Verification of Forecasts Expressed in Terms of Probability. Monthly Weather Review 78, 1 (Jan 1950)
  * [4] Chua, M., Kim, D., Choi, J., Lee, N.G., Deshpande, V., Schwab, J., Lev, M.H., Gonzalez, R.G., Gee, M.S., Do, S.: Tackling prediction uncertainty in machine learning for healthcare. Nature Biomedical Engineering pp. 1–8 (Dec 2022). https://doi.org/10.1038/s41551-022-00988-x
  * [5] Dietterich, T.G.: Ensemble Methods in Machine Learning. In: Multiple Classifier Systems (2000). https://doi.org/10.1007/3-540-45014-9_1
  * [6] Ding, Z., Han, X., Liu, P., Niethammer, M.: Local temperature scaling for probability calibration. In: ICCV (2021)
  * [7] Ferrer, L.: Analysis and Comparison of Classification Metrics (Sep 2022). https://doi.org/10.48550/arXiv.2209.05355
  * [8] Filho, T.S., Song, H., Perello-Nieto, M., Santos-Rodriguez, R., Kull, M., Flach, P.: Classifier Calibration: How to assess and improve predicted class probabilities: a survey (Dec 2021). https://doi.org/10.48550/arXiv.2112.10327
  * [9] Gneiting, T., Raftery, A.E.: Strictly Proper Scoring Rules, Prediction, and Estimation. Journal of the American Statistical Association 102(477), 359–378 (Mar 2007). https://doi.org/10.1198/016214506000001437
  * [10] Guo, C., Pleiss, G., Sun, Y., Weinberger, K.Q.: On Calibration of Modern Neural Networks. In: ICML (2017)
  * [11] Hebbalaguppe, R., Prakash, J., Madan, N., Arora, C.: A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved Neural Network Calibration. In: CVPR (2022)
  * [12] Hüllermeier, E.: Quantifying Aleatoric and Epistemic Uncertainty in Machine Learning: Are Conditional Entropy and Mutual Information Appropriate Measures? (Sep 2022). https://doi.org/10.48550/arXiv.2209.03302
  * [13] Hüllermeier, E., Waegeman, W.: Aleatoric and epistemic uncertainty in machine learning: an introduction to concepts and methods. Machine Learning 110(3), 457–506 (Mar 2021). https://doi.org/10.1007/s10994-021-05946-3
  * [14] Islam, M., Glocker, B.: Spatially Varying Label Smoothing: Capturing Uncertainty from Expert Annotations. In: IPMI (2021). https://doi.org/10.1007/978-3-030-78191-0_52
  * [15] Kull, M., Perello Nieto, M., Kängsepp, M., Silva Filho, T., Song, H., Flach, P.: Beyond temperature scaling: Obtaining well-calibrated multi-class probabilities with Dirichlet calibration. In: NeurIPS (2019)
  * [16] Lakshminarayanan, B., Pritzel, A., Blundell, C.: Simple and Scalable Predictive Uncertainty Estimation using Deep Ensembles. In: NeurIPS (2017)
  * [17] Larrazabal, A.J., Martínez, C., Dolz, J., Ferrante, E.: Orthogonal Ensemble Networks for Biomedical Image Segmentation. In: MICCAI (2021). https://doi.org/10.1007/978-3-030-87199-4_56
  * [18] Lee, C.Y., Xie, S., Gallagher, P., Zhang, Z., Tu, Z.: Deeply-Supervised Nets. In: AISTATS (2015)
  * [19] Lee, S., Purushwalkam, S., Cogswell, M., Crandall, D., Batra, D.: Why M Heads are Better than One: Training a Diverse Ensemble of Deep Networks (Nov 2015). https://doi.org/10.48550/arXiv.1511.06314
  * [20] Liang, G., Zhang, Y., Wang, X., Jacobs, N.: Improved Trainable Calibration Method for Neural Networks on Medical Imaging Classification. In: British Machine Vision Conference (BMVC) (2020)
  * [21] Linmans, J., Elfwing, S., van der Laak, J., Litjens, G.: Predictive uncertainty estimation for out-of-distribution detection in digital pathology. Medical Image Analysis (Jan 2023). https://doi.org/10.1016/j.media.2022.102655
  * [22] Liu, B., Ben Ayed, I., Galdran, A., Dolz, J.: The Devil Is in the Margin: Margin-Based Label Smoothing for Network Calibration. In: CVPR (2022)
  * [23] Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., Guo, B.: Swin Transformer: Hierarchical Vision Transformer using Shifted Windows. In: ICCV (Oct 2021). https://doi.org/10.1109/ICCV48922.2021.00986
  * [24] Ma, W., Chen, C., Zheng, S., Qin, J., Zhang, H., Dou, Q.: Test-Time Adaptation with Calibration of Medical Image Classification Nets for Label Distribution Shift. In: MICCAI (2022). https://doi.org/10.1007/978-3-031-16437-8_30
  * [25] Mukhoti, J., Kulharia, V., Sanyal, A., Golodetz, S., Torr, P., Dokania, P.: Calibrating Deep Neural Networks using Focal Loss. In: NeurIPS (2020)
  * [26] Murugesan, B., Liu, B., Galdran, A., Ayed, I.B., Dolz, J.: Calibrating Segmentation Networks with Margin-based Label Smoothing (Sep 2022). https://doi.org/10.48550/arXiv.2209.09641
  * [27] Müller, R., Kornblith, S., Hinton, G.E.: When does label smoothing help? In: NeurIPS (2019)
  * [28] Ovadia, Y., Fertig, E., Ren, J., Nado, Z., Sculley, D., Nowozin, S., Dillon, J., Lakshminarayanan, B., Snoek, J.: Can you trust your model’ s uncertainty? Evaluating predictive uncertainty under dataset shift. In: NeurIPS (2019)
  * [29] Reinke, A., et al.: Understanding metric-related pitfalls in image analysis validation (Feb 2023). https://doi.org/10.48550/arXiv.2302.01790
  * [30] Thulasidasan, S., Chennupati, G., Bilmes, J.A., Bhattacharya, T., Michalak, S.: On Mixup Training: Improved Calibration and Predictive Uncertainty for Deep Neural Networks. In: NeurIPS (2019)
  * [31] Valdenegro-Toro, M., Mori, D.S.: A Deeper Look Into Aleatoric and Epistemic Uncertainty Disentanglement. In: CVPR Workshops (2022)
  * [32] Yang, J., Shi, R., Ni, B.: MedMNIST Classification Decathlon: A Lightweight AutoML Benchmark for Medical Image Analysis. In: ISBI (2021)
  * [33] Zhu, C., Chen, W., Peng, T., Wang, Y., Jin, M.: Hard Sample Aware Noise Robust Learning for Histopathology Image Classification. IEEE Transactions on Medical Imaging 41(4), 881–894 (Apr 2022). https://doi.org/10.1109/TMI.2021.3125459

##  Appendix A Gradient Derivations

In sections 2.1 and 2.2, we referred to the gradients for the M-head model and
its extension with “deep supervision” on each head by a weighted CE loss. Here
we provide careful step-by-step derivation of these quantities.

We start by going over our notation. We have a neural network $U_{\theta}$
that maps an image $\mathbf{x}$ into a vector of representations in
$U_{\theta}(\mathbf{x})\in\mathbb{R^{N}}$. In a standard model, this feature
vector would then be passed through a linear classifier, composed of a linear
mapping $f\mathrel{\mathop{\mathchar
58\relax}}\mathbb{R^{N}}\rightarrow\mathbb{R^{K}}$ followed by a softmax
operation $\sigma$. The intermediate vector
$\mathbf{z}=f(U_{\theta}(\mathbf{x}))\in\mathbb{R^{K}}$ is often called logits
vector, and the final vector $\mathbf{p}=\sigma(\mathbf{z})$, whose components
are $p_{j}=e^{-z_{j}}/\sum_{i}e^{-z_{i}}$, can be regarded as a “probability
vector”, indicating the likelihood of each category.

Suppose $\mathbf{x}$ has a label $y\in\\{1,...,K\\}$. In order to measure the
classification error of the above model, we can use the Cross-Entropy (CE)
loss, given by $\mathcal{L}_{\textrm{CE}}(\mathbf{p},y)=-\log(p_{y})$, that
is, we attempt to maximize the probability assignment at the $y$-th component
in $\mathbf{p}$, regardless of the values elsewhere in $\mathbf{p}$. We are
interested in the gradient that reaches the linear mapping in this model when
we backpropagate the CE loss. Since this only depends on that component, we
consider only the partial derivative at $p_{y}$, which we can find by
application of the chain rule:

$\frac{\partial\mathcal{L}_{\textrm{CE}}(p_{y},y)}{\partial
z_{j}}=\frac{\partial\mathcal{L}_{\textrm{CE}}(p_{y},y)}{\partial
p_{y}}\cdot\frac{\partial p_{y}}{\partial z_{j}}=\frac{-1}{p_{y}}\cdot
p_{y}\cdot(\delta_{y}^{j}-p_{j})=p_{j}-\delta_{y}^{j},$

where $\delta_{y}^{j}=0$ unless we are computing the partial derivative with
respect to the logit of the correct class, in which case $\delta_{y}^{j}=1$.
Therefore the complete gradient can now be written as:

$\nabla_{\mathbf{z}}\mathcal{L}_{\textrm{CE}}(\mathbf{p},y)=[\,p_{1},p_{2},...,p_{y}-1,...,p_{K}\,]=\mathbf{p}-\mathbf{y}$
(6)

where $\mathbf{y}=[\,0,...,1^{(k)},...0\,]\in\mathbb{R}^{K}$ is a one-hot
representation of label $y$. In what follows, to avoid cumbersome notation, we
will omit the point at which the partial derivatives are evaluated, hoping it
will be clear from the context.

Next, we want to extend this basic architecture into a multi-head ensemble. In
this case, the single linear classifier above is replaced by $M$ branches
$f^{1},...,f^{M}$ that map $\mathbf{x}$ into $M$ logit vectors
$\mathbf{z}_{1},...,\mathbf{z}_{M}$, which are then passed through a softmax
layer that turns them into “probability vectors”
$\mathbf{p}^{m}=\sigma(\mathbf{z}^{m})$. In this multi-head architecture,
these vectors are then averaged into a single prediction
$\mathbf{p}^{\mu}=\mu(\mathbf{p}_{1},...,\mathbf{p}_{M})=(\mathbf{p}_{1}+...+\mathbf{p}_{M})/M$
and the loss $\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)$ is computed. An
example of this model is shown in Fig. 2 below.

Figure 2: Schematic illustration of a multi-head model for $M$=2 heads.

We can now derive the gradient reaching a linear layer $f^{m}$ (with respect
to the logits $\mathbf{z}^{m}$) when we backpropagate the loss. Again the loss
at $\mathbf{p}^{\mu}$ only depends on the component $p_{y}^{\mu}$ of the
correct category, as follows:

$\frac{\partial\mathcal{L}_{\textrm{CE}}}{\partial
z^{m}_{j}}=\frac{\partial\mathcal{L}_{\textrm{CE}}}{\partial
p_{y}^{\mu}}\cdot\frac{\partial p_{y}^{\mu}}{\partial
p_{y}^{m}}\cdot\frac{\partial p_{y}^{m}}{\partial
z_{j}^{m}}=\frac{-1}{p_{y}^{\mu}}\cdot\frac{1}{M}\cdot
p_{y}^{m}\cdot(\delta_{y}^{j}-p^{m}_{j})=\frac{p_{y}^{m}}{\sum_{i}p_{y}^{i}}\cdot(p_{j}^{m}-\delta_{y}^{j}),$

so the gradient would be given by eq. (1) in the paper, this is:

$\nabla_{\mathbf{z}^{m}}\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)=\frac{p_{y}^{m}}{\sum_{i}p_{y}^{i}}(\mathbf{p}^{m}-\mathbf{y}),$

which tells us that the gradient in eq. (6) is scaled, for branch $f^{m}$, by
how high is $p_{y}^{m}$ relative to the sum over all heads of the probability
of the correct class.

Figure 3: Multi-head model ($M$=2 heads) with additional supervision at each
head.

In addition to using only supervision on the average prediction
$\mathbf{p}^{\mu}$ by backpropagating
$\mathcal{L}_{\textrm{CE}}^{\mu}(p_{y}^{\mu},y)$, we can add supervision to
each individual head via an additional CE loss $\mathcal{L}^{m}_{\textrm{CE}}$
at each branch’s prediction $\mathbf{p}^{m}$, as shown in Fig. 3.

In this case, the final loss to be backpropagated is the addition of all
losses:

$\mathcal{L}_{all}(\mathbf{p},y)=\mathcal{L}_{\textrm{CE}}^{\mu}(\mathbf{p}^{\mu},y)+\sum_{m}\mathcal{L}^{m}_{\textrm{CE}}(\mathbf{p}^{m},y),$
(7)

where $\mathbf{p}=[\,\mathbf{p}^{1},...,\mathbf{p}^{M}\,]$ is an array
gathering the predictions of all $M$ heads.

We can then apply the sum rule to quickly find out the derivative of this loss
at branch $f^{m}$ with respect to the logits $\mathbf{z}^{m}$, since only the
loss on the average prediction $\mathbf{p}^{\mu}$ and the one on
$\mathbf{p}^{m}$ will contribute to it:

$\frac{\partial\mathcal{L}_{\textrm{all}}}{\partial
z^{m}_{j}}=\frac{\partial\mathcal{L}_{\textrm{CE}}^{\mu}}{\partial
z^{m}_{j}}+\frac{\mathcal{L}^{m}_{\textrm{CE}}}{\partial
z^{m}_{j}}=(\frac{p^{m}_{y}}{\sum_{i}p_{y}^{i}}+1)\cdot(p_{j}^{m}-\delta_{y}^{j}),$

or in other words:

$\nabla_{\mathbf{z}^{m}}\mathcal{L}_{all}(\mathbf{p},y)=(1+\frac{p^{m}_{y}}{\sum_{i}p^{i}_{y}})(\mathbf{p}^{m}-\mathbf{y}).$

In the paper we use the weighted variant of the CE loss for supervising the
predictions of each head. This loss is given by
$\mathcal{L}_{\bm{\omega}\textrm{-CE}}(\mathbf{p},y)=-\omega_{y}\log(p_{y})$,
where we have a weight vector $\bm{\omega}\in\mathbb{R}^{K}$, so the greater
the magnitude of a component $\omega_{j}$, the larger the loss assigned to
mistakes in category $j$. The $\mathcal{L}_{\bm{\omega}\textrm{-CE}}$ loss is
typically used to penalize errors in minority categories of imbalanced
classification datasets. Since
$\mathcal{L}_{\bm{\omega}\textrm{-CE}}(\mathbf{p},y)=-\omega_{y}\mathcal{L}_{\textrm{CE}}(\mathbf{p},y)$,
then $\displaystyle\frac{\partial}{\partial
z_{j}}\mathcal{L}_{\bm{\omega}\textrm{-CE}}(\mathbf{p},y)=\omega_{y}\cdot(p_{j}-\delta_{j}^{y})$
and
$\nabla_{\mathbf{z}}\mathcal{L}_{\bm{\omega}\textrm{-CE}}(\mathbf{p},y)=\omega_{y}\cdot(\mathbf{p}-\mathbf{y})$.
Introducing weighted losses in eq. (7) with different vectors
$\bm{\omega^{m}}$, our final loss function is given by:

$\mathcal{L}_{\textrm{MH}}(\mathbf{p},y)=\mathcal{L}_{\textrm{CE}}(\mathbf{p}^{\mu},y)+\sum_{m=1}^{M}\mathcal{L}_{\bm{\omega}^{m}\textrm{-CE}}(\mathbf{p}^{m},y),$

At this point, it is easy to see that the gradient of
$\mathcal{L}_{\textrm{MH}}$ is indeed:

$\nabla_{\mathbf{z}^{m}}\mathcal{L}_{\textrm{MH}}=\left(\omega_{y}^{m}+\frac{p_{y}^{m}}{\sum_{i}p_{y}^{i}}\right)(\mathbf{p}^{\mu}-\mathbf{y}).$

##  Appendix B Comparison to Temperature Scaling

In this section we analyze the impact of applying temperature scaling as a
post-processing step to each of the learning-based calibration methods
described in the main paper. It should be noted that our multi-head multi-loss
architecture is not directly amenable to this kind of post-processing. This is
because Temperature Scaling operates by learning a transformation on the
logits space, whereas our models are optimized over average softmax
probabilities of their heads. This means that in our approach we first pass
each heads’ logits through a softmax operation and then average them.
Attempting to find a temperature parameter for each individual head did not
result in a performance improvement, and so we decided to modify the output of
our model so that it would first average the logits and then pass the result
through a softmax layer, which enabled temperature fitting in the logit space.
This came at the cost of a slightly reduced performance both in terms of
accuracy and calibration, since there was a reason to first apply softmax to
each head and only then average: this ensures that the average is taken over
similarly-scaled vectors. This process explains why the performance of our
models in the two tables below is slightly worse than in the main paper.
Still, it remains interesting to analyze the impact of Temperature Scaling on
our models, as compared to the post-processing of other methods.

| ResNet50 | ConvNeXt | Swin-Transformer
---|---|---|---
| ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓
SL1H | 80.71 | 5.79 | 53.46 | 4.7 | 81.91 | 6.94 | 50.98 | 5.7 | 83.09 | 8.73 | 52.75 | 4.3
+TS | " | 2.15 | 49.96 | 2.7 | " | 2.24 | 45.47 | 3.7 | " | 1.86 | 42.54 | 1.3
2HSL | 80.24 | 5.81 | 53.40 | 5.3 | 81.92 | 5.19 | 47.31 | 4.3 | 82.74 | 6.94 | 48.73 | 4.3
+TS | " | 2.00 | 50.82 | 3.7 | " | 2.41 | 45.23 | 3.0 | " | 2.00 | 43.48 | 3.7
4HML | 81.15 | 4.03 | 50.71 | 2.7 | 82.22 | 4.37 | 46.39 | 3.0 | 82.93 | 7.86 | 51.22 | 4.3
+TS | " | 2.67 | 49.69 | 2.0 | " | 1.54 | 44.94 | 1.3 | " | 2.05 | 43.42 | 3.0
Table 3: Results on the Chaoyang dataset with/out Temperature Scaling (+TS). For each model, best and second best ranks are marked. | ResNet50 | ConvNeXt | Swin-Transformer
---|---|---|---
| ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓
SL1H | 89.87 | 6.32 | 41.88 | 5.7 | 90.02 | 5.18 | 35.59 | 5.0 | 90.02 | 5.18 | 35.59 | 5.0
+TS | " | 1.80 | 32.01 | 4.3 | " | 1.48 | 29.26 | 4.0 | " | 1.48 | 29.26 | 4.0
2HSL | 90.07 | 4.16 | 32.12 | 3.7 | 89.90 | 1.94 | 28.37 | 4.7 | 89.90 | 1.94 | 28.37 | 4.7
+TS | " | 1.45 | 29.82 | 1.3 | " | 1.45 | 28.17 | 3.3 | " | 1.45 | 28.17 | 3.3
4HML | 90.00 | 3.48 | 31.21 | 3.3 | 90.11 | 1.87 | 28.20 | 2.7 | 90.11 | 1.87 | 28.20 | 2.7
+TS | " | 1.71 | 30.11 | 2.7 | " | 1.30 | 27.97 | 1.3 | " | 1.30 | 27.97 | 1.3
Table 4: Results on the Kvasir dataset with/out Temperature Scaling. For each
model, best and second best ranks are marked.

Tables 3 and 4 show results for the Chaoyang and Kvasir datasets when
considering a single-head model and multi-head counterparts trained with the
proposed multi-loss strategy. We add the result of calibrating the temperature
of each model just below the unprocessed probabilities for an easy comparison
of post-processing impact. We can quikcly see that regardless of the
disadvantage, explained above, that Multi-Loss Multi-Head models face when
adding a post-hoc calibration layer, they are still a better choice over a
standard one-head model with tempered probabilities. In the Chaoyang dataset,
the four-head model 4HML achieves the best average ranking for two of the
three backbone architectures, and the second average ranking for the other
one, and the same happens with the Kvasir dataset. Noticeably, the 4HML
architecture was already well-calibrated prior to any post-processing. In both
datasets, the non-tempered 4HML probabilities had the second average rank in
two occasions, only improved by its own temperature calibration.

##  Appendix C Further Experimental Results

In the main paper we reported results without dispersion measures to save
space. Here we provide expanded tables that contain standard deviation over 5
runs of experiments. In addition, we add results for PathMNIST [32], a simple
dataset containing 107,180 $28\times 28$ histopathological colon images evenly
distributed in nine classes. Because this is a relatively easy dataset, most
methods achieve a similar, high accuracy, which obfuscates a bit the rankings
in Table 7. Nonetheless, we can still appreciate how the observations made in
section 3.2 hold also here: both of our models (2HML and 4HML) are among the
top performers in terms of ECE and NLL, rivaling Deep Ensembles, with 4HML
scoring most of the times above its two-headed counterpart.

Table 5: Results on the Chaoyang dataset, with standard deviation for 5
training runs.

| ResNet50 | ConvNeXt | Swin-Transformer
---|---|---|---
| ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓
SL1H | 80.71$\pm$0.10 | 5.79$\pm$0.64 | 53.46$\pm$1.75 | 6.0 | 81.91$\pm$0.24 | 6.94$\pm$0.46 | 50.98$\pm$1.49 | 6.3 | 83.09$\pm$0.13 | 8.73$\pm$0.51 | 52.75$\pm$0.45 | 5.0
LS | 74.81$\pm$0.40 | 2.55$\pm$1.88 | 64.27$\pm$0.49 | 6.7 | 79.59$\pm$0.34 | 6.13$\pm$0.62 | 55.65$\pm$2.17 | 7.3 | 79.76$\pm$0.41 | 3.98$\pm$0.73 | 55.37$\pm$0.88 | 6.0
MbLS | 75.02$\pm$0.54 | 3.26$\pm$1.97 | 63.86$\pm$0.97 | 6.7 | 79.53$\pm$0.26 | 2.94$\pm$0.93 | 53.44$\pm$0.76 | 5.3 | 80.24$\pm$0.19 | 5.06$\pm$0.73 | 54.18$\pm$1.65 | 5.7
MixUp | 76.00$\pm$0.42 | 3.67$\pm$1.51 | 62.72$\pm$0.73 | 6.3 | 79.95$\pm$0.33 | 6.20$\pm$0.94 | 55.58$\pm$2.28 | 7.0 | 80.25$\pm$0.33 | 3.89$\pm$0.54 | 54.62$\pm$0.71 | 4.7
DCA | 76.17$\pm$0.33 | 5.75$\pm$0.87 | 62.13$\pm$1.68 | 6.7 | 78.28$\pm$0.19 | 3.69$\pm$0.62 | 57.78$\pm$0.73 | 7.3 | 79.12$\pm$0.28 | 7.91$\pm$0.79 | 59.91$\pm$1.69 | 8.3
D-Ens | 82.19 | 2.42 | 46.64 | 1.0 | 82.98 | 5.21 | 46.08 | 3.3 | 83.50 | 6.79 | 44.80 | 2.7
2HSL | 80.97$\pm$0.28 | 4.36$\pm$0.87 | 51.42$\pm$1.88 | 4.0 | 81.94$\pm$0.21 | 4.30$\pm$0.29 | 46.71$\pm$1.17 | 4.3 | 82.90$\pm$0.21 | 8.20$\pm$0.63 | 54.19$\pm$1.76 | 5.7
2HML | 80.28$\pm$0.26 | 4.49$\pm$0.81 | 51.86$\pm$1.29 | 5.3 | 81.97$\pm$0.19 | 3.66$\pm$0.31 | 45.96$\pm$1.15 | 2.7 | 82.79$\pm$0.22 | 5.01$\pm$0.43 | 46.12$\pm$1.24 | 3.7
4HML | 81.13$\pm$0.17 | 3.09$\pm$0.82 | 49.44$\pm$0.76 | 2.3 | 82.17$\pm$0.10 | 1.79$\pm$0.21 | 44.73$\pm$0.30 | 1.3 | 82.89$\pm$0.26 | 4.80$\pm$0.44 | 46.70$\pm$1.58 | 3.3

Table 6: Results on the Kvasir dataset , with standard deviation for 5
training runs.

| ResNet50 | ConvNeXt | Swin-Transformer
---|---|---|---
| ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓
SL1H | 89.87$\pm$0.16 | 6.32$\pm$0.18 | 41.88$\pm$0.24 | 5.3 | 90.02$\pm$0.12 | 5.18$\pm$0.27 | 35.59$\pm$0.52 | 5.0 | 90.07$\pm$0.05 | 5.81$\pm$0.43 | 38.01$\pm$0.72 | 5.7
LS | 88.13$\pm$1.05 | 14.63$\pm$0.46 | 53.96$\pm$1.99 | 7.7 | 88.24$\pm$0.80 | 6.97$\pm$0.56 | 42.09$\pm$1.60 | 6.7 | 88.74$\pm$1.18 | 9.20$\pm$0.68 | 43.46$\pm$1.77 | 8.7
MbLS | 88.20$\pm$1.61 | 16.92$\pm$0.65 | 57.48$\pm$1.05 | 8.0 | 88.62$\pm$0.78 | 8.55$\pm$0.22 | 43.07$\pm$2.06 | 7.0 | 89.15$\pm$0.63 | 8.19$\pm$0.49 | 41.85$\pm$0.45 | 7.7
MixUp | 87.60$\pm$0.55 | 10.28$\pm$0.50 | 50.69$\pm$2.41 | 7.3 | 87.58$\pm$0.24 | 8.96$\pm$0.58 | 48.88$\pm$2.81 | 8.7 | 89.23$\pm$0.26 | 2.11$\pm$0.32 | 35.52$\pm$0.25 | 4.3
DCA | 87.14$\pm$0.41 | 3.84$\pm$0.64 | 40.50$\pm$0.76 | 6.0 | 85.27$\pm$0.45 | 4.11$\pm$0.89 | 46.78$\pm$0.94 | 7.3 | 87.62$\pm$0.31 | 4.38$\pm$0.82 | 38.44$\pm$1.62 | 7.3
D-Ens | 90.76 | 3.83 | 32.09 | 2.3 | 90.76 | 3.34 | 29.74 | 3.0 | 90.53 | 3.94 | 29.36 | 3.3
2HSL | 89.76$\pm$0.14 | 4.52$\pm$0.27 | 34.34$\pm$0.93 | 4.7 | 90.21$\pm$0.09 | 2.63$\pm$0.14 | 28.69$\pm$0.45 | 2.7 | 90.40$\pm$0.04 | 3.65$\pm$0.17 | 29.14$\pm$0.67 | 3.0
2HML | 90.05$\pm$0.16 | 3.62$\pm$0.40 | 31.37$\pm$0.78 | 2.0 | 89.92$\pm$0.10 | 1.49$\pm$0.31 | 28.15$\pm$0.28 | 2.7 | 90.19$\pm$0.04 | 2.73$\pm$0.33 | 28.66$\pm$0.64 | 2.7
4HML | 89.99$\pm$0.15 | 2.22$\pm$0.25 | 30.02$\pm$0.53 | 1.7 | 90.10$\pm$0.22 | 1.65$\pm$0.29 | 28.01$\pm$0.42 | 2.0 | 90.00$\pm$0.07 | 1.82$\pm$0.32 | 27.96$\pm$0.35 | 2.3

Table 7: Results on the PathMnist dataset, with standard deviation for 5 training runs. | ResNet50 | ConvNeXt | Swin-Transformer
---|---|---|---
| ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓ | ACC↑ | ECE↓ | NLL↓ | Rank↓
SL1H | 89.88$\pm$0.05 | 5.42$\pm$0.26 | 33.36$\pm$0.21 | 8.7 | 93.36$\pm$0.03 | 3.34$\pm$0.26 | 22.91$\pm$0.22 | 6.0 | 92.10$\pm$0.03 | 5.00$\pm$0.09 | 30.91$\pm$0.09 | 7.7
LS | 90.15$\pm$0.13 | 3.72$\pm$0.14 | 32.50$\pm$0.21 | 6.7 | 93.45$\pm$0.07 | 3.10$\pm$0.27 | 23.69$\pm$0.16 | 6.0 | 92.58$\pm$0.06 | 2.89$\pm$0.22 | 26.39$\pm$0.26 | 2.7
MbLS | 90.16$\pm$0.03 | 2.61$\pm$0.22 | 31.24$\pm$0.21 | 4.7 | 93.47$\pm$0.02 | 1.81$\pm$0.14 | 22.87$\pm$0.21 | 3.3 | 92.56$\pm$0.06 | 2.26$\pm$0.23 | 25.96$\pm$0.25 | 2.0
MixUp | 89.81$\pm$0.07 | 2.49$\pm$0.21 | 31.81$\pm$0.54 | 6.0 | 92.81$\pm$0.04 | 1.45$\pm$0.21 | 24.14$\pm$0.17 | 6.0 | 91.98$\pm$0.05 | 1.21$\pm$0.21 | 26.23$\pm$0.13 | 4.3
DCA | 90.14$\pm$0.05 | 4.54$\pm$0.27 | 31.10$\pm$0.28 | 6.7 | 92.76$\pm$0.02 | 2.56$\pm$0.17 | 21.56$\pm$0.09 | 5.7 | 92.20$\pm$0.03 | 4.33$\pm$0.20 | 27.26$\pm$0.21 | 5.3
D-Ens | 90.77 | 3.46 | 27.52 | 2.7 | 93.76 | 2.44 | 20.18 | 2.0 | 92.23 | 4.25 | 26.40 | 4.3
2HSL | 90.55$\pm$0.04 | 3.78$\pm$0.33 | 28.84$\pm$0.12 | 4.3 | 93.07$\pm$0.03 | 3.44$\pm$0.19 | 23.45$\pm$0.20 | 7.7 | 92.05$\pm$0.04 | 4.92$\pm$0.26 | 30.62$\pm$0.18 | 7.3
2HML | 90.54$\pm$0.04 | 2.82$\pm$0.33 | 28.32$\pm$0.32 | 3.3 | 93.17$\pm$0.02 | 2.89$\pm$0.17 | 22.39$\pm$0.20 | 5.0 | 92.04$\pm$0.04 | 4.34$\pm$0.19 | 28.77$\pm$0.27 | 7.0
4HML | 90.47$\pm$0.06 | 1.23$\pm$0.14 | 27.46$\pm$0.22 | 2.0 | 93.14$\pm$0.03 | 1.74$\pm$0.24 | 21.17$\pm$0.28 | 3.3 | 92.01$\pm$0.03 | 2.96$\pm$0.23 | 25.80$\pm$0.40 | 4.3


#  Ab initio study of highly tunable charge transfer in $\beta$-RuCl3/graphene
heterostructures

Aleksandar Razpopov<EMAIL_ADDRESS>Institut für Theoretische
Physik, Goethe-Universität Frankfurt, 60438 Frankfurt am Main, Germany  Roser
Valentí<EMAIL_ADDRESS>Institut für Theoretische Physik,
Goethe-Universität Frankfurt, 60438 Frankfurt am Main, Germany
<EMAIL_ADDRESS>Institut für Theoretische Physik, Goethe-
Universität Frankfurt, 60438 Frankfurt am Main, Germany<EMAIL_ADDRESS>frankfurt.de Institut für Theoretische Physik, Goethe-Universität Frankfurt,
60438 Frankfurt am Main, Germany

###### Abstract

Heterostructures of graphene in proximity to magnetic insulators open the
possibility to investigate exotic states emerging from the interplay of
magnetism, strain and charge transfer between the layers. Recent reports on
the growth of self-integrated atomic wires of $\beta$-RuCl3 on graphite
suggest these materials as versatile candidates to investigate these effects.
Here we present detailed first principles calculations on the charge transfer
and electronic structure of $\beta$-RuCl3/heterostructures and provide a
comparison with the work function analysis of the related honeycomb family
members $\alpha$-RuX3 (X = Cl,Br,I). We find that proximity of the two layers
leads to a hole-doped graphene and electron-doped RuX3 in all cases, which is
sensitively dependent on the distance between the two layers. Furthermore,
strain effects due to lattice mismatch control the magnetization which itself
has a strong effect on the charge transfer. Charge accumulation in
$\beta$-RuCl3 strongly drops away from the chain making such heterostructures
suitable candidates for sharp interfacial junctions in graphene-based devices.

Introduction.- Graphene-based van der Waals (vdW) heterostructures reveal a
variety of novel phenomena emerging from a notable modification of the
electronic properties of their layer constituents due to proximity effects [1,
2, 3, 4, 5, 6, 7, 8, 9, 10]. Some examples are heterostructures of graphene
with several dichalcogenides like MoS2, WS2, and MoSe2 with highly enhanced
properties like ON/OFF current ratio in field effect transistors [3, 4],
photoresponsivity [5, 6], capacitance [7, 8, 9], or thermoelectricity [10].
Such heterostructures are also desirable for possible technological
applications as supercapacitors [7], photodetectors [11] and solid state
lasers [12].

In recent years, heterostructures of graphene in proximity to magnetic
insulators have gained increasing attention due to the possibility to
investigate new states resulting from the interplay between charge transfer,
strain and magnetism in the heterostructures. For instance, Ref. [13] reported
hole-doping in graphene when placed in proximity to the magnetic insulators
CrX3 (X = Cl, Br, I), and found that the charge transfer from graphene to CrX3
could be altered upon changing the magnetic states of the nearest magnetic
insulator layer. Also, heterostructures of graphene with the Kitaev candidate
material $\alpha$-RuCl3 have been intensively investigated [14, 15, 16, 17,
18, 19, 20, 21, 22]. These studies find a significant charge transfer from
graphene to $\alpha$-RuCl3 , larger than in the CrI3/gr (graphene)
heterostructure, giving rise to a van der Waals heterostructure that has
higher conductivity than graphene. This charge transfer modifies the
electronic properties of both materials and is influenced by the magnetism in
$\alpha$-RuCl3, as evidenced by the observation of anomalous quantum
oscillations near the magnetic ordering temperature of $\alpha$-RuCl3, that
have been interpreted within a Kitaev-Kondo lattice model [23].

Figure 1: a) Crystal structure of the heterostructure $\beta$-RuCl3/gr.
$\beta$-RuCl3 forms chains along the a-direction. Cl, Ru and C atoms are shown
by dark red, light blue and grey balls, respectively. The chain height
$\Delta$ is defined as the z coordinate of the highest Cl atom, and the angle
$\alpha$ is between the Ru-Cl-Ru bond of the highest Cl atom. b) Cuts of
$5\times 5$ and $6\times 6$ slabs of $\beta$-RuCl3/gr considered in this
study, which are commensurate with 7.8% (tensile) and -13% (compressive)
strains, respectively, as indicated by black arrows. c) $7\times 25$ slab of
$\beta$-RuCl3/gr emulating the experimentally reported strained
heterostructres [24].

Motivated by this versatility of phases in heterostructures of graphene in
proximity to magnetic insulators and in the search for systems where charge
transfer could be considerable enough to modify the electronic properties of
both layers, we explore here the charge transfer of heterostructures of
graphene with RuBr3 [25] and RuI3 [26, 27], which are isostructural honeycomb
van der Waals materials to the Kitaev candidate material $\alpha$-RuCl3 [28,
29, 30, 31, 32, 33], and we present detailed calculations of the
heterostructure $\beta$-RuCl3/gr, where the chain-based $\beta$-RuCl3 has
recently been shown to grow as atomic-scale wires on graphite [24].

We proceed by first calculating the work functions for the various compounds
within ab initio density functional theory (DFT). Relative comparisons to the
work function of graphene provide an indication of the amount of expected
charge transfer in the heterostructures. We then perform detailed calculations
for $\beta$-RuCl3/gr by considering various strained structures adapted to the
lattice mismatch between graphene and the magnetic insulator. Our main
observations are that proximity of the two layers leads to a hole-doped
graphene and electron-doped RuX3 in all cases, which is sensitively dependent
on the distance between the two layers. We further find that strain effects
due to lattice mismatch, in first order, control the magnetization which
itself has a strong effect on the charge transfer. Moreover, charge
accumulation in $\beta$-RuCl3 sharply drops away from the chain.

Methods.- In order to obtain the work functions of the various systems and to
calculate the charge transfer and electronic properties of the heterostructure
$\beta$-RuCl3/gr we use the projector augmented wave method [34] as
implemented in the VASP simulation package [35] version 6.3.0. As exchange-
correlation functional within DFT, we consider the generalized gradient
approximation (GGA) [36] including the Coulomb corrections on the Ru 4d
orbitals using the GGA+U scheme [37]. Additionally, van der Waals corrections
are included via the DFT+D2 method of Grimme [38]. For structural relaxations
we consider a $6\times 6\times 1$ k-mesh, while for electronic property
calculations we consider a $12\times 12\times 1$ k-mesh that provides accurate
results.

For the work function estimates we keep the crystal structures as provided by
X-ray data [39] without further relaxing them. The work function $W$ is given
by [40]

$W=E_{\rm vac}-E_{\rm F},$ (1)

where $E_{\rm vac}$ is the vacuum energy and $E_{\rm F}$ is the Fermi energy.
The Fermi level is placed at the middle of the insulating gap. Note that for
these calculations only monolayers of the corresponding materials were
considered since previous DFT studies showed that the work function is
primarily related to the surface properties [41].

The heterostructure $\beta$-RuCl3/gr is constructed from the experimental
crystal structure of $\beta$-RuCl3 [39] as shown in Fig. 1 a) top panel. For
the slab calculations a void of $d_{\rm layer}=20$ Å is considered to ensure
that the heterostructure is electronically isolated from the neighboring ones
along the c-direction since the calculations assume periodic boundary
conditions. As the graphene layer has higher stiffness than $\beta$-RuCl3, its
structure is fixed with $d_{\rm C-C}$ = 1.420 Å and only $\beta$-RuCl3 is
relaxed. The charge transfer is obtained via Bader analysis [42] of the
optimized structure.

Results.- In Table 1 we present the calculated work functions $W_{\rm DFT}$
for the systems considered in this study. For $\beta$-RuCl3 we also include
the stress dependence of the work functions. For graphene and $\alpha$-RuCl3
our calculated values are in excellent agreement with the $W_{\exp}$ values
reported in earlier experimental works [43, 44, 45].

Materials |  $W_{\rm DFT}$[eV] |  $W_{\exp}$[eV]
---|---|---
graphene | 4.20 | 4.30 [43]
$\beta$-RuCl3 (-13%) | 6.26 | -
$\beta$-RuCl3 | 6.04 | -
$\beta$-RuCl3 (7.8%) | 5.97 | -
$\alpha$-RuCl3 | 6.01 | 6.10 [44, 45]
RuBr3 | 5.64 | -
RuI3 | 5.23 | -
Table 1: Calculated work functions of graphene, and monolayers of RuX3 (X =
Cl, Br, I) and $\beta$-RuCl3, under various stress conditions for the latter
along the chain direction (compressive (-13%) and tensile (7.8%), compare with
Fig. 1). The calculated value for graphene agree with previous reported
results including spin-orbit coupling (SOC) and considering HSE06 as exchange-
correlation functional [46].

The differences in work functions between graphene and the various RuX3
monolayers already suggest that in all cases a graphene hole-doping is to be
expected in the RuX3/gr heretostructures. The charge transfer is expected to
increase in going from RuI3 to RuCl3 Interestingly, while the work functions
for $\alpha$\- and $\beta$-RuCl3 are similar, the effect of strain has an
important impact on the resulting work function of $\beta$-RuCl3 which
increases under compressive strain and decreases under tensile strain. This
effect is less remarkable in $\alpha$-RuCl3 [16]. The above results suggest
that $\beta$-RuCl3/gr under various conditions of strain may be a promising
candidate to achieve considerable charge transfer, and therefore we
concentrate in what follows on analyzing its electronic properties.

In order to simulate a strained heterostructure one needs to consider slabs
that are commensurate with the chosen strain. The smaller the strain values,
the larger the corresponding slabs that need to be considered. Balancing
between numerical feasibility and complexity, we start with $5\times 5$ and
$6\times 6$ slabs which allow to describe $\beta$-RuCl3/gr with $\beta$-RuCl3
under 7.8% (tensile) and -13.0% (compressive) strain, respectively (see Fig. 1
b)). We first obtain geometrically optimized slab structures of
$\beta$-RuCl3/gr (see SI for details) for these two extreme strained cases,
and we then consider slab structures that are commensurate with the strain
achieved in recent experiments [24, 47] (compressive, (-1.8%)) (Fig. 1 c)).
All the reported values of strain are measured with respect to bulk
$\beta$-RuCl3 lattice parameters. Two different initial magnetic
configurations of Ru chains were also considered for the relaxation of the
slabs: ferromagnetic (FM) and antiferromagnetic (AFM) (see Fig. S2 in SI). In
a second step we analyze the electronic properties and charge transfer for the
various slabs.

Starting with the 7.8% tensile configuration, the initial geometry of
$\beta$-RuCl3 consists of a uniform Ru-Ru chain, where the Ru atoms are
centered above a C atom and in-between two C atoms of graphene in an
alternating fashion (Fig. 1 b)). After the structural relaxation within GGA+U,
$U-J=U_{\rm eff}=3.0$ eV and a FM configuration of Ru, the final configuration
switches from FM to double-AFM (dAFM), with two-up and two-down magnetic
moments along the Ru chain (see Fig. S2 in SI). This relaxed structure
displays three different Ru-Ru distances: $d_{\rm Ru-Ru}^{(1)}$ = 3.138 Å,
$d_{\rm Ru-Ru}^{(2)}$ = 3.065 Å, and $d_{\rm Ru-Ru}^{(3)}$ = 2.949 Å. The
amount of dimerization of the chain, given by the ratio of the longest to
shortest Ru-Ru bond-distance, is $\approx$ 6%. Note that this configuration
shows a weaker chain dimerization than the reported dimerized structure of
bulk $\beta$-RuCl3 of $\approx$ 13% at low temperatures [48]. The associated
Ru-Cl-Ru angles along the chain $\alpha$ (Fig. 1 a)) get modified as well,
introducing a slight non-linearity in the Ru chains with the angles lying
between $0.3^{\circ}-0.7^{\circ}$ compared to a perfectly linear chain of Ru
atoms. We also performed structural relaxations starting with an AFM
configutation and we reached the same optimized structure and magnetic
configuration as described above, showing that the final relaxed geometry is
not dependent on the initial magnetic configuration.

Total energy calculations of the optimized structures show that FM and dAFM
configurations are energetically highly competing states. For further analysis
of the optimized structure, as shown below, we will consider therefore, for
simplicity, the optimized strained structure with Ru in a FM configuration.

Fig. 2 a) displays the calculated electronic band structure and atom resolved
density of states (DOS) within GGA+U for the 7.8% strained $\beta$-RuCl3/gr
heterostructure. Note that the $5\times 5$-graphene’s K point folds back on
itself [49]. We observe that the Dirac point shifts by about 0.50 eV above the
Fermi energy $E_{F}$ compared to pure graphene, indicating hole doping (charge
depletion) in the graphene layer. This shift of the Dirac point is consistent
with a positive value of the calculated difference in work functions ($W_{\rm
RuCl_{3}}-W_{\rm Graphene}\approx$ 2 eV).

In contrast to the Mott insulating behavior of bulk $\beta$-RuCl3 [24], the
heterostructure $\beta$-RuCl3/gr undergoes an insulator to metal transition
due to the chemical shift. The electronic weights at the Fermi level are
mostly of Ru $d$ orbitals hybridizing with Cl and C $p$ orbitals (see DOS in
Fig. 2 a)). The Ru flat bands pinned near the Fermi level are a consequence of
the tensile strain on $\beta$-RuCl3 which drives the chain towards an atomic
limit with localized bands.

Figure 2: Band structure and atom-resolved DOS of a) $\beta$-RuCl3/gr under
7.8% tensile strain with FM ordered moments on the Ru sites. The Dirac point
of pristine graphene at the K point is shifted $\approx$ 0.50 eV above the
Fermi level. b) $\beta$-RuCl3/gr under -13% compressive strain. The Dirac
point of graphene at the $\Gamma$ point is shifted by $\approx$ 0.65 eV above
the Fermi surface. In both cases there is charge transfer from graphene to the
$\beta$-RuCl3 chain. The results were obtained with GGA+U, with $U-J=U_{\rm
eff}=3.0$ eV.

Using Bader analysis [42] we compute the charge transfer per formula unit
between $\beta$-RuCl3 and graphene. $\beta$-RuCl3 is electron-doped with
$\delta\rho_{\rm RuCl_{3}}=0.085$ e/f.u. and graphene hole-doped with
$\delta\rho_{\rm C}=-0.007$ e/C. These values have been also confirmed for AFM
and dAFM configurations of Ru, where we observed negligible differences of
less than 5% due to numerical approximations. We also studied the dependence
of the charge transfer on the presence of Ru magnetic moments by performing
non-magnetic calculations and found a significant increase of the charge
transfer by $\approx$ 37%, compared to the magnetic case. This result
indicates a strong correlation between magnetism and charge transfer in this
system.

Next, we investigate $\beta$-RuCl3/gr under compressive strain (Fig. 2 b)) by
considering a $6\times 6$ slab where initially Ru atoms are positioned at the
center of the carbon honeycomb in graphene. Structural relaxation with both,
FM and AFM initial magnetic configurations for Ru lead to the same relaxed
non-magnetic solution where dRu-Ru = 2.459 Å forming regular linear chains
(Fig. 1 b)), in contrast to the tensile heterostructure above. The reduced Ru-
Ru distance corresponds to 13% compressive strain compared to the bulk
undimerized structure with $d_{\rm Ru-Ru}^{\rm Bulk}$ = 2.861 Å. The height of
the $\beta$-RuCl3 to graphene, $\Delta$ (Fig. 1 a)), increases from 6.5 Å to
6.7 Å going from tensile to compressive strain as a consequence of the
shortening of the Ru-Ru distance that increases the angle $\alpha$ changing
the value of the height. This height profile of the relaxed heterostructures
is close to the obtained from experiment [24].

In Fig. 2 b) we show the calculated band structure and DOS for this case. In
contrast to the tensile case, no Ru states are pinned near the Fermi level.
The reason for that is the short Ru-Ru distance due to the compressed chain
structure inducing Ru-Ru bonding-antibonding band splittings located at -0.5eV
and 2.5eV respectively (see Fig. S6 in SI). The Dirac point of pristine
graphene is folded back to the $\Gamma$ point of the heterostructure due to
the choice of the super-cell [49] and shifted $\approx$ 0.65 eV above the
Fermi energy. This indicates a higher charge transfer compared to the tensile
strain. This result is in agreement to the trends found in the $W_{\rm DFT}$
differences (Table 1), that suggest an increase of charge transfer from
tensile to compressive strain.

Figure 3: Spatial charge redistribution in the (-13%) compressive strained
$\beta$-RuCl3/gr, $\Delta\rho=\Delta\rho_{\rm RuCl_{3}/gr}-\Delta\rho_{\rm
RuCl_{3}}-\Delta\rho_{\rm gr}$. The figure shows in the top panels a two-
dimensional projection of the planer-average charge density (pl. avg.
$\Delta\rho$) along the parallel ($d_{\parallel}$) and perpendicular
($d_{\perp}$) chain directions in the $ab$ plane. Dots in grey, light blue and
dark red symbolize the position of the C, Ru and Cl atoms. The green and blue
curves display the 2D projection of pl. avg. $\Delta\rho$ within the
$\beta$-RuCl3 and graphene layers, respectively. The central panel shows a
three-dimensional view of $\Delta\rho$. In the bottom left panel the total
charge redistribution along $c$ is shown as a red curve. The planer-average
charge values are multiplied by a factor of 1000.

The Bader analysis [42] for the compressed $\beta$-RuCl3/gr confirms that the
charge transfer is strongly enhanced compared to the tensile strained
heterostructure. We observe electron doping in $\beta$-RuCl3, $\delta\rho_{\rm
RuCl_{3}}=0.134$ e/f.u., which is 37% larger than in the tensile case, and
hole doping in graphene with $\delta\rho_{\rm C}=-0.012$ e/C. This amount of
charge transfer coincides with the non-magnetic estimates for the tensile
strained heterostructure and corroborates the observation of a strong
correlation between the absolute value of the Ru magnetic moment and the
charge transfer.

Fig. 3 displays the spatial charge redistribution along the three directions
for the compressive strained $\beta$-RuCl3/gr (results for the tensile
strained heterostructure are shown in SI). Along the c-direction we observe a
strong charge depletion (negative $\Delta\rho$) at the graphene layer and
charge accumulation (positive $\Delta\rho$) at the $\beta$-RuCl3 layer (Fig. 3
bottom left panel). Along the chain direction ($d_{\parallel}$, Fig. 3 top
left panel) the charge distribution follows a uniform pattern, while in the
direction perpendicular to it ($d_{\perp}$, Fig. 3 top right panel), the
charge accumulation at the atomic wire sharply decays and goes to zero within
a few Angstroms away from the chain, similar to what has been observed in
$\alpha$-RuCl3 stripes on graphene [20]. We further investigated the
dependence of the relative orientation of the $\beta$-RuCl3 chains to graphene
keeping the height constant, but we didn’t find any significant changes in the
charge transfer (see SI).

In order to estimate whether the above considered heterostructures are
realizable we calculate the formation enthalpy $\Delta H$ defined as

$\Delta H=E(AB)-E(A)-E(B),$ (2)

where $E(AB)$ is the energy of the $\beta$-RuCl3/gr heterostructure, and
$E(A)$ and $E(B)$ are the energies of the subsystems A (graphene) and B
($\beta$-RuCl3-chain). For the tensile strained $\beta$-RuCl3/gr, $\Delta
H_{T}$ = -0.230 meV/f.u and for the compressive strained $\beta$-RuCl3/gr,
$\Delta H_{C}$ = -0.320 meV/f.u. From this analysis we conclude that both
strained heterostructures are stable and could be realized in experiments.

We proceed now with the study of a slab of $\beta$-RuCl3/gr (see Fig. 1 c))
corresponding to recently reported strained heterostructures [24, 47] showing
$\approx$ 2% compressive strain. Since the analysis performed so far in the
$5\times 5$ and $6\times 6$ slabs suggests no significant dependence on the
relative orientation of the chains and graphene, we do not relax the full
heterostructure, what would lead to unsustainable heavy calculations due to
the large number of atoms in the slab. Instead, we select for the height of
the chain $\Delta$ (Fig. 1 a)) a value close to the estimates obtained for the
above analyzed heterostructures and we consider Ru magnetic moments initially
in a FM configuration. We find via Bader analysis a charge transfer of
$\delta\rho_{\rm RuCl_{3}}=0.113$ e/f.u. and $\delta\rho_{\rm C}=-0.007$ e/C.
To compare the results of the three heterostructures we plot in

Figure 4: Possible charge-transfer tuning parameters. a) Dependence between
the magnetic moment and the charge transfer. Each colored data point refers to
a different heretostructure setting: purple to tensile strain, orange to
experimental strain and green to compressive strain. The strain symbolizes a
way to control the magnetic moment. b) Charge transfer in the tensile strained
structure as a function of the manually controlled layer separation distance.

Fig. 4 a) the dependence of the charge transfer on the average magnetic moment
on the Ru sites. We observe a direct relation between a decrease of charge
with an increase of magnetic moment. Actually, the value of the charge
transfer for all three cases in non-magnetic calculations is the same. These
results suggest that strain in first order controls the magnetization which
itself has a strong effect on the charge transfer. Besides strain, changing
the height $\Delta$ offers as well a possibility to modify the charge
transfer. Increasing the layer separation between $\beta$-RuCl3 and graphene
leads to decreasing charge transfer. In Fig. 4 b) we show this dependence for
the tensile heterostructure. This behavior is to be expected and has been
observed in other van der Waals heterostructures [50]. Experimentally, it is
also possible to control the distance between two atomic wires as shown by the
synthesis technique of $\beta$-RuCl3 used in Ref. [24]. We therefore analyzed
the charge transfer as a function of interchain distance but no significant
changes were observed as can be already preempted by the fact that charge
accumulation perpendicular to the $\beta$-RuCl3 chains sharply drops at the
edges (see Fig. 3 top right panel).

Conclusions.- We have investigated via first principles calculations, the
charge transfer and electronic properties of heterostructures of graphene with
the honeycomb-based $\alpha$-RuX3, (X = Cl, Br, I) and chain-based
$\beta$-RuCl3 by calculating work functions and by performing slab simulations
of the recently reported $\beta$-RuCl3/gr heterostructure [24]. Our
calculations on three exemplary heterostructures of $\beta$-RuCl3/gr including
different degrees of tensile and compressive strain showed that proximity of
the two layers leads to a hole-doped graphene and electron-doped RuX3 in all
cases, which is sensitively dependent on the distance between the two layers.
Furthermore, strain effects due to lattice mismatch, control the magnetization
which itself has a strong effect on the charge transfer, and charge
accumulation in $\beta$-RuCl3 sharply drops away from the chain what opens the
possibility for device development.

Acknowledgements.- The authors are grateful to S. Biswas, T. Asaba, K. Burch,
and E. Henriksen for valuable discussions and gratefully acknowledge support
by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) for
funding through Project No. 509751747 (VA 117/23-1) and TRR 288 — 422213477
(project A05).

## References

  * Geim and Grigorieva [2013] A. K. Geim and I. V. Grigorieva, Van der waals heterostructures, Nature 499, 419 (2013), perspective.
  * Novoselov  _et al._ [2016] K. S. Novoselov, A. Mishchenko, A. Carvalho, and A. H. Castro Neto, 2d materials and van der waals heterostructures, Science 353 (2016).
  * Yu  _et al._ [2013] W. J. Yu, Z. Li, H. Zhou, Y. Chen, Y. Wang, Y. Huang, and X. Duan, Vertically stacked multi-heterostructures of layered materials for logic transistors and complementary inverters, Nature materials 12, 246 (2013).
  * Britnell  _et al._ [2012] L. Britnell, R. Gorbachev, R. Jalil, B. Belle, F. Schedin, A. Mishchenko, T. Georgiou, M. Katsnelson, L. Eaves, S. Morozov, _et al._ , Field-effect tunneling transistor based on vertical graphene heterostructures, Science 335, 947 (2012).
  * Zhang  _et al._ [2014] W. Zhang, C.-P. Chuu, J.-K. Huang, C.-H. Chen, M.-L. Tsai, Y.-H. Chang, C.-T. Liang, Y.-Z. Chen, Y.-L. Chueh, J.-H. He, _et al._ , Ultrahigh-gain photodetectors based on atomically thin graphene-mos2 heterostructures, Scientific reports 4, 3826 (2014).
  * Mehew  _et al._ [2017] J. D. Mehew, S. Unal, E. Torres Alonso, G. F. Jones, S. Fadhil Ramadhan, M. F. Craciun, and S. Russo, Fast and highly sensitive ionic-polymer-gated ws2–graphene photodetectors, Advanced Materials 29, 1700222 (2017).
  * Saraf  _et al._ [2018] M. Saraf, K. Natarajan, and S. M. Mobin, Emerging robust heterostructure of mos2–rgo for high-performance supercapacitors, ACS applied materials & interfaces 10, 16588 (2018).
  * Ratha and Rout [2013] S. Ratha and C. S. Rout, Supercapacitor electrodes based on layered tungsten disulfide-reduced graphene oxide hybrids synthesized by a facile hydrothermal method, ACS applied materials & interfaces 5, 11427 (2013).
  * Kirubasankar  _et al._ [2019] B. Kirubasankar, S. Vijayan, and S. Angaiah, Sonochemical synthesis of a 2d–2d mose 2/graphene nanohybrid electrode material for asymmetric supercapacitors, Sustainable Energy & Fuels 3, 467 (2019).
  * Sadeghi  _et al._ [2016] H. Sadeghi, S. Sangtarash, and C. J. Lambert, Cross-plane enhanced thermoelectricity and phonon suppression in graphene/mos2 van der waals heterostructures, 2D Materials 4, 015012 (2016).
  * Aji  _et al._ [2017] A. S. Aji, P. Solís-Fernández, H. G. Ji, K. Fukuda, and H. Ago, High mobility ws2 transistors realized by multilayer graphene electrodes and application to high responsivity flexible photodetectors, Advanced Functional Materials 27, 1703448 (2017).
  * Zhao  _et al._ [2015] G. Zhao, J. Hou, Y. Wu, J. He, and X. Hao, Preparation of 2d mos2/graphene heterostructure through a monolayer intercalation method and its application as an optical modulator in pulsed laser generation, Advanced Optical Materials 3, 937 (2015).
  * Tseng  _et al._ [2022] C.-C. Tseng, T. Song, Q. Jiang, Z. Lin, C. Wang, J. Suh, K. Watanabe, T. Taniguchi, M. A. McGuire, D. Xiao, _et al._ , Gate-tunable proximity effects in graphene on layered magnetic insulators, Nano Letters 22, 8495 (2022).
  * Zhou  _et al._ [2019] B. Zhou, J. Balgley, P. Lampen-Kelley, J.-Q. Yan, D. G. Mandrus, and E. A. Henriksen, Evidence for charge transfer and proximate magnetism in graphene–$\alpha\text{$-$}{\mathrm{rucl}}_{3}$ heterostructures, Phys. Rev. B 100, 165426 (2019).
  * Mashhadi  _et al._ [2019] S. Mashhadi, Y. Kim, J. Kim, D. Weber, T. Taniguchi, K. Watanabe, N. Park, B. Lotsch, J. H. Smet, M. Burghard, and K. Kern, Spin-split band hybridization in graphene proximitized with $\alpha$-rucl3 nanosheets, Nano Letters 19, 4659 (2019), pMID: 31241971.
  * Biswas  _et al._ [2019] S. Biswas, Y. Li, S. M. Winter, J. Knolle, and R. Valentí, Electronic properties of $\alpha\text{$-$}{\mathrm{rucl}}_{3}$ in proximity to graphene, Phys. Rev. Lett. 123, 237201 (2019).
  * Rizzo  _et al._ [2020] D. J. Rizzo, B. S. Jessen, Z. Sun, F. L. Ruta, J. Zhang, J.-Q. Yan, L. Xian, A. S. McLeod, M. E. Berkowitz, K. Watanabe, _et al._ , Charge-transfer plasmon polaritons at graphene/$\alpha$-rucl3 interfaces, Nano letters 20, 8438 (2020).
  * Gerber  _et al._ [2020] E. Gerber, Y. Yao, T. A. Arias, and E.-A. Kim, Ab initio mismatched interface theory of graphene on $\alpha\text{$-$}{\mathrm{rucl}}_{3}$: Doping and magnetism, Phys. Rev. Lett. 124, 106804 (2020).
  * Wang  _et al._ [2020] Y. Wang, J. Balgley, E. Gerber, M. Gray, N. Kumar, X. Lu, J.-Q. Yan, A. Fereidouni, R. Basnet, S. J. Yun, _et al._ , Modulation doping via a two-dimensional atomic crystalline acceptor, Nano letters 20, 8446 (2020).
  * Balgley  _et al._ [2022] J. Balgley, J. Butler, S. Biswas, Z. Ge, S. Lagasse, T. Taniguchi, K. Watanabe, M. Cothrine, D. G. Mandrus, J. Velasco Jr, _et al._ , Ultrasharp lateral p–n junctions in modulation-doped graphene, Nano Letters 22, 4124 (2022).
  * Yang  _et al._ [2022] B. Yang, Y. M. Goh, S. H. Sung, G. Ye, S. Biswas, D. A. S. Kaib, R. Dhakal, S. Yan, C. Li, S. Jiang, F. Chen, H. Lei, R. He, R. Valentí, S. M. Winter, R. Hovden, and A. W. Tsen, Magnetic anisotropy reversal driven by structural symmetry-breaking in monolayer $\alpha$-rucl3, Nature Materials 22, 50–57 (2022).
  * Rossi  _et al._ [2023] A. Rossi, C. Johnson, J. Balgley, J. C. Thomas, L. Francaviglia, R. Dettori, A. K. Schmid, K. Watanabe, T. Taniguchi, M. Cothrine, _et al._ , Direct visualization of the charge transfer in a graphene/$\alpha$-rucl3 heterostructure via angle-resolved photoemission spectroscopy, Nano Letters 23, 8000 (2023).
  * Leeb  _et al._ [2021] V. Leeb, K. Polyudov, S. Mashhadi, S. Biswas, R. Valentí, M. Burghard, and J. Knolle, Anomalous quantum oscillations in a heterostructure of graphene on a proximate quantum spin liquid, Physical Review Letters 126, 097201 (2021).
  * Asaba  _et al._ [2023] T. Asaba, L. Peng, T. Ono, S. Akutagawa, I. Tanaka, H. Murayama, S. Suetsugu, A. Razpopov, Y. Kasahara, T. Terashima, Y. Kohsaka, T. Shibauchi, M. Ichikawa, R. Valentí, S. ichi Sasa, and Y. Matsuda, Growth of self-integrated atomic quantum wires and junctions of a mott semiconductor, Science Advances 9, eabq5561 (2023).
  * Imai  _et al._ [2022] Y. Imai, K. Nawa, Y. Shimizu, W. Yamada, H. Fujihara, T. Aoyama, R. Takahashi, D. Okuyama, T. Ohashi, M. Hagihala, _et al._ , Zigzag magnetic order in the kitaev spin-liquid candidate material rubr 3 with a honeycomb lattice, Physical Review B 105, L041112 (2022).
  * Nawa  _et al._ [2021] K. Nawa, Y. Imai, Y. Yamaji, H. Fujihara, W. Yamada, R. Takahashi, T. Hiraoka, M. Hagihala, S. Torii, T. Aoyama, _et al._ , Strongly electron-correlated semimetal rui3 with a layered honeycomb structure, Journal of the Physical Society of Japan 90, 123703 (2021).
  * Ni  _et al._ [2022] D. Ni, X. Gui, K. M. Powderly, and R. J. Cava, Honeycomb-structure rui3, a new quantum material related to $\alpha$-rucl3, Advanced Materials 34, 2106831 (2022).
  * Winter  _et al._ [2017] S. M. Winter, A. A. Tsirlin, M. Daghofer, J. van den Brink, Y. Singh, P. Gegenwart, and R. Valenti, Models and materials for generalized kitaev magnetism, Journal of Physics: Condensed Matter 29, 493002 (2017).
  * Motome and Nasu [2020] Y. Motome and J. Nasu, Hunting majorana fermions in kitaev magnets, Journal of the Physical Society of Japan 89, 012002 (2020).
  * Kaib  _et al._ [2022] D. A. Kaib, K. Riedl, A. Razpopov, Y. Li, S. Backes, I. I. Mazin, and R. Valentí, Electronic and magnetic properties of the rux3 (x= cl, br, i) family: two siblings—and a cousin?, npj Quantum Materials 7, 75 (2022).
  * Kim  _et al._ [2022] S. Kim, B. Yuan, and Y.-J. Kim, $\alpha$-rucl3 and other kitaev materials, APL Materials 10 (2022).
  * Trebst and Hickey [2022] S. Trebst and C. Hickey, Kitaev materials, Physics Reports 950, 1 (2022).
  * Ahn  _et al._ [2024] Y. Ahn, X. Guo, S. Son, Z. Sun, and L. Zhao, Progress and prospects in two-dimensional magnetism of van der waals materials, Progress in Quantum Electronics , 100498 (2024).
  * Blöchl [1994] P. E. Blöchl, Projector augmented-wave method, Phys. Rev. B 50, 17953 (1994).
  * Kresse and Hafner [1993] G. Kresse and J. Hafner, Ab initio molecular dynamics for liquid metals, Phys. Rev. B 47, 558 (1993).
  * Perdew  _et al._ [1996] J. P. Perdew, K. Burke, and M. Ernzerhof, Generalized gradient approximation made simple, Phys. Rev. Lett. 77, 3865 (1996).
  * Dudarev  _et al._ [1998] S. L. Dudarev, G. A. Botton, S. Y. Savrasov, C. J. Humphreys, and A. P. Sutton, Electron-energy-loss spectra and the structural stability of nickel oxide: An lsda+u study, Phys. Rev. B 57, 1505 (1998).
  * Grimme [2006] S. Grimme, Semiempirical gga-type density functional constructedwith a long-range dispersion correction, Journal of Physics and Chemistry of Solids 27, 1787 (2006).
  * Fletcher  _et al._ [1967] J. M. Fletcher, W. E. Gardner, A. C. Fox, and G. Topping, X-ray, infrared, and magnetic studies of $\alpha$\- and $\beta$-ruthenium trichloride, J. Chem. Soc. A , 1038 (1967).
  * Kahn [2016] A. Kahn, Fermi level, work function and vacuum level, Materials Horizons 3, 7 (2016).
  * Kim and Choi [2021] H.-g. Kim and H. J. Choi, Thickness dependence of work function, ionization energy, and electron affinity of mo and w dichalcogenides from dft and gw calculations, Phys. Rev. B 103, 085404 (2021).
  * Henkelman  _et al._ [2006] G. Henkelman, A. Arnaldsson, and H. Jónsson, A fast and robust algorithm for bader decomposition of charge density, Computational Materials Science 36, 354 (2006).
  * Rut’kov  _et al._ [2020] E. Rut’kov, E. Afanas’eva, and N. Gall, Graphene and graphite work function depending on layer number on re, Diamond and Related Materials 101, 107576 (2020).
  * Pollini [1996] I. Pollini, Electronic properties of the narrow-band material $\alpha$-${\mathrm{rucl}}_{3}$, Phys. Rev. B 53, 12769 (1996).
  * Klaproth  _et al._ [2022] T. Klaproth, M. Grönke, S. Hampel, M. Knupfer, B. Büchner, A. Isaeva, T. Doert, and A. Koitzsch, Work function engineering of thin $\alpha$-rucl3 by argon sputtering, Advanced Materials Interfaces 9, 2200754 (2022).
  * Zhang  _et al._ [2018] J. Zhang, B. Zhao, T. Zhou, Y. Xue, C. Ma, and Z. Yang, Strong magnetization and chern insulators in compressed graphene/cri 3 van der waals heterostructures, Physical Review B 97, 085401 (2018).
  * [47] Private communication with Tomoya Asaba.
  * Hillebrecht  _et al._ [2004] H. Hillebrecht, T. Ludwig, and G. Thiele, About trihalides with tii3 chain structure: Proof of pair forming of cations in $\beta$-rucl3 and rubr3 by temperature dependent single crystal x-ray analyses, Zeitschrift für anorganische und allgemeine Chemie 630, 2199 (2004).
  * Zhou  _et al._ [2013] Y.-C. Zhou, H.-L. Zhang, and W.-Q. Deng, A 3n rule for the electronic properties of doped graphene, Nanotechnology 24, 225705 (2013).
  * Crippa  _et al._ [2024] L. Crippa, H. Bae, P. Wunderlich, I. I. Mazin, B. Yan, G. Sangiovanni, T. Wehling, and R. Valentí, Heavy fermions vs doped mott physics in heterogeneous ta-dichalcogenide bilayers, Nature Communications 15, 1357 (2024).

Supplementary Information:
Ab initio study of highly tunable charge transfer in $\beta$-RuCl3/graphene
heterostructures

Aleksandar Razpopov

Roser Valentí

## Supplementary Note 1: Work function

We calculate via ab initio density functional theory (DFT) the work function
$W$ for graphene and the RuX3 family with X=Cl, Br, I and compare with the
experimental values if they are available (see main text), as implemented in
VASP [35]. The simulations are performed on a 10$\times$10$\times$5
$\Gamma$-centered k-mesh for $\alpha$-RuCl3, RuBr3, and RuI3 and for
$\beta$-RuCl3 on a 8$\times$1$\times$22\. As exchange correlation functional
we use GGA [36] and include the Coulomb corrections on the Ru 4d orbitals
using the DFT+U scheme [37]. We set $U_{\rm
eff}=~{}3.0,~{}2.5,~{}2.0,~{}\text{and}~{}1.5$ eV for $\beta$-RuCl3,
$\alpha$-RuCl3, RuBr3 and RuI3 motivated by constrained random-phase
approximation (cRPA) estimates [30], respectively. Spin orbit effects are
taken into account. The basis set plane wave cut-off for the expansion is set
to 600 eV in each calculation. For all systems the work function $W$ has been
checked with respect to the size of the void, where all values are given for a
void of the size of 2$\times$c lattice constant of the responding material.

## Supplementary Note 2: Heterostructures calculations

Using DFT we optimize the heterostructure of $\beta$-RuCl3/gr for tensile
(+7.8%) and compressive strain (-13%), where we keep the graphene layer fixed,
as graphene has high stiffness. The tensile strain simulation is performed
with a 2$\times$1-$\beta$-RuCl3 chain on 5$\times$5 graphene layer. In the
initial geometry the Ru atoms are centered alternating above a C atom and in
between a C-C bond. The compressive strain heterostruture consists of a
3$\times$1 $\beta$-RuCl3 chain on 6$\times$6 graphene, where each Ru atom is
initially set above the center of a honeycomb built by the C atoms. The
initial geometry of each structure consists of uniform chain, the simulated
unit cells are shown in Supplementary Fig. 1. The experimental strain (not
relaxed) consists of 11$\times$1 $\beta$-RuCl3 chain on 7$\times$25 graphene.
We include the Coulomb corrections on the Ru 4d orbitals using the DFT+U
scheme [37], with $U_{\rm eff}=~{}3.0$ eV. The calculations are carried on a
6$\times$6$\times$1 k-grid for the compressive and tensile case, and on a
1$\times$2$\times$1 k-grid for the experimental strain with a basis set plane
wave cut-off for the expansion is set to 600 eV. The graphene layer distance
is set to $d_{\rm layer}=20$ Å with C-C distance within the graphene layer of
$d_{\rm C-C}$ = 1.420 Å. This large layer distance $d_{\rm layer}$ ensures
that the layer-layer interactions can be neglected and considered as a 2D
system. The heterostructure is relaxed until the forces decrease down to
$10^{-3}$ eV/Å and energy convergence criterion of $1\times 10^{-6}$ eV.

Supplementary Figure 1: In panel a) we show the unit cell size used for the
tensile strain, b) compressive unit cell size. In c) we show the unit cell
used to simulate the experimental strain.

For each strain the structures are relaxed using ferromagnetic (FM),
antiferromagnetic (AFM), and double-antiferromagnetic (dAFM) ordered magnetic,
symbolized in Supplementary Fig. 2. We find that final structure does not
depend on the magnetic order. Starting from the AFM state we obtain $d_{\rm
Ru-Ru}^{(1)}$ = 3.137 Å, $d_{\rm Ru-Ru}^{(2)}$ = 3.063 Å, and $d_{\rm Ru-
Ru}^{(3)}$ = 2.951 Å. These values show very small deviation compared to the
FM and dAFM state (see main text).

The electronic properties of the system are calculated in each relaxed
structure with a more densed k-grid of 12$\times$12$\times$1\. When comparing
the total energy of each magnetic configuration, we find that FM state is
energetically most favorable state, with 4 meV/f.u. lower compared to the dAFM
order. The AFM state is the energetic highest state with 84 meV/f.u. above the
dAFM solution.

Supplementary Figure 2: Different magnetic orders investigated during this
study: ferromagnetic order (FM), antiferromagnetic (AFM), and double
antiferromagnetic (d-AFM). The green up arrows symbolize the magnetic moment
with spin up, and the red arrows the spin down.

## Supplementary Note 3: Geometry dependence

We study the dependence of the charge transfer and the relative orientation
between the $\beta$-RuCl3 atomic wire and the graphene layer. For this we
considered four additional chain orientations in the compressed case, see
Supplementary Fig. 3. Here, we keep the height $\Delta$ from the first relaxed
structure and shift manually the chain in the a-b plane. Via Bader analysis
[42] we computed the charge transfer for each case, the values in the
$\beta$-RuCl3 layer are noted in Supplementary Fig. 3. We observe negligible
difference in the charge transfer.

Supplementary Figure 3: Additional relative geometries that have been
investigated in the compressive setting. Above each setting we note the charge
transfer $\delta\rho_{\rm RuCl_{3}}$.

## Supplementary Note 4: Charge distributation tensile strain

In Supplementary Fig. 4 we show the average charge redistribution in each
direction in the tensile structure (7.8%). We see very similar behavior for
the charge along c-direction (Supplementary Fig. 4a)) and perpendicular
direction (Supplementary Fig. 4b)) like in the compressive strain (see main
text). As in the compressive case the charge redistribution in the
$\beta$-RuCl3 atomic wire, shown by the green curve, sharply decays within few
Angstrom in the perpendicular direction. However, we note a contrast along the
chain, where the charge does not order equivalently but has a wave-like
behavior (Supplementary Fig. 4c)). The spatially resolved charge transfer
increases in value close to the Ru sites with less magnetic moment and
decreases close to sites with higher magnetic moment.

Supplementary Figure 4: Spatial charge redistribution for the tensile strained
heterostructure in each direction. Note: the planer average values $\rho$ are
scaled by a factor of 1000.

## Supplementary Note 5: Electronic properties, extended energy range

Supplementary Figure 5: Electronic properties of the relaxed single-chain
under tensile strain estimated by DFT+U, with $U-J=U_{\rm eff}=3.0$ eV, in an
extended energy window.

In Supplementary Fig. 5 and Supplementary Fig. 6 we show the electronic band
structure and atom and orbital resolved density of states (DOS) within
increased energy window for the tensile (7.8%) and compressive (-13%) strained
structure, respectively. For compressive strained structure within the
increased energy window we see the bonding and antibonding formation around
-0.5 eV and 2.5 eV due to the Ru-Ru bond shortening.

Supplementary Figure 6: Electronic properties of the relaxed single-chain
under compressive strain estimated by DFT+U, with $U-J=U_{\rm eff}=3.0$ eV, in
an extended energy window. We see bonding and anti bonding states for the Ru
4d states, at -0.5 eV and 2.5 eV, respectively.