The ensemble neural network itself is a regressor: **F** → (0, 1), where **F** is the set of
feature vectors for every pair of source and target tokens.8 By applying sigmoid to the
output and establishing a threshold value for the positive class, the network would
become a classifier. This behaviour can, however, be simulated using A [α] 2 [. We work]
with the threshold explicitly and use the network for computing alignment score and
not for the alignment itself. For the hard alignment, we use A [0.001] 2 _∩_ A [1] 3 _[∩]_ [A] 4 [1][, which]
we found to work the best with this ensemble on the training data.
**Additional Features.** Apart from M1, M [b] 2 [,][ M][aa] 3 [,][ M] 3 [bb] and Attention with averaging aggregation (Individual), we also include the output of fast_align as one of the
features. Moreover, four other manually crafted features (Manual) are added. The
motivation for the first two manual features is that the position and token length help
in determining the alignment in some cases. The last two are specifically targeted
at named entities, which have sparse occurrences in the data, and also at non-word
tokens, such as full stops, delimiters and quotation marks. We list Pearson’s correlation coefficient with true alignments on Czech↔English data (the two directions
averaged).
  - Difference in sentence positions:
ρ = - 0.18, abs( i/|S| − j/|T | )
  - Difference in token lengths:
ρ = - 0.11, abs( |si| − |tj| )
  - Difference in subword unit counts:
ρ = - 0.03, abs( |subw(si)| − |subw(tj)| )
8A completely different approach would be to simply use (pretrained) word embeddings as an input to
the network. This is, however, not possible due to the low amount of gold alignment data.
  - Normalized token case-insensitive Levenshtein distance:
ρ = - 0.30, lev(si, tj)/max(|si|, |tj|)
  - Number of subword units which are present in both tokens:9
ρ = 0.32, | subw(si) _∩_ subw(tj) |
  - Token string case-insensitive equality (equal to zero Levenshtein distance):
ρ = 0.28, Isi _≃_ tj
**Architecture.** For every model, the epoch with the lowest AER on the validation
dataset is used for the test dataset. This extractor was found to work best across all
ensemble models. The training was done with cross-entropy loss. The model was
composed of series of hidden linear layers, each with biases and Tanh as the activation
function with dropouts around the innermost layer:
L [Tanh] |Input| _[◦]_ [L] 32 [Tanh] _◦_ D0.2 _◦_ L [Tanh] 16 _◦_ D0.2 _◦_ L [Tanh] 16 _◦_ L [Tanh] 8 _◦_ L [Softmax] 1


The Czech↔English dataset contains 1.5M source-target pairs, out of which 2.64%
is of a positive class (aligned). For German↔English Small these quantities are 22k
and 5.61% respectively. This could be an issue for a simple classifier network and
would need e.g. oversampling of the positive or undersampling of the negative class.
For Czech↔English, we used 10% and 10% (250 sentences each) for validation and
test data and the rest for training. Samples were split on sentence boundaries. The
English→German was used solely for testing, due to its small size.

Leveraging Neural Machine Translation for Word Alignment


The averaged results of each ensemble on Czech↔English are in Table 5. We also
show the results of M1, but without A2. Due to the range of M1’s values, it is difficult
to establish a cut-off threshold. Attention uses A [1] 3 [, since intersection with other]
extractors did not improve the performance, as described in Section 3. The results
demonstrate that adding any feature improves the overall ensemble. All features
combined together improve on the best individual model by −0.11 AER.10
**Transfer.** The best models on Czech↔English (one for each direction) were then
used on the English→German dataset, resulting on average in AER = 0.18. This is
higher than for Czech but still significantly lower (by a margin of −0.08)11 than for
the best individual model, Attention (max). This suggests that the features generalize
9Normalized version of this feature had slightly lower correlation coefficient: 0.30.
10Performed by Student’s t-test on 10 runs with p < 0.001.
11Performed by Student’s t-test with p < 0.001.
Model / Features Precision Recall AER
M1 (A [1] 3 _[∩]_ [A] 4 [1][)] 0.75 0.78 0.25 _⋆_
Attention (max, A [1] 3 [)] 0.64 0.81 0.29
fast_align Small 0.54 0.66 0.41
fast_align Big 0.63 0.64 0.38
Manual features 0.55 0.46 0.50
Individual (M1, M [b] 2 [,][ M][aa] 3 [,][ M] 3 [bb][, attention)] 0.84 0.73 0.23
Manual + Indiv. 0.85 0.79 0.19
Manual + Indiv. + fast_align 0.86 0.79 0.18
Manual + Indiv. + fast_align + Attention 0.85 0.84 0.16
Manual + Indiv. + fast_align + Attention + M1 rev. 0.86 0.86 0.14 _⋆_
_Table 5. Average Precision, Recall and AER of_ M1 _(best individual) and different_
_ensemble models (using_ A [0.001] 2 _∩_ A [1] 3 _[∩]_ [A] 4 [1] _[) on Czech]_ [↔] _[English data (averaged)]_
well and models can be trained even on other language data. Furthermore, since
the alignment datasets come from different origins, there may be systematic biases,
which lower the performance of the transfer.


This paper explored and compared different methods of inducing word alignment
from trained NMT models. Despite its simplicity, estimating scores with single word
translations (combined with reverse translations) appears to be the fastest and the
most robust solution, even compared to word alignment from attention heads. Ensembling individual model scores with a simple feed-forward network improves the
final performance to AER = 0.14 on Czech↔English data.
**Future work.** Section 2.1 presented but did not explore an idea of target dropout
with multiple tokens in order to better model the fact that words rarely map 1:1. We
then used neural MT for providing alignment scores but then used a primitive extractor algorithm for obtaining hard alignment. More sophisticated approaches which
consider the soft alignment origin (NMT), could vastly improve the performance.
Although it was possible to use any alignment extractor to get hard alignments
out of soft ones, we found that the choice of the mechanism and also the parameters
had a considerable influence on the performance. These alignment extractors are,
however, not bound to alignment from NMT and their ability to be used with other
soft alignment models and other symmetrization techniques should be examined
further.
Finally, we did not explore the possible effects of fine-tuning the translation model
on the available data or training it solely on this data. Similarity based on word
embeddings could be used as yet another soft-alignment feature.


We would like to thank Bernadeta Grici¯ut˙e and Nikola Kalábová for their reviews
and insightful comments.
This article has used services provided by the LINDAT/CLARIAH-CZ Research
[Infrastructure (lindat.cz), supported by the Ministry of Education, Youth and Sports](https://lindat.cz)
of the Czech Republic (Project No. LM2018101). The work described also used trained
models made available by the H2020-ICT-2018-2-825303 (Bergamot) grant.


Vilém Zouhar
vzouhar@lsv.uni-saarland.de
Institute of Formal and Applied Linguistics
Faculty of Mathematics and Physics,
Charles University
Malostranské náměstí 25
118 00 Praha 1, Czech Republic


Department of Computer Science
University of Copenhagen
per.sc@di.ku.dk

Spot the Difference: Detection of Topological Changes via Geometric
  Alignment

Steffen Czolbe
Aasa Feragen
Oswin Krause


DTU Compute
Technical University of Denmark
afhar@dtu.dk


Department of Computer Science
University of Copenhagen
oswin.krause@di.ku.dk


Geometric alignment appears in a variety of applications, ranging from domain
adaptation, optimal transport, and normalizing flows in machine learning; optical
flow and learned augmentation in computer vision and deformable registration
within biomedical imaging. A recurring challenge is the alignment of domains
whose topology is not the same; a problem that is routinely ignored, potentially
introducing bias in downstream analysis. As a first step towards solving such
alignment problems, we propose an unsupervised algorithm for the detection of
changes in image topology. The model is based on a conditional variational autoencoder and detects topological changes between two images during the registration
step. We account for both topological changes in the image under spatial variation
and unexpected transformations. Our approach is validated on two tasks and
datasets: detection of topological changes in microscopy images of cells, and
unsupervised anomaly detection brain imaging.


Geometric alignment is a fundamental component of widely different algorithms, ranging from
domain adaptation [7], optimal transport [40] and normalizing flows [35, 42] in machine learning;
optical flow [21, 51] and learned augmentation [20] in computer vision, and deformable registration
within biomedical imaging [5, 15, 19, 39, 53]. A recurring challenge is the alignment of domains
whose topology is not the same. When the objects to be aligned are probability distributions [35], this
appears when distributions have different numbers of modes whose support is separated into separate
connected components. When the objects to be aligned are scenes or natural images, the problem
occurs with occlusion or temporal changes [51]. In biomedical image registration, the problem is
very common and happens when the studied anatomy differs from "standard" anatomy [36]. Despite
being extremely common, this problem is routinely ignored or accepted as inevitable, potentially
introducing bias in downstream analysis.
We study two cases from biomedical image registration. One is the alignment of image slices to
reconstruct a 3d volume, where changes in topology between slices introduce challenges in postprocessing (Figure 1). The other is the registration of brain MRI scans, where tumors give common
examples of anatomies that are topologically different from healthy brains. In deformable image
registration, a "moving image" is mapped via a nonlinear transformation to make it as similar as
possible to a "target" image, enabling matching local features or transferring information from one
35th Conference on Neural Information Processing Systems (NeurIPS 2021).
Figure 1: Left: Example of topological changes between two adjacent slices of human blood cells
imaged via serial block-face scanning electron microscopy [41]. We aim to detect the change of
topology caused by an emerging organelle within the cell (highlighted by the red arrow) while
accounting for non-linear deformations of the image introduced by natural shape changes between
slices. Right: Heatmap of the likelihood of topological changes predicted by our unsupervised model.
image to another. It is common to numerically stabilize the estimation of the transformation by
constraining the predicted transformation to be diffeomorphic, that is, bijective and continuously
differentiable in both directions. In particular, diffeomorphic transformations are homeomorphic, or
topology-preserving, which implies that a common topology is assumed across all images [13, 15].
This topology is often provided by a common template image **I** template, from which all other images
are obtained via the transformation Φ from the group of diffeomorphisms _G_ . Under this common
topology assumption, the set of all images is given by
_I_ = _{_ **I** template _◦_ Φ _|_ Φ _∈G} ._
Topological differences in biomedical images can be caused by a variety of processes. For instance,
image slices obtained from a volume do not all contain the same elements. Tumor growth or the
removal of surgical tissue can alter the topology of an image. Various processes can lead to the
replacement or deformation of organic tissue, which cannot be mapped to the original image. We
choose to model these topological differences as the inability to obtain one image from the other via a
homeomorphic transformation of the image domain. Since, within image registration, transformations
are assumed to be continuously differentiable, we are effectively modelling topological differences
between pairs of images via the failures of diffeomorphic image registration in aligning them.
As most registration algorithms align images based on intensity, e.g. minimizing mean squared error
(MSE), these tissue changes make it difficult to map images correctly. The strong local deformations
required to deal with the non-diffeomorphic part of the image inevitably also deform the surrounding
area, leading to distorted transformation fields in topologically matching parts of the image [36].
These transformation fields adversely affect downstream tasks, for example indicating false size
changes in adjacent regions.
**Previous work on aligning topologically inconsistent domains.** Attempting to relax the sameimage assumption induced by fully diffeomorphic transformations is not new. In the context of organs
sliding against each other, several approaches exist, most of which rely on pre-annotating the sliding
boundary using organ segmentation [6, 10, 22, 37, 43, 46], with a few extensions to un-annotated
images [38, 45].
When topological holes are created or removed in the domain, for example through tumors, pathologies, or surgical resections, the loss function used for registration can be locally weighted or masked
[26, 29, 30], or an artificial insection can be grown to correct anatomies [36]. These approaches rely
on annotation of the topological differences, which have to be provided manually or by segmentation.
An exception is given by Li and Wyatt [30], which detects changes in topology from the difference
between the aligned images. This depends crucially on the ability to find a good diffeomorphic
registration _outside_ the anomaly, which is difficult all the while the applied transformation is still
diffeomorphic.
An alternative approach to registering topologically inconsistent images is to inpaint the difference in
the source images to obtain a topologically consistent quasi-normal image. Then standard registration
methods can be used on the altered images. Quasi-normal images can be obtained through lowrank and sparse matrix decomposition [32, 33], principle component analysis [16, 18], denoising
VAEs [52], or learning of a blended representation [17]. Registration with the quasi-normal approach
retains the diffeomorphic properties of the transformation but does not register the topologically
inconsistent areas of the images.
**Our contribution.** We propose an unsupervised algorithm for the detection of changes in image
topology. To this end, we train a conditional variational autoencoder for predicting image-to-image
alignment, obtaining a per-target-pixel probability of being obtained from the moving image via
diffeomorphic transformation. We combine a semantic loss function trained to extract contextual
information [8], with a learnable prior of transformations [9], allowing us to incorporate both the
reconstruction error, as well as knowledge about the expected transformation strength.
We test the validity of our approach on a novel dataset of cell slices with annotated topological
changes and on the proxy task of unsupervised brain-tumor detection. We also validate our approach
by investigating a spatial "topological inconsistency likelihood", and showing that this likelihood is
higher in regions where topological inconsistencies are known to be common. Our model is able to
detect topological inconsistencies with a purely registration-driven framework, and thus provides the
first step towards an end-to-end registration model for images with topological discrepancies. The
[implementation is available at github.com/SteffenCzolbe/TopologicalChangeDetection.](https://github.com/SteffenCzolbe/TopologicalChangeDetection)


We view an image **I** interchangeably as two different structures. First, it is a continuous function
**I** : Ω **I** _→_ R _[C]_, where Ω **I** = [0 _,_ 1] _[D]_ is the domain of the image, and _C_ the number of channels.
This function can be approximated by a grid of _n_ pixels with positions _xk ∈_ Ω **I** leading to the
image representation **I** [(] _k_ _[c]_ [)][, where c is an index over the channels and] **[ I]** _[k]_ [ = (] **[I]** _k_ [(1)] _[, . . .,]_ **[ I]** _k_ [(] _[C]_ [)] ) _[T]_ = **I** ( _xk_ ).
Second, this pixel grid is accompanied by a graph structure that encodes the neighbourhood of each
pixel. In this view, the set of neighbours of a pixel with index _k_ (for example the 4-neighbourhood
of a pixel on the image grid) is referred to as _N_ ( _k_ ) and _|N_ ( _k_ ) _|_ is the number of neighbours. The
neighborhoods of a pixel gives rise to a graph which can be described via the graph laplacian
Λ _∈_ R _[n][×][n]_ with Λ _k,k_ = _|N_ ( _k_ ) _|_ and Λ _k,k′_ = _−_ 1 when pixel _k_ _[′]_ _∈_ _N_ ( _k_ ), and zero otherwise.
Applying a spatial transformation Φ : R _[D]_ _→_ R _[D]_ to an image is written as **J** = **I** _◦_ Φ, which can be
seen as its own image with domain Ω **J** = [0 _,_ 1] _[D]_ with pixel coordinates _yk ∈_ Ω **J** and **J** _k_ = **I** (Φ( _yk_ )).
The transformation Φ can be seen as a vector field on the image domain which assigns each pixel
in **J** a position on **I** and thus it can be parameterized as a pixel grid Φ [(] _k_ _[d]_ [)][,] _[ d]_ [ = 1] _[, . . ., D]_ [ at the pixel]
coordinates of **J** using Φ( _yk_ ) = _yk_ + Φ _k_ . To make this choice of coordinate system clear, we will
refer to a transformation that moves a pixel position from the domain Ω **J** to the corresponding pixel
in domain Ω **I** as Φ **J** _→_ **I**, whenever it is not clear from the context. If Φ is a diffeomorphism, it can
alternatively be parameterized by a vector field _V_ on the tangent space around the identity, where the
mapping between the tangent space and the transformation is given by Φ = exp( _V_ ), which amounts
to integration over the vector field [2].

2.1 Notation of images and transformations


It is possible to phrase the problem of fitting a registration model in terms of variational inference,
using an approach similar to conditional variational autoencoders [47]. Here, we summarize the
approach taken by [9, 31]. For a _D_ -dimensional image pair ( **I** _,_ **J** ), we assume that **J** is generated
from **I** by drawing a transformation Φ from a prior distribution _p_ (Φ _|_ **I** ), apply it to **I** and then add
pixel-wise noise:
               _p_ ( **J** _|_ **I** ) = _p_ noise( **J** _|_ **I** _◦_ Φ) _p_ (Φ _|_ **I** ) _d_ Φ
This includes the common topology assumption implicitly via _p_ (Φ _|_ **I** ), which is typically chosen
to produce invertible transformations depending only on the topology of **I**, as well as the noise
model which does not assume systematic changes between **J** and **I** . This model can be learned using
variational inference using a proposal distribution _q_ (Φ _|_ **I** _,_ **J** ) with evidence lower bound (ELBO)
log _p_ ( **J** _|_ **I** ) _≥_ _Eq_ (Φ _|_ **I** _,_ **J** ) [log _p_ noise( **J** _|_ **I** _◦_ Φ)] _−_ _KL_ ( _q_ (Φ _|_ **I** _,_ **J** ) _∥p_ (Φ _|_ **I** )) _._ (1)
In contrast to variational autoencoders, the decoder is given by the known application of Φ to **I** . Thus,
the degrees of freedom in this model are in the choice of the encoder, prior, and the noise distribution.
Dalca et al. [9] proposed to parameterize Φ as a vector field _Vk_ [(] _[d]_ [)] on the tangent space, which turns
application of Φ = exp( _V_ ) into sampling an image with a spatial transformer module [24]. As a
prior for this parameterization, they chose a prior independent of **I**
_p_ (Φ) =
_D_
- _N_ - _V_ [(] _[d]_ [)] _|_ 0 _,_ Λ _[−]_ [1][�] _,_
_d_ =1
where we used the implicit identification of Φ and _V_ and the precision matrix Λ is chosen as the
Graph Laplacian over the neighbourhood graph (see notation). Using an encoder that for each pixel
proposes _q_ ( _Vk_ [(] _[d]_ [)] _|_ **I** _,_ **J** ) = _N_ ( _µ_ [(] _k_ _[d]_ [)] _[, v]_ _k_ [(] _[d]_ [)][)][, the KL divergence is derived as]
- _−_ log _vk_ [(] _[d]_ [)][+] _[|][N]_ [(] _[k]_ [)] _[|][v]_ _k_ [(] _[d]_ [)][+]
_k_ =1 _l∈N_ (
_l∈N_ ( _k_ )
KL - _q_ (Φ _|_ **I** _,_ **J** ) _∥p_ (Φ _|_ **I** )� = [1]
_D_
_d_ =1
_n_
- �2
_µ_ [(] _k_ _[d]_ [)] _−_ _µ_ [(] _l_ _[d]_ [)] +const _._ (2)
It is worth noting that this equation is invariant under translations of _µ_ . This invariance manifests in
rank-deficiency of Λ and as a result, const is infinite. Thus, sampling from the prior and bounding
the objective is impossible. Still training with this term works in practice as images are usually
pre-aligned with an affine transformation and thus translations are close to zero. We will present a
slightly modified approach, rectifying the missing eigenvalue.


The variational approach for learning the distribution of transformations introduced before optimizes
an ELBO on log _p_ ( **J** _|_ **I** ). This information is enough to detect images that contain topological
differences under the assumption that these images will overall have a lower likelihood. However, in
our application, we need not only to detect the existence but also the position of outliers in the image.
For this, we have to ensure that log _p_ ( **J** _|_ **I** ) can be decomposed into a likelihood for each pixel of the
image. It is immediately obvious by inspection of the ELBO (1) together with the KL-Divergence (2),
that the lower bound on log _p_ ( **J** _|_ **I** ) can be decomposed into pixel-wise terms if log _p_ noise( **J** _|_ **I** _◦_ Φ) can
be decomposed as such. To enforce this, we will introduce a general form of error function, which
can be decomposed and includes the MSE as a special case. For this, we first map the images **I** and **J**
to feature maps over the pixel positions _k_ via a mapping _fk_ ( **I** ) _∈_ R _[F]_ and define the loss as:
_p_ noise( **J** _|_ **I** _◦_ Φ) =
_n_
- _N_ ( _fk_ ( **J** ) _|fk_ ( **I** ) _◦_ Φ _,_ Σ _f_ ) _,_ (3)
_k_ =1
where Σ _f ∈_ R _[F][ ×][F]_ is a diagonal covariance matrix with variances learned during training.
The ability to decompose the likelihood is not enough for a _meaningful_ metric, as we have to ensure
that each term is calculated in the correct coordinate system. This depends on the parameterisation
and regularisation of Φ. In the approach by Dalca et al. [9] the parameterization _V_ of Φ is defined on
the tangent space and consequently the prior is also on this space. Since the connection between Φ
and _V_ is given by integration of the vector field, decomposing (2) for a single pixel _k_ will produce
estimates based on the local differential of the transformation, but will not take the full path with
starting and endpoints into account. Thus, correct cost assignments require integration of (2) over the
computed path, which is expensive and suffers from severe integration inaccuracies. Instead, we will
use an alternative approach, where we parameterize Φ directly as a vector field on the image domain.
Transformations parameterized this way are not necessarily invertible anymore, yet smoothness is
still encouraged by the prior.
**Learnable prior** Using this parameterization, we extend the approach by Dalca et al. [9] and
introduce a parameterized prior on Φ _k_ that is learned simultaneously with the model:
[11] _[T]_ (4)
_n_ [2]
_p_ (Φ) =
_D_
- _N_ �Φ [(] _[d]_ [)] _|_ 0 _,_ Λ _[−]_ _αβ_ [1] - _,_ Λ _αβ_ = _α_ Λ + _n_ _[β]_
_d_ =1
The expected variations and translations between transformation vectors are governed by _α_ and _β_ .
Unlike most works in image registration, we do not treat these as tuneable hyperparameters, but
instead view them as unknowns to be fitted to the data during training similar to [28, 49]. For efficient
learning, we use an estimate for the optimal values for _α, β_ over a batch of samples during training,
and use a running average at test time. A detailed explanation is given in supplementary material A.
The second term of (4) ensures that Λ _αβ_ is invertible, by adding a multiple of the eigenvector
1 = (1 _, . . .,_ 1) _[T]_ . It can be verified easily that Λ 1 = 0. Unlike adding a multiple of the identity matrix
to Λ, adding the missing eigenvalue does not modify the prior in any other way than regularizing
the translations. Further, it ensures that the KL divergence of the resulting matrix can be quickly
computed up to a constant as _α_ and _β_ do not modify the same eigenvalues. Recomputing the
KL-divergence for _n_ transformation vectors in _D_ dimensions leads to
�2
2 KL ( _q_ (Φ _|_ **I** _,_ **J** ) _∥pαβ_ (Φ)) = _−_ ( _n −_ 1) _D_ log _α −_ _D_ log _β_ + _β_
_D_
- 1
_n_
_d_ =1
_n_
- _µ_ [(] _i_ _[d]_ [)]
_i_ =1
_n_
- _−_ log _vk_ [(] _[d]_ [)] + _α|N_ ( _k_ ) _|_ + _n_ _[β]_ [2]
_k_ =1
+
_D_
_d_ =1
_n_ [2]
- _vk_ [(] _[d]_ [)] + _α_ - - _µ_ [(] _k_ _[d]_ [)] _−_ _µ_ [(] _l_ _[d]_ [)] �2 + const (5)
_l∈N_ ( _k_ )
**Decomposed error metric** We define our pixel-wise error measure for topological change detection
based on the ELBO (1) with KL-divergence (5) as follows, where we compute _µ_ [(] _k_ _[d]_ [)] and _vk_ [(] _[d]_ [)] via the
proposal distribution _q_ (Φ _|_ **I** _,_ **J** ) and pick Φ [(] _k_ _[d]_ [)] = _µ_ [(] _k_ _[d]_ [)][:]
_n_
- _µ_ [(] _i_ _[d]_ [)]
_i_ =1
_Lk_ ( **J** _|_ **I** ) = _−_ log _N_ ( _fk_ ( **J** ) _|fk_ ( **I** ) _◦_ Φ _,_ Σ _f_ ) + _[βµ]_ [(] _k_ _[d]_ [)]
_n_ [2]
_D_
_d_ =1
+
_D_
- _−_ log _vk_ [(] _[d]_ [)] + _α|N_ ( _k_ ) _|_ + _n_ _[β]_ [2]
_d_ =1
_n_ [2]
_vk_ [(] _[d]_ [)] + _α_
_l∈N_ ( _k_ )
- �2
_µ_ [(] _k_ _[d]_ [)] _−_ _µ_ [(] _l_ _[d]_ [)] _._ (6)
We will treat the loss over all pixels _L_ ( **J** _|_ **I** ) = ( _L_ 1( **J** _|_ **I** ) _, . . ., Ln_ ( **J** _|_ **I** )) as another image with domain
and pixel coordinates the same as **J** . This measure is not symmetric. The prior distribution does
not treat the distributions _q_ (Φ _|_ **I** _,_ **J** ) and _q_ (Φ _|_ **J** _,_ **I** ) equally. If Φ **J** _→_ **I** maps a line in **J** to an area in
**I**, this will incur a large visible feature along the line due to violating the smoothness assumption
encoded in the prior. On the other hand, if an area in **J** gets mapped to a line in **I**, the overall error
contribution is smoothed out over the area. To rectify this issue, we will compute a bidirectional
measure _L_ sym( **J** _|_ **I** ) = _L_ ( **J** _|_ **I** ) + _L_ ( **I** _|_ **J** ) _◦_ Φ **I** _→_ **J**, where Φ **I** _→_ **J** is the same as the one used to compute
_L_ ( **J** _|_ **I** ). For this measure it holds that if Φ **J** _→_ **I** = Φ _[−]_ **I** _→_ [1] **J** [, we have] _[ L]_ [sym][(] **[I]** _[|]_ **[J]** [) =] _[ L]_ [sym][(] **[J]** _[|]_ **[I]** [)] _[ ◦]_ [Φ] **[J]** _[→]_ **[I]** [ up]
to interpolation errors caused by the finite coordinate grid.
**Topological outlier detection** _L_ sym detects topological changes between two images. However,
for evaluation on the Brain dataset, we are interested in topological outliers. Outliers can be detected
using _L_ sym by contrasting the observed deviations with the observed deviations within a larger set of
control images _C_ . This leads to the score
_Q_ ( **J** ) = E **I** _∈C_ [ _L_ sym( **J** _|_ **I** ) _−_ E **K** _∈C_ [ _L_ sym( **I** _|_ **K** )] _◦_ Φ **I** _→_ **J** ] _._ (7)


We evaluate our approach on two tasks. In the first, we measure prediction agreement with annotated
topological changes on a dataset of cell slices. For this, we introduce the first dataset with annotated
topological differences for image registration (see Section 4.1), which allows us to significantly
expand on the evaluation strategies of prior work [26, 29, 30]. In the second task, we adapt our
approach to anomaly detection in order to detect brain tumors on slices of MRI images.
On the change detection task, we use our model prediction of _L_ sym directly. On the anomaly detection
task, we use the score (7), which subtracts the average scores over healthy patients for each pixel.
We compare our model to the following baselines:
1. Two unsupervised approaches for topological change detection:
  - Li and Wyatt’s [30] intensity difference and image gradient-based approach using a deterministic
registration model [5] to obtain the transformations.
  - Using the same model, we devise a method based on the Jacobian Determinant of the transformation field _|J_ Φ _|_ . We expect strong stretching or shrinkage in areas of topological mismatch,
which we measure using use the score log( _|_ det _J_ Φ _|_ ) [2] .
We adapt both approaches to the task of tumor detection by subtracting the average scores over
healthy patients, analogous to (7).
2. The approach by An and Cho [1] for unsupervised anomaly detection in images is based on the local reconstruction error of a variational autoencoder. The error score is _∥_ **J** _−_ dec(enc( **J** )) _∥_ [2], where
enc( **J** ) maps **J** to the mean of the variational proposal distribution and dec is the corresponding
learned decoder. As the score does not use registration, we cannot use equation (7).
3. A supervised segmentation model trained for segmenting topological changes based on two input
images on the cell dataset, and tumor segmentation based on a single input image on the brain
dataset. Since this model requires annotated data, we withhold 75% of the annotated volumes for
training and evaluate the segmentation model only on the remaining samples.
In both tasks, we measure the pixel-wise agreement of the models with the annotated ground-truth
using the receiver operating characteristic curve (ROC curve) and compare the area under the curve
(AUC) between the models. AUC estimates are bootstrapped on the subject level to obtain error
estimates.
As additional evaluations, we present qualitative examples and investigate whether brain regions
with known topological variability get assigned higher scores in our model. For this we compute the
pairwise average score _L_ sym over multiple healthy subjects and register them all to a brain atlas using
E **I** _,_ **K** [ _L_ sym( **I** _|_ **K** ) _◦_ Φ **I** _→_ Atlas]. We group the scores by their position on the brain atlas into partitions:
cortical surfaces, subcortical regions, and ventricles.


**Topology change detection in Cells** Serial block-face scanning electron microscopy (SBEM) is a
method to obtain three-dimensional images from small biological samples. An image is taken from
the face of the block, after which a thin section is cut from the sample to expose the next slice. A
challenge is the accurate reconstruction of the volume, as neighboring slices differ by both natural
deformations and changes in topology. Natural deformations can be introduced by shape-changes of
objects between the slices, and deformations of the sample due to the physical cutting. Changes in
topology occur due to objects present in one slice but not the other, and tears of the physical sample
induced by the cutting.
We evaluate our method on the detection of topological changes between neighboring slices of human
platelet cells recorded with SBEM. We use the pre-segmented dataset by Quay et al. [41] as a base. In
the dataset, image slices are affinely pre-aligned and manually segmented into 7 classes. Afterwards,
for the validation and test set, we annotated changes in the topology of the segmentation masks.
Using this approach, not all instances of topological changes in the image can be annotated as the
segmentation maps merge several types of cell components into a single class. The data is cropped
into patches of 256 _×_ 256 pixels and we use 9 patches of 50 slices for training, 4 patches of 24 slices
for validation, and 5 patches of 24 slices for test (3 patches for the supervised approach due to the
training-test split of annotated data).
**Brain tumor detection** Individual brains offer a range of topological differences, especially in the
presence of tumors. Further, inter-subject differences are found at the cortical surface, where the sulci
vary significantly [48], and near ventricles, which can either be open cavities, or partially closed [36].
We quantitatively evaluate our method on the proxy task of detecting brain tumors. Tumors change the
morphology of the brain and can thus be detected indirectly via the large transformations they cause.
For this, we first train our model using a dataset of healthy images from the control group and then use
(7) to obtain a score for topological outlier detection. For the control set, we combine T1 weighted
MRI scans of the healthy subjects from the ABIDE I [11] [1], ABIDE II [12] and OASIS3 [27] studies.
[1CC BY-NC-SA 3.0, https://creativecommons.org/licenses/by-nc-sa/3.0/](https://creativecommons.org/licenses/by-nc-sa/3.0/)
For the tumor set we use MRI scans from the BraTS2020 brain tumor segmentation challenge [3, 4,
34], which have expert-annotated tumors. We use the T1 weighted MRI scans, and combine labels
of the classes necrotic/cystic and enhancing tumor core into a single tumor class. All datasets are
anonymized, with no protected health information included and participants gave informed consent
to data collection.
We perform standard pre-processing on both brain datasets, including intensity normalization, affine
spatial alignment, and skull-stripping using FreeSurfer [14]. From each 3D volume, we extract a
center slice of 160 _×_ 224 pixels. Scans with preprocessing errors are discarded, and the remaining
images of the control dataset are split 2381/149/162 for train/validation/test. Of the tumor dataset, 84
annotated images with tumors larger than 5cm [2] along the slice are used for evaluation (17 for the
supervised approach due to the training-test split of subjects).


All models evaluated are based on a U-Net [44] architecture, except An and Cho [1], which we
implement using as a spatial VAE following the previously published adaptation to Brain-scans by
Venkatakrishnan et al. [50]. The networks consist of encoder and decoder stages of 64 _,_ 128 _,_ 256
channels for all registration models, and 32 _,_ 64 _,_ 128 _,_ 256 channels for the segmentation and VAE
models. Each stage consists of a batch normalization [23] and a convolutional layer.
In our approach, we use a U-Net to model _p_ (Φ _|_ **I** _,_ **J** ). The output of the last decoder stage is fed
through separate convolution layers with linear activation functions to predict the transformation
mean and log-scaled variance. Throughout the network, we use LeakyReLu activation functions. The
generator step **I** _◦_ Φ is implemented by a parameterless spatial transformer layer [24]. During training
of our model, we use the analytical solution for prior parameters _α, β_ (supplementary material,
Eq. 8), averaged over the mini-batch of 32 image pairs. For validation and test, we use the running
mean recorded during training. The diagonal covariance of the reconstruction loss Σ _f_ is treated as a
trainable parameter.
For all datasets, we use data augmentation with random affine transformations of the training images.
For training, the optimization algorithm is ADAM [25] with a learning rate of 10 _[−]_ [4] . Regularization
of all models is performed by applying an _L_ 2-penalty to the weights with a factor of 0 _._ 01 for the cell
dataset and 0 _._ 0005 for the brains. We train each model on a single TitanRTX GPU, with maximum
training times of 1 day for the cells and 4 days for the brains. Hyperparameters: The network by
Venkatakrishnan et al. [50] has _σ_ = 1 chosen from _{_ 0 _._ 1 _,_ 1 _,_ 10 _}_, based on reconstruction loss on
validation set. The deterministic registration model was trained using _λ_ = 0 _._ 1 as in [8]. For [30], the
parameters _σ_ of the Gaussian derivative kernel and hyper-parameter _K_ where chosen to maximize
the AUC score, selecting _σ_ = 6, _K_ = 2 out of _{_ 1 _, . . .,_ 9 _}_ [2] .
For the reconstruction loss, we compare two different loss functions. The first is using the MSE as
in [9, 30]. The second is a semantic similarity metric similar to [8]. To obtain the semantic image
descriptors, we train a U-net with 32 _,_ 64 _,_ 64 channels for image segmentation, using the manual
annotations of the cell set and automatically created labels obtained with FreeSurfer [14] for the brain
control images. Notably, the segmentation models used for the loss have not been trained on images
or pairs containing topological changes or tumors. From this network, we extract the features of the
first three stages and use them as a 160-channel feature map in the loss (3). For both the MSE and
the semantic loss, we learn the variance parameters while training the variational autoencoder.


The ROC curves of all trained models on the cell and brain tasks can be seen in Figure 2. For both
tasks, the supervised model performed best (AUC 0.90, 0.95), while our proposed approach with
semantic loss performed best among the unsupervised models (AUC 0.88, 0.80). The unsupervised
approach for topological change detection by Li and Wyatt [30] (AUC 0.75, 0.70) performed overall
best among the baselines, but worse than our method. The unsupervised anomaly detection method
by An and Cho [1] (AUC 0.72, 0.67) performed well at detecting brain tumors, but worse at detecting
topological changes in the cell images. Using the Jacobian determinant (AUC 0.75, 0.62) performed
well on the cell images but worse on the brain tumor detection task. Our approach using MSE (AUC
0.72, 0.61) performed worse than the other methods on both tasks.
1.0
0.8
0.6
0.4
0.2
0.0
0 0.2 0.4 0.6 0.8
Cells Brains
Method AUC (Cells) AUC (Brains)
          - Ours (Sem. Loss) _._ 877 _± ._ 003 _._ 797 _± ._ 005
          - Ours (MSE) _._ 712 _± ._ 003 _._ 611 _± ._ 009
          - Li and Wyatt _._ 755 _± ._ 009 _._ 697 _± ._ 006
          - Jac. Det. _._ 752 _± ._ 005 _._ 616 _± ._ 011
          - An and Cho _._ 718 _± ._ 004 _._ 670 _± ._ 011
          - Supervised Seg. _._ 899 _± ._ 004 _._ 946 _± ._ 025
1 0 0.2 0.4 0.6 0.8 1
False Positive Rate
Figure 2: Receiver operating characteristic curves (ROC) and area under the curve (AUC) for
detecting topological changes on the cell and brain datasets. We test models of our method for
unsupervised topological change detection, trained with a semantic loss function and the MSE in
the reconstruction term, and compare against unsupervised baselines from image registration (Li
and Wyatt [30], Jacobian Determinant) and unsupervised anomaly detection (An and Cho [1]). For
reference, we also include a supervised segmentation model, which has been trained on the ground
truth annotations.


Figure 3: Topological differences detected by our method, cell dataset. Neighboring slices **I**, **J** in
rows 1 and 2. Heatmaps of the likelihood of topological differences detected with _L_ sym in row 3.
Heatmaps are overlayed on image **J** to ease comparison. Annotated topological differences used for
evaluation outlined in red. Note that only a subset of topological anomalies present is annotated in
our dataset.
When analyzing the ROC curves, our model performed best among the unsupervised models for all
false positive rates, while the supervised model is the best overall. Finally, even though both models
share the same trained model, the score used by Li and Wyatt [30] performed better than scoring
using the Jacobian determinant on the brain tumor detection task, while on the cell dataset, both
approaches performed the same.
We show qualitative results on the cell dataset in Figure 3. In row 3, we see that _L_ sym detected
annotated areas of topological change (contoured in red), but is more certain at detecting changes in
areas with high intensity difference. In many cases, the model assigns a likelihood of topological
changes to areas that have not been annotated in the dataset, such as the merging cell boundary in
column 2 or many small changes in the cell interior in column 4.


Figure 4: Topological differences detected by our method, brain dataset. Structurally normal brain **I**
in column 1, brain with tumor **J** in column 2. Heatmaps of the likelihood of topological differences
detected with _L_ sym in columns 3, 4 . Likelihood of topological differences caused by the structural
anomaly filtered by Eq. 7 in columns 5, 6. Contour of the ground truth brain tumor in red. Heatmaps
are overlayed on image **J** to ease comparison.
Figure 5: Left: Heatmap of average location of topological differences among the control group,
predicted by the semantic model, averaged with E **I** _,_ **K** [ _L_ sym( **I** _|_ **K** ) _◦_ Φ **I** _→_ Atlas] using a brain atlas as
reference image. Center: We use morphological operations to split the atlas into cortical surface
(blue), ventricles (orange) and sub-cortical structures (green). Right: Likelihood of topological
differences occurring in each region. Boxplot with median, quartiles, deciles.
Qualitative results on the brain data are presented in Figure 4. When looking at columns 3 and 4, we
see that _L_ sym detected notable areas with high changes in topology compared to the reference image
**I** . This includes the ventricles (rows 2,3), the cortical areas with the sulci (all rows) as well as tumor
areas (rows 1,3,5). There was a clear difference in the behaviour between semantic loss and MSE as
the semantic loss highlights broader regions of the surface. When comparing the outlier-detection
measure _Q_ ( **J** ) in columns 5 and 6, we can see that our approach filtered most of the ventricles and
sulci leaving an area around most tumor regions. Notable exceptions are rows 2 and 4, where the
tumor area was not highlighted, as well as row 1 where only part of the tumor was detected.
In Figure 5, we show the average topological change score on healthy subjects. We see on the brain
image and the box plot, that the cortical surfaces and ventricles get assigned higher scores than the
subcortical structures.


In this work, we have introduced a novel approach for the detection of topological changes. We
evaluated our approach qualitatively and compared it quantitatively to previous approaches using
both a novel dataset with purpose-made annotations and on an unsupervised segmentation proxy task.
On both tasks, our approach performed best among the unsupervised methods, but could not reach
the performance of the supervised method.
An unsupervised method is useful in practice, as annotations of topological changes are rarely
available. While our results are not pixel exact, they indicate where a registration algorithm must
be used more carefully to obtain a valid registration. The results on the cell dataset align well with
the annotations, and many of the false positives appear to be caused by incomplete annotation of
the data. This is also reflected in the reported ROC-curves, which show that our model outperforms
the supervised segmentation model at false positive rates larger than 0.5. The results obtained on
the tumor segmentation proxy task are reinforced by the distribution of scores obtained on healthy
patients in different parts of the brain. The high likelihood of topological differences in ventricles
found agrees with previous work [36] and the higher scores in cortical surfaces reflect the fact, that
the sulci of the cortical surface exhibit high variability between subjects [7], which was previously
difficult to quantify.
Our results also show that using a semantic loss function is advantageous compared to the MSE in
this task, as all MSE based methods performed worse than our approach using the semantic loss.
This is likely because the contrast between some anatomical areas is quite small and thus missed by
the MSE. In contrast, the semantic loss incorporates more texture information and thus is capable of
differentiating between areas of similar intensity but different semantics. However, particularly on
the brain example, even the semantic approach misses tumors close to the cortex. We hypothesize,
that this is in part caused by the similar appearance of tumors and grey matter, in part by the semantic
model not being trained on tumors, and in part due to the cortical area containing high topological
variation among the control group as well.
On the brain dataset, our unsupervised results for the method by An and Cho [1] are in line with
previously reported results on a comparable dataset [50]. However, our supervised results are not
comparable to the results published for the BRATS challenge, as we selected a subset of data for
training and only used structural MRI images, discarding the other modalities. On the cell dataset, no
other work on topology change or outlier detection is available.
Our study has several limitations. We only investigate registrations in 2D and topological differences
might vanish if the whole 3D volume is considered. The transformations obtained by our unsupervised
method differ from strongly regularised methods, as the hyperparameter-less learned prior underregularises in order to maximize the likelihood of a topological match during training. Conversely,
the poor performance of the Jacobian determinant might be due to a strong regularisation for good
performance in image registration as we used the hyperparameters as found in [8].
In conclusion, our approach serves as the first step for unsupervised annotation of topological changes
in image registration. Our approach is fully unsupervised and hyperparameter-free, making it a
prospective building block in an end-to-end topology-aware image registration model.


This work was funded by the Novo Nordisk Foundation (grants no. NNF20OC0062606 and
NNF17OC0028360) and the Lundbeck Foundation (grant no. R218-2016-883).
The human platelet SBEM data and segmentations were provided by Matthew Quay, the topological
change annotations are ours. The Brain tumor data was provided by the BraTS challenge. The Brain
control data was provided in part by OASIS Principal Investigators: T. Benzinger, D. Marcus, J.
Morris; NIH P50 AG00561, P30 NS09857781, P01 AG026276, P01 AG003991, R01 AG043434,
UL1 TR000448, R01 EB009352. AV-45 doses were provided by Avid Radiopharmaceuticals, a
wholly-owned subsidiary of Eli Lilly.


Training the model with the KL-Divergence (5), leads to a dependency between _α_, _β_ and _vk_ [(] _[d]_ [)] of the
proposal distribution _q_ . Thus, a bad initialization can lead to slow convergence. However, the prior
parameters enter the ELBO in (1) only through the KL-divergence. Thus, it is possible to compute an
estimate of the optimal prior parameters given a batch of samples, similar to batch normalization [23].
Optimizing (5) for _α_ and _β_ as expectation over the dataset and omitting constant terms leads to:
- _n_
 - _µ_ [(] _k_ _[d]_ [)]
_k_ =1
�2


min
_α,β_ [2][ E] **[I]** _[,]_ **[J]** [ [KL (] _[q]_ [(Φ] _[|]_ **[I]** _[,]_ **[ J]** [)] _[∥][p][αβ]_ [(Φ))] =] _[ D]_ [ log][ E] _[µ,v]_
 _D_

_d_ =1
+
_n_
- _vk_ [(] _[d]_ [)]
_k_ =1
- _|N_ ( _k_ ) _|vk_ [(] _[d]_ [)] +
_k_ =1 _l∈N_ (
_l∈N_ ( _k_ )
_n_
- log _vk_ [(] _[d]_ [)]
_k_ =1
_−_ E _v_
- _D_
_d_ =1
+( _n−_ 1) _D_ log E _µ,v_
 _D_

_d_ =1
_n_

- �2
_µ_ [(] _k_ _[d]_ [)] _−_ _µ_ [(] _l_ _[d]_ [)] +const _,_
(8)
which we use during training. Here, the expectation E _µ,v_ refers to computing _q_ (Φ _|_ **I** _,_ **J** ) and taking the
expectation over all image pairs in the full dataset, which can be approximated using samples from
a single batch. For evaluation, we replace this greedy optimum by a time-average of _α, β_ obtained
during training.


The encoder _p_ (Φ _|_ **I** _,_ **J** ) of our conditional VAE is an image registration model. While registering
images is not the objective of this work, we do evaluate model performance at registering the test
sections of the cell and control brain datasets. We sample transformations from the posterior and
evaluate registration performance by mean dice overlap and pixel-wise accuracy of the segmentation
classes, a higher value indicates a better alignment of the annotated areas. In addition, we assess
transformation smoothness by the variance of the voxel-wise log absolute Jacobian determinant
_σ_ [2] (log _|J_ Φ _|_ ), and transformation folding by the percentage of voxels for which the determinant
is _<_ 0. Lower values indicate a more volume-preserving transformation.
Dataset Sim. Metric Dice _↑_ Seg. Accuracy (%) _↑_ _σ_ [2] (log _|J_ Φ _|_ ) _↓_ _|J_ Φ _| <_ 0 (%) _↓_
Sem. Loss 0 _._ 90 95 _._ 4 0 _._ 88 4 _._ 1
Cells
MSE 0 _._ 89 95 _._ 0 1 _._ 05 4 _._ 1
Sem. Loss 0 _._ 56 84 _._ 7 0 _._ 86 5 _._ 4
Brains
MSE 0 _._ 52 84 _._ 1 1 _._ 39 8 _._ 9


We provide samples from the dataset of human platelet cells, including dataset segmentations by
Quay et al. [41] and topological change annotations by us.

C Cell dataset with annotated topological changes


Figure 6: Examples of the Cell dataset, obtained from Quay et al. [41]. Columns 1 and 3: Images
of neighboring slices **I** _,_ **J** . Row 2 and 4: Segmentation of the images, background in dark blue, cell
body in blue, organelles in yellow. Segmented objects introducing topological changes by appearance
outlined in red, their position on the complementary slice outlined in green. For evaluation, we
combine the red and green topological change annotations into a single class.


_Jingbei Li_ [1] _, Yi Meng_ [1] _, Zhiyong Wu_ [1] _[,]_ [2] _, Helen Meng_ [2] _, Qiao Tian_ [3] _, Yuping Wang_ [3] _, Yuxuan Wang_ [3]
1 Shenzhen International Graduate School, Tsinghua University, Shenzhen, China
2 The Chinese University of Hong Kong, Hong Kong SAR, China
3 ByteDance, Shanghai, China
_{_ lijb19, my20 _}_ @mails.tsinghua.edu.cn, _{_ zywu, hmmeng _}_ @se.cuhk.edu.hk, _{_ tianqiao.wave, wangyuping, wangyuxuan.11 _}_ @bytedance.com

NeuFA: Neural Network Based End-to-End Forced Alignment with
  Bidirectional Attention Mechanism

Jingbei Li
Yi Meng
Zhiyong Wu
Helen Meng
Qiao Tian
Yuping Wang
Yuxuan Wang


Although deep learning and end-to-end models have been widely
used and shown their superiority in automatic speech recognition
(ASR) and text-to-speech (TTS) synthesis, state-of-the-art forced
alignment (FA) models are still based on hidden Markov model
(HMM). HMM has limited view of contextual information and is
developed with long pipelines, leading to error accumulation and
unsatisfactory performance. Inspired by the capability of attention mechanism in capturing long term contextual information and
learning alignments in ASR and TTS, we propose a neural network
based end-to-end forced aligner called NeuFA, in which a novel
bidirectional attention mechanism plays an essential role. NeuFA
integrates the alignment learning of both ASR and TTS tasks in a
unified framework by learning bidirectional alignment information
from a shared attention matrix in the proposed bidirectional attention mechanism. Alignments are extracted from the learnt attention
weights and optimized by the ASR, TTS and FA tasks in a multi-task
learning manner. Experimental results demonstrate the effectiveness
of our proposed model, with mean absolute error (MAE) on test
set drops from 25.8 ms to 23.7 ms at word level, and from 18.0 ms
to 15.7 ms at phoneme level compared with state-of-the-art HMM
based model.
_**Index Terms**_ **—** bidirectional attention mechanism, forced alignment, end-to-end model, multi-task learning


Forced alignment (FA), which produces the bidirectional mapping
between the given text and speech sequences, has been widely used
in speech processing tasks over decades. Such bidirectional mapping information provides the possibility of recognizing fine-grained
prosody patterns of speakers, from which high-level analysis like sociolinguistical, phonetical and psycholinguistical analysis could be
built [1, 2, 3, 4, 5].
Conventionally, FA models are based on hidden Markov model
(HMM) [6], such as Prosodylab-Aligner [7] and Montreal forced
aligner (MFA) [8]. HMM based models only have limited views of
contextual information. Moreover, these models need to be trained
in long pipelines which not only are resource-consuming, but also
lead to error accumulation and unsatisfactory results.
With the development of deep learning and end-to-end technology, many neural network based models are proposed for automatic
speech recognition (ASR) [9, 10] and text-to-speech (TTS) synthesis [11, 12, 13] and outperform conventional methods. These models commonly employ the attention mechanism [14] to capture a
long view of contextual information. Besides, the attention mechanism used in ASR and TTS has also shown its capability of learning
alignment information [9, 11, 12] and improved model interpretability. Then it is of possibility to build a neural network model for FA
with the alignment information learnt by attention mechanism. FastSpeech [13] introduces a primary way to convert the alignment information to duration by summing the weights for each phoneme.
Moreover, further improvement could be made if the alignments
could be optimized by both ASR and TTS with multi-task learning.
In this paper, to improve FA with deep learning and end-to-end
technologies, we propose a neural network based end-to-end forced
aligner named NeuFA, in which the most essential algorithm is a
novel bidirectional attention mechanism. The bidirectional attention
mechanism are extended from the original attention mechanism to
learn bidirectional relation mapping between two sets of key-value
pairs. In the neural network based FA task, the input includes both
text and speech sequences, and the bidirectional alignment information between text and speech can be learned by two separately but
related tasks from text to speech (TTS) and speech to text (ASR).
In this way, NeuFA integrates the alignment learning of both ASR
and TTS tasks in a united framework by learning the bidirectional
alignment information from the shared attention matrix in bidirectional attention mechanism and optimized by the ASR, TTS and
FA tasks with multi-task learning. Then the attention weights for
ASR and TTS tasks are obtained from the shared attention matrix
and converted to boundaries at word or phoneme level by a boundary detector. Experimental results demonstrate the effectiveness of
our proposed model. The source code of NeuFA is also available at
https://github.com/thuhcsi/NeuFA.


To achieve bidirectional relation learning for parallel data, we extend conventional attention mechanism [14] to bidirectional attention mechanism to learn the bidirectional relation mapping between
two sets of key-value pairs, as shown in Figure 1. Each set of keys
serves as the queries for the other set of key-value pairs. Then two
weighted sums of the values are produced based on a shared compatibility function between the two sets of keys. It is also formulated
as:
_A_ = _f_ ( _K_ 1 _, K_ 2) (1)
_W_ 12 _, W_ 21 = _softmax_ ( _A, A_ _[T]_ ) (2)
_O_ 1 _, O_ 2 = _W_ 12 _[T]_ _[V]_ 1 _[, W]_ 21 _[ T]_ _[V]_ 2 (3)
**Fig. 1** . Bidirectional attention mechanism
where _K_ 1 _∈_ _R_ _[n]_ [1] _[×][d][k]_ [1], _V_ 1 _∈_ _R_ _[n]_ [1] _[×][d][v]_ [1] and _K_ 2 _∈_ _R_ _[n]_ [2] _[×][d][k]_ [2], _V_ 2 _∈_
_R_ _[n]_ [2] _[×][d][v]_ [2] are the two sets of key-value pairs, _n_ 1 and _n_ 2 are the numbers of the key-value pairs, _dk_ 1, _dv_ 1, _dk_ 2 and _dv_ 2 are feature dimensions, _f_ is the compatibility function, _A ∈_ _R_ _[n]_ [1] _[×][n]_ [2] is the shared
attention matrix, _W_ 12 _∈_ _R_ _[n]_ [1] _[×][n]_ [2] and _W_ 21 _∈_ _R_ _[n]_ [2] _[×][n]_ [1] are the attention weights for two directions respectively, _O_ 1 _∈_ _R_ _[n]_ [2] _[×][d][v]_ [1] is the
weighted sum of _V_ 1 for each key in _K_ 2 and _O_ 2 _∈_ _R_ _[n]_ [1] _[×][d][v]_ [2] is the
weighted sum of _V_ 2 for each key in _K_ 1.
Depending on how the compatibility function is implemented,
we propose a multiplicative form and an additive form for bidirectional attention mechanism. For the multiplicative form (i.e. the
bidirectional multiplicative attention), the compatibility function are
implemented as:
_A_ = _f_ 1( _K_ 1) _× f_ 2( _K_ 2) _[T]_ (4)
where _f_ 1 : _R_ _[n]_ [1] _[×][d][k]_ [1] _→_ _R_ _[n]_ [1] _[×][d][a]_ and _f_ 2 : _R_ _[n]_ [2] _[×][d][k]_ [2] _→_ _R_ _[n]_ [2] _[×][d][a]_ are
linear projections, _da_ is the feature dimension of the attention hidden
space. The additive form or the bidirectional additive attention can
also be deduced from additive attention [15], which is formulated as:
_A_ = _fa_ ( _dup_ 1( _f_ 1( _K_ 1)) + _dup_ 2( _f_ 2( _K_ 2))) (5)
where _dup_ 1 : _R_ _[n]_ [1] _[×][d][a]_ _→_ _R_ _[n]_ [1] _[×][n]_ [2] _[×][d][a]_ and _dup_ 2 : _R_ _[n]_ [2] _[×][d][a]_ _→_
_R_ _[n]_ [1] _[×][n]_ [2] _[×][d][a]_ duplicate the outputs of _f_ 1( _K_ 1) and _f_ 2( _K_ 2) to a same
shape, _fa_ : _R_ _[n]_ [1] _[×][n]_ [2] _[×][d][a]_ _→_ _R_ _[n]_ [1] _[×][n]_ [2] is a linear projection.


In this section we will introduce our proposed neural network based
FA model, NeuFA. As shown in Figure 2, NeuFA has a text encoder and a speech decoder for the TTS task, a speech encoder and a
text decoder for the ASR task. These two encoder-decoder modules
share a same attention module implemented with the bidirectional
attention mechanism introduced in Section 2.1. Then a boundary
detector is employed to extract the boundaries from the attention
weights in both ASR and TTS tasks.
_2.2.1. Text encoder and speech encoder_
The text encoder and speech encoder convert the input text and
speech sequences into text and speech encodings. The encoder of
Tacotron 2 [12] is employed as the text encoder in NeuFA since it
has already shown its ability in modeling text information in TTS.
The speech encoder is designed based on the content encoder [16]
proposed in voice conversion to capture the textual information in
speeches. The speech encoder consists of 3 convolutional layers
each containing 512 filters with shape 17 _×_ 1 and batch normalization, and two 256 dimensional bidirectional GRU [17] layers.
**Fig. 2** . Neural network based FA with bidirectional attention
**Fig. 3** . Adding original and estimated positional encodings
_2.2.2. Estimated positional encodings_
As shown in Figure 3, original and estimated positional encodings
(PEs) are added to the text encodings and speech encodings before
they are processed by the attention mechanism.
We employ the positional encodings in Transformer [14] as the
original positional encodings for texts and speeches:
_PE_ ( _pos,_ 2 _i_ ) = _sin_ ( _pos/_ 10000 [2] _[i/d]_ ) (6)
_PE_ ( _pos,_ 2 _i_ +1) = _cos_ ( _pos/_ 10000 [2] _[i/d]_ ) (7)
where _pos_ is the position, _i_ is the index, and _d_ is the number of the
feature dimensions.
However, the positions (i.e. _pos_ ) are of different meanings in the
original positional encodings for texts and speeches. For texts, the
positions are the indices of the input phonemes; while for speeches,
they are the indices of the frames of the input speeches. Such mismatch in the positions may confuse the model to learn clear alignments. Therefore, we propose estimated positional encodings to alleviate this mismatch by estimating the possible speech or text positions from its corresponding text or speech encodings.
The estimated positional encodings are also computed with
Equation 6 and 7, except the positions are estimated positions rather
than the indices of the input sequences. For texts, estimated speech
positions are computed from the text encodings. And for speeches,
estimated text positions are computed from the speech encodings. In
computing the positions, the input encodings are first converted into
estimated lengths by linear projection with _ReLU_ activation. Then
the estimated lengths are cumulatively summed into monotonic
estimated positions. The procedure can be formulated as:
_pos_ _[′]_ _s_ [=] _[ cumsum]_ [(] _[ReLU]_ [(] _[f]_ _t_ [(] _[E]_ _t_ [)))] (8)
_pos_ _[′]_ _t_ [=] _[ cumsum]_ [(] _[ReLU]_ [(] _[f]_ _s_ [(] _[E]_ _s_ [)))] (9)
where _Et_, _Es_ are the input text and speech encodings, _ft_, _fs_ are linear projections, _pos_ _[′]_ _s_ [,] _[ pos]_ _t_ _[′]_ [are the estimated cumulatively summed]
speech and text positions for the input text and speech sequences.
The original and estimated positional encodings are separately
added to two copies of the input text and speech encodings, and then
concatenated together:
_Et_ _[′]_ [= [] _[E]_ _t_ [+] _[ PE]_ _t_ [;] _[ E]_ _t_ [+] _[ PE]_ _s_ _[′]_ []] (10)
_Es_ _[′]_ [= [] _[E]_ _s_ [+] _[ PE]_ _t_ _[′]_ [;] _[ E]_ _s_ [+] _[ PE]_ _s_ []] (11)
where _PEt_, _PEs_ are the original text and speech positional encodings, _PEt_ _[′]_ [,] _[ PE]_ _s_ _[′]_ [are the estimated text and speech positional encod-]
ings, _Et_ _[′]_ [,] _[ E]_ _s_ _[′]_ [are the output text and speech encodings with positional]
encodings added.
By introducing the estimated positional encodings to NeuFA,
two additional losses called relative estimated text and speech length
losses are used in back-propagation. These two losses ensure that the
estimated positions are compatible with the index based positions,
which can be formulated as:
_loss_ _[t]_ _l_ [=] _[ MSE]_ [(1] _[, last]_ [(] _[pos]_ _t_ _[′]_ [)] _[/L]_ _t_ [)] (12)
_loss_ _[s]_ _l_ [=] _[ MSE]_ [(1] _[, last]_ [(] _[pos]_ _s_ _[′]_ [)] _[/L]_ _s_ [)] (13)
where _Lt_, _Ls_ are the ground-truth lengths of the input text and
speech sequences, _last_ returns the last elements of _pos_ _[′]_ _t_ [and] _[ pos]_ _s_ _[′]_
which correspond to the total estimated text and speech lengths,
_MSE_ is mean squared error.
In practise, we find that the estimated text positional encodings
are significantly helpful to learn clear alignments than just original
positional encodings. Moreover, these positional encodings are vital
to distinguish those phonemes with the same pronunciation in sentences.
_2.2.3. Bidirectional attention mechanism_
As shown in Figure 2, the bidirectional attention takes the text and
speech encodings with PEs as inputs, and respectively summarizes
textual and acoustic information for the TTS and ASR tasks. We use
an 128 dimensional bidirectional multiplicative attention for NeuFA
since it is more efficient in memory usage.
_2.2.4. Text decoder and speech decoder_
The text decoder and speech decoder respectively reconstruct the input text and speech sequences from the summarized acoustic and
textual information. The text decoder consists of a stack of two 128
dimensional bidirectional LSTM layers and a linear projection with
softmax activation. The speech decoder has a similar structure, consisting of a stack of two 256 dimensional bidirectional LSTM layers
and a linear projection. Cross entropy and MSE are used as the loss
functions for the reconstructed text and speech sequences:
_losst_ = _CrossEntropy_ ( _T_ _[′]_ _, T_ ) (14)
_losss_ = _MSE_ ( _S_ _[′]_ _, S_ ) (15)
where _T_ and _S_ are the input text and speech sequences, _T_ _[′]_ and _S_ _[′]_
are the reconstructed text and speech sequences.
**Fig. 4** . (a) Learnt attention weights for ASR. (b) Learnt attention
weights for TTS. (c) Illustration of predicted (green) and groundtruth (yellow) phoneme boundaries. (d) Illustration of a diagonal
constraint matrix used in the diagonal attention loss.
_2.2.5. Boundary detector_
Instead of directly predicting the boundaries, the boundary detector
takes the attention weights from both ASR and TTS directions as inputs to predict the left and right boundary signals for each phoneme.
The boundary signals are inspired by the stop token in Tacotron [11]
and Tacotron 2 [12], which can provide more fine-grained gradients
for each position than just the values of boundaries. Ground-truth
boundary signals are generated from the annotated boundaries, in
which the elements are set to 0 if they are before the boundaries
and 1 otherwise. Therefore the predicted boundary signals are also
monotonic signals ranged from 0 to 1. During inference, the positions of the first elements whose boundary signals are greater than
0.5 are used as the predicted boundaries.
A 6 channel feature matrix is generated from the input attention
weights, including the original attention weights and their cumulative sums in both forward and backward directions:
_F_ = [ _WT T S, cumsum_ ( _WT T S_ ) _, r_ ( _cumsum_ ( _r_ ( _WT T S_ ))) _,_
_WASR_ _[T]_ _[, cumsum]_ [(] _[W]_ _ASR_ _[ T]_ [)] _[, r]_ [(] _[cumsum]_ [(] _[r]_ [(] _[W]_ _ASR_ _[ T]_ [)))]][ (16)]
where _WT T S_ and _WASR_ are the attention weights for the TTS and
ASR directions, _r_ reverses its input along the temporal dimension
and _F_ is the output 6 channel feature matrix. _WASR_ is transposed
due to the Equation 2 in bidirectional attention mechanism.
The feature matrix _F_ is then processed by a stack of 3 convolutional layers each containing 32 filters with shape 17 _×_ 17 and a
linear projection followed by the _sigmoid_ activation to detect the
left and right boundaries. The outputs are cumulatively summed and
converted to monotonic boundary signals ranged from 0 to 1 by the
_tanh_ activation for each left and right boundaries.
_B_ _[′]_ = _tanh_ ( _cumsum_ ( _sigmoid_ ( _f_ ( _convs_ ( _F_ ))))) (17)
where _convs_ is the stacked convolutions, _f_ is linear projection and
_B_ _[′]_ is the predicted boundary signals.
MAE of the predicted and ground-truth boundary signals is used
as the loss function for boundary detector:
_lossb_ = _MAE_ ( _B_ _[′]_ _, B_ ) (18)
where _B_ and _B_ _[′]_ are the ground-truth and predicted boundary signals
respectively.
(a) Attention weights for ASR
(b) Attention weights for TTS
(c) Predicted boundaries
(d) Diagonal constraint matrix
_2.2.6. Diagonal attention loss_
Diagonal attention loss is proposed to help the model learn alignments by multiplying the elements in attention weight matrices with
diagonal constraints. The diagonal attention loss is defined as:
_lossa_ = _mean_ �( _WT T S_ + _WASR_ _[T]_ [)] _[ ⊙]_ _[D]_     - (19)
1 - _p_
2 _[max]_ _q_
_[q]_ [1] _[ −]_ _[p]_
_p_ _[,]_ 1 _−_ _q_
**Table 1** . Performances of the baseline and proposed approaches

2.2. Neural network based forced alignment


**MFA** 25.8 ms 12.3 ms 18.0 ms 10.0 ms
**NeuFA** **23.7** ms **9.0** ms **15.7** ms **9.1** ms
   - w/o EPEs 32.1 ms 11.5 ms 19.5 ms 9.9 ms
   - w/o TPEs 33.8 ms 12.0 ms 20.7 ms 10.0 ms
   - w/o SPEs 24.2 ms 9.1 ms 16.8 ms 9.2 ms
   - w/o ASR 37.8 ms 14.0 ms 24.6 ms 10.8 ms
   - w/o TTS 50.7 ms 18.7 ms 33.5 ms 15.8 ms
   - w/o DAL 26.6 ms 10.0 ms 18.7 ms 10.1 ms
**Table 2** . Accuracies at different tolerances for different approaches


In ablation studies, the performance drops a lot if we remove the
estimated postional encodings (EPEs) and only use the original positional encodings to train the model. This illustrates the mismatch
between original text and speech position encodings.
The performance also drops if we remove the original and estimated text positional encodings (TPEs) and only use the original
and estimated speech positional encodings (SPEs) to train the model.
However, it barely drops if we do the opposite. This is reasonable
since estimating the number of phonemes from speech is more easier
and accurate than estimating the duration of speech from phonemes.
Significant performance loss will occur if the ASR or TTS task is
removed by setting the corresponding loss weight to 0. This shows
the necessity of both the ASR and TTS tasks for FA, and also the
necessity of the proposed bidirectional attention mechanism.
No alignment is learnt on the LibriSpeech corpus if we remove
the diagnol attention loss (DAL) by setting _ϵ_ to 0. The training on
the Buckeye corpus will then be similar to the training from random
initialization. Although the model can still learn alignments with the
full architecture of NeuFA, it suffers from the absence of fine-trained
bidirectional text-speech mapping information.


To improve FA with deep learning and end-to-end technologies, we
propose a neural network based end-to-end forced aligner named
NeuFA based on the bidirectional attention mechanism which is
also proposed in this paper. NeuFA integrates the alignment learning of both ASR and TTS in a united framework by the proposed
bidirectional attention mechanism. Attention weights for two tasks
are obtained from the shared attention matrix in bidirectional attention mechanism, and converted to boundaries at word or phoneme
level by a boundary detector. The effectiveness of NeuFA has been
demonstrated by experimental results and ablation studies.
**Acknowledgment** : This work is partially supported by National
Natural Science Foundation of China (NSFC) (62076144) and National Social Science Foundation of China (NSSF) (13&ZD189).
    - 1
_Di,j_ = _tanh_
_p_ _[q]_
_q_ _[,]_ _p_
1 _−_ _p_
[1] _[ −]_ _[p]_ [1] _[ −]_ _[q]_
1 _−_ _q_ _[,]_ 1 _−_ _p_
��
(20)
where _⊙_ is element-wise multiplication and _D_ is dynamically generated with Equation 20 where _i_, _j_ are the indices, _p_ = _ni_ 1 [,] _[ q]_ [ =] _nj_ 2
are the relative position of _i_, _j_ in their corresponding dimensions.
An illustration of _D_ is also shown in Figure 4 (d).
The final loss function for training NeuFA is then defined as:
_loss_ = _αlosst_ + _βlosss_ + _γloss_ _[t]_ _l_ [+] _[δloss]_ _l_ _[s]_ [+] _[ϵloss]_ _a_ [+] _[ζloss]_ _b_ [(21)]
where _α_ to _ζ_ are loss weights.


We follow the training setups of the MFA [8] to train NeuFA except
the MFCCs are extracted with librosa [18] rather than Kaldi [19], and
graphme-to-phoneme conversions are made by a pretrained model
[20]. We train an NeuFA for word level as if only orthographic
transcription in Buckeye [21] were known, and another NeuFA for
phoneme level with the phoneme sequences given in Buckeye.
Each NeuFA model is firstly trained on the full set of the LibriSpeech [22] corpus for 120,000 steps with a batch size of 16. The
learning rate is fixed to 10 _[−]_ [4] . Loss weights _α_ to _δ_ are simply set to
0.1, 1, 10, 10 to balance the losses to a same level. _ϵ_ is set to 1,000
to help the model learning alignments. _ζ_ is set to 0 since there is no
boundary annotation for the LibriSpeech corpus.
Then each model is trained on the data of 36 speakers in the
Buckeye corpus for 220,000 steps with a batch size of 16 to train
the boundary detector. The learning rate is also fixed to 10 _[−]_ [4] . Loss
weights _α_ to _δ_ are same to those in the previous stage. _ζ_ is now set
to 100 and _ϵ_ is set to 0 since the boundary loss can provide more
accurate alignment information than the diagonal attention loss.
The experiments are implemented with PyTorch [23] on an
NVIDIA Tesla V100 GPU.


The data of the rest 4 unseen speakers in the Buckeye corpus are used
as the test set. The models are evaluated on the MAE and medians
of absolute errors of the predicted left and right boundaries at word
and phoneme levels. Then the comparisons are made with the model
shipped in the MFA package as the baseline.
As shown in Table 1, NeuFA outperforms MFA at both word
and phoneme levels. The MAE is reduced to 23.7 ms and 15.7 ms
respectively. And the medians drops to 9.0 ms and 9.1 ms, which
means that NeuFA always predicts more accurate boundaries than
MFA. This can also be demostrated by the accuracies at different
tolerances (percentage below a cutoff) evaluated and shown in Table
2. The accuracies are improved by 0.14, 0.04, 0.01 at 10, 25 and 50
ms tolerances for word level, and 0.05, 0.03, 0.01 at corresponding
tolerances for phoneme level. At 100 ms tolerance, the performance
of NeuFA is on par with MFA.


Understanding AI alignment research: A
Systematic Analysis
Jan H. Kirchner [∗] Logan Smith [∗]
kirchner.jan@icloud.com logansmith5@gmail.com
Jan H. Kirchner [∗]
Logan Smith [∗] Jacques Thibodeau [∗]
logansmith5@gmail.com thibo.jacques@gmail.com
thibo.jacques@gmail.com
Kyle McDonell Laria Reynolds
kyle@conjecture.dev laria@conjecture.dev
Kyle McDonell
laria@conjecture.dev

Researching Alignment Research: Unsupervised Analysis

Jan H. Kirchner
Logan Smith
Jacques Thibodeau
Kyle McDonell
Laria Reynolds


AI alignment research is the field of study dedicated to ensuring that artificial intelligence
(AI) benefits humans. As machine intelligence gets more advanced, this research is
becoming increasingly important. Researchers in the field share ideas across different
media to speed up the exchange of information. However, this focus on speed means that
the research landscape is opaque, making it difficult for young researchers to enter the
field. In this project, we collected and analyzed existing AI alignment research. We found
that the field is growing quickly, with several subfields emerging in parallel. We looked
at the subfields and identified the prominent researchers, recurring topics, and different
modes of communication in each. Furthermore, we found that a classifier trained on
AI alignment research articles can detect relevant articles that we did not originally
include in the dataset. We are sharing the dataset with the research community and
hope to develop tools in the future that will help both established researchers and young
researchers get more involved in the field.


_AI alignment research_ is a nascent field of
research concerned with developing machine intelligence in ways that achieve desirable outcomes and avoid adverse outcomes [1,2] . While the term _alignment prob-_
_lem_ was originally proposed to denote the
problem of "pointing an AI in a direction" [3],
the term _AI alignment research_ is now used
as an overarching term referring to the entire research field associated with this problem [2,4–9] . Associated lines of research include the question of how to infer human
values as revealed by preferences [10], how to
prevent risks from learned optimization [11],
or how to set up an appropriate structure
of governance to facilitate coordination [12] .
∗These authors contributed equally.
As machine intelligence becomes increasingly capable [13,14], AI alignment research
becomes increasingly important. There is a
risk that if machine intelligence is not carefully designed, it could have catastrophic
consequences for humanity [15–17] . For example, if machine intelligence is not designed to take human values into account,
it could make decisions that are harmful
to humans [15] . Alternatively, if machine intelligence is not designed to be transparent and understandable to humans, it could
make decisions that are opaque to humans
and difficult to understand or reverse [18] . As
machine intelligence rapidly becomes more
powerful [14], the stakes associated with the
AI alignment problem only grow. Consequently, the field receives considerable at
Understanding AI alignment research: A Systematic Analysis
tention from philanthropic organizations
searching to increase the speed and scope
of research [19,20] .
One interesting feature of AI alignment
research is how the researchers communicate: to increase the speed and bandwidth of information exchange, novel insights and ideas are exchanged across various media. Beyond the traditional research article published as a preprint or
conference article, a substantial portion of
AI alignment research is communicated on
a curated community forum: the Alignment Forum [21] . Other channels of communication include formal and informal
talks [22], semi-publicly shared manuscripts
and notes [17,23], and informal exchanges via
instant messaging [24] .
The strong focus on increased speed and
bandwidth of communication comes at the
cost of a diffuse research landscape, making it difficult for newcomers to orient
themselves [25,26] . These difficulties are exacerbated by the short time the field has
existed and the resulting lack of unifying paradigms [27,28] . Previous attempts to
catalog and classify existing AI alignment
research [29–32] do not include all relevant
sources, are not kept up-to-date, and do
not provide easy access to the data in a
machine-readable format. Given the potential importance of AI alignment research and the attempts to increase the size
of the field [19,20], the lack of a coherent
overview of the research landscape represents a major bottleneck.
In this project, we collected and cataloged
AI alignment research literature and analyzed the resulting dataset in an unbiased
way to identify major research directions.
We found that the field is growing rapidly,
with several subfields emerging naturally
over time. By analyzing the emerging subfields, we can identify the prominent researchers working in the subfield, recurring topics and questions specific to each
subfield, and different modes of communication dominating each subfield. Finally,
training a classifier to distinguish AI alignment research from more general AI research can automatically detect relevant articles published too recently to be included
in our dataset. We make our dataset and the
analysis publicly available to interested researchers to enable further analysis and facilitate orientation to the field.


To capture the current state of AI alignment research, we collected research articles from various sources (Tab. 1). Beyond the full-length manuscript published
on arXiv ( _𝑁_ = 707), we also included
shorter communications published on the
Alignment Forum ( _𝑁_ = 2 _,_ 138), blogs, and
personal websites ( _𝑁_ = 1 _,_ 326), publicly
available, full-length books ( _𝑁_ = 23), a
popular AI alignment research newsletter
with summaries of articles ( _𝑁_ = 420), fulllength manuscripts not published on arXiv
( _𝑁_ = 372), transcripts of lectures and interviews ( _𝑁_ = 494), and entries from public
wikis ( _𝑁_ = 582). To establish a baseline for
our analysis, we also collected research articles from adjacent ( _𝑁_ = 1 _,_ 679) and unrelated ( _𝑁_ = 1 _,_ 000) areas of research, as
well as shorter communications published
on the LessWrong Forum ( _𝑁_ = 28 _,_ 259).
For details about our collection procedure,
Understanding AI alignment research: A Systematic Analysis
see the Methods section.


**two platforms.**
There was substantial heterogeneity in the
form and quality of articles in the dataset.
We decided to focus on articles published
on the Alignment Forum and as preprints
on the arXiv server (see Methods for arXiv
inclusion criteria). These sources contain
a large portion of the entire published AI
alignment research (Tab. 1) and are structured in a consistent form that allows automated analysis.
To quantify the field’s growth, we visualized the number of articles published on
either platform as a function of time. We
found a rapid increase from 2017 [3] to 2022
(present) from less than 20 articles per year
to over 400 (Fig. 1a). When calculating the
number of articles published per researcher,
we observed a long-tailed distribution with
most researchers publishing less than five
articles and some publishing more than 60
(Fig. 1b). Finally, when comparing the
number of researchers per article on the
Alignment Forum and the arXiv, we noticed that articles on the Alignment Forum
tend to be written by either just a single
author or by a small team of fewer than
five researchers (Fig. 1c; purple). In contrast, the distribution of authors on arXiv
articles is long-tailed and includes articles
with more than 60 authors [35–37] (Fig. 1c;
green). This asymmetry partially results
from the late introduction of the multi
3We note that the Alignment Forum was created
in 2018 [34] .
ple authors feature to the Alignment Forum [1], but might also reflect the Alignment Forum’s focus on speed of communication, which disincentivizes large collaborations [38] . Alternatively, the larger number
of authors on arXiv articles might also reflect inflation of (unjustified) authorship on
research articles [39,40] .
Thus, AI alignment research is a rapidly
growing field, driven by many researchers
contributing individual articles and a few
publishing prolifically.


**tinct clusters.**
Given the collected AI alignment research
articles from the Alignment Forum and
arXiv, we were curious whether we could
use the text to understand the current state
of research. To this end, we used the Allen
SPECTER model [41] to compute a sentence
embedding, followed by a UMAP projection [42] to obtain a low-dimensional representation (Fig. 2a). While there is a tendency for articles from different sources to
occupy different regions of the embedding,
the transition between Alignment Forum
and arXiv is fluent (Fig. 2b). Interestingly,
when visualizing the publication date, we
noticed that the embedding captures part of
the temporal evolution of the field (Fig. 2c).
Due to the relative youth of the field,
there is no universally-accepted decomposition of AI alignment research into subfields [22,28,43] . To see if we can produce a
1The feature to add multiple authors didn’t become
available to all users until 2019, and many people may
still not be aware of how to do it.
Understanding AI alignment research: A Systematic Analysis


|Alignment Forum|alignmentforum.org
lesswrong.com|2,138
28,252|
|---|---|---|
|**arXiv**|AI alignment research (level-0)
AI research (level-1)
arXiv.org/search/?query=quantum
arXiv.org/list/cs.AI (filtered)|707
1,679
1,000
4,621|
|**Books**|(available upon request)|23|
|**Blogs**|aiimpacts.org
aipulse.org
aisafety.camp
carado.moe
cold-takes.com
deepmindsafetyresearch.medium.com
generative.ink
gwern.net
intelligence.org
jsteinhardt.wordpress.com
qualiacomputing.com
vkrakovna.wordpress.com
waitbutwhy.com
yudkowsky.net|227
23
8
59
111
10
17
7
479
39
278
43
2
23|
|**Newsletter**|rohinshah.com/alignment-newsletter/ summaries|420|
|**Reports**|pdf-only articles
distill.pub|323
49|
|**Audio transcripts**|youtube.com playlist 1 & 2
Assorted transcripts
interviews with AI researchers33|457
25
12|
|**Wikis**|arbital.com
lesswrong.com (Concepts Portal)
stampy.ai|223
227
132|
|**Total:**|Total token count: 89,240,129
Total word count: 53,550,146
Total character count: 351,757,163||
Table 1: **Different sources of text included in the dataset alongside the number**
**of articles per source.** Color of row indicates that data was analyzed as AI alignment
research articles (green) or baseline (gray), or that the articles were added to the dataset
as a result of the analysis in Fig. 4 (purple). Definition of level-0 and level-1 articles in
Fig. 4c. For details about our collection procedure see the Methods section.
Understanding AI alignment research: A Systematic Analysis
10 [4]
10 [2]


|Col1|S. Armstrong
S. Garrabrant
A. Demsk
J. Wentworth
P. Christiano
S. Levine|
|---|---|
|||
0 60 - 60
articles per researcher
researchers per article
2000 2010 2020
time (years)
Figure 1: **Alignment research across a community forum and a preprint server.** ( **a** )
Number of articles published as a function of time on the Alignment Forum (AF; purple)
and the arXiv preprint server (arXiv; green). ( **b** ) Histogram of the number of articles
per researcher published on either AF or arXiv. Inset shows names of six researchers
with more than 60 articles. Note the logarithmic y-axis. ( **c** ) Histogram of the number
of researchers per article on AF (purple) and arXiv (green). Note the logarithmic y-axis.


title
+
embedding
(768 dim.)
UMAP
embedding
(2 dim.)
Figure 2: **Dimensionality reduction and unsupervised clustering of alignment**
**research.** ( **a** ) Schematic of the embedding and dimensionality reduction. After
concatenating title and abstract of articles, we embed the resulting string with the
Allen SPECTER model [41], and then perform UMAP dimensionality reduction with
n_neighbors=250. ( **b** ) UMAP embedding of articles with color indicating the source
(AF, purple; arXiv, green). ( **c** ) UMAP embedding of articles with color indicating date
of publication. Arrows superimposed to indicate direction of temporal evolution. ( **d** )
UMAP embedding of articles with color indicating cluster membership as determined
with k-means (k=5). Inset shows sum of residuals as a function of clusters k, with an
arrow highlighting the chosen number of clusters.
Understanding AI alignment research: A Systematic Analysis
useful, unbiased decomposition of the research landscape, we applied k-means clustering to the SPECTER embedding to obtain five distinct clusters (see Methods for
details).
In summary, combined semantic embedding and dimensionality reduction produce
a compact visualization of AI alignment research.


**the identified clusters.**
Having identified five distinct research
clusters, we asked ourselves if we could
find natural descriptions of research topics
and prominent researchers. Therefore, we
inspected which researchers tend to publish the highest number of articles in each
cluster (Tab. 2). Even though the names
of researchers did not enter into the Allen
SPECTER sentence embedding (Fig. 2a),
we observed that different researchers tend
to dominate different research clusters. The
distribution of researchers across clusters
lead us to assign putative labels to the clusters (Fig. 3a):
- **cluster one** : _Agent alignment_ is concerned
with the problem of aligning agentic systems, i.e. those where an AI performs actions in an environment and is typically
trained via reinforcement learning.
- **cluster two** : _Alignment foundations_ is concerned with _deconfusion_ research, i.e. the
task of establishing formal and robust conceptual foundations for current and future
AI alignment research.
- **cluster three** : _Tool alignment_ is concerned with the problem of aligning nonagentic (tool) systems, i.e. those where an
AI transforms a given input into an output. The current, prototypical example of
tool AIs is the "large language model" [35,44] .
- **cluster four** : _AI governance_ is concerned
with how humanity can best navigate the
transition to advanced AI systems. This
includes focusing on the political, economic, military, governance, and ethical
dimensions [12] .
- **cluster five** : _Value alignment_ is concerned
with understanding and extracting human
preferences and designing methods that
stop AI systems from acting against these
preferences.
To corroborate these putative labels, we
computed a word cloud representation of
the articles (Sup. Fig. 1). We found the recurring words specific to each cluster to be
in good agreement with the labels. We also
note that our labels are consistent with our
observation that alignment foundations research is the historical origin of AI alignment research (Fig. 2c, Fig. 3b,c). Furthermore, we observe that theoretical research
(alignment foundations, value alignment,
AI governance) tends to be published on
the Alignment Forum. In contrast, applied
research (agent alignment, tool alignment)
tends to be published on arXiv (Fig. 2b,
Fig. 3d). Finally, we note that in the
alignment foundations cluster, a few individual researchers tend to produce a disproportionate number of research articles
(Fig. 3e).
In combination, these arguments make us
hopeful that our unsupervised decomposition of AI alignment research mirrors relevant structures existing in the field. We
hope to leverage the decomposition to pro
Understanding AI alignment research: A Systematic Analysis
|cluster 1; 𝑁= 567 (agent alignment)|cluster 2; 𝑁= 988 (alignment founda- tions)|cluster 3; 𝑁= 593 (tool alignment)|cluster 4; 𝑁= 383 (AI governance)|cluster 5; 𝑁= 670 (value alignment)|
|---|---|---|---|---|
|S. Levine (55)|S. Armstrong (154)|J. Steinhardt (20)|D. Kokotajlo (21)|S. Armstrong (54)|
|P. Abbeel (34)|S. Garrabrant (95)|D. Hendrycks (17)|A. Dafoe (19)|S. Byrnes (32)|
|A. Dragan (29)|A. Demski (94)|E. Hubinger (14)|G. Worley III (11)|P. Christiano (29)|
|S. Russell (23)|J. Wentworth (57)|P. Christiano (13)|J. Clarck (10)|R. Ngo (25)|
|S. Armstrong (22)|"Diﬀractor" (44)|P. Kohli (11)|S. Armstrong (9)|R. Shah (25)|
Table 2: **Researchers with the highest number of articles per cluster.** Clusters as
_𝑁_
determined in Fig. 2, with number of articles per cluster . Number in brackets behind researcher name indicates number of articles published by that researcher. Note:
"Diffractor" is an undisclosed pseudonym.
**a** _“alignment_
alignment
forum arxiv


2.5k
_“value_
_alignment”_ _alignment”_
2015 2018 2021
time (years)
2015 2018 2021
time (years)
|Col1|Col2|Col3|Col4|Col5|
|---|---|---|---|---|
||||||
|
|

|

|

|

|
Figure 3: **Characteristics of research clusters corroborate potential usefulness of**
**decomposition.** ( **a** ) UMAP embedding of articles with color indicating cluster membership as in Fig. 2d. Labels assigned to each cluster are putative descriptions of a common
research focus across articles in the cluster. ( **b** ) Number of articles published per year, colored by cluster membership. ( **c** ) Fraction of articles published by cluster membership as a
function of time. ( **d** ) Fraction of articles from AF or arXiv as a function of cluster membership. ( **e** ) GINI inequality coefficient of articles per researcher as a function of article
cluster membership.
Understanding AI alignment research: A Systematic Analysis
vide researchers structured access to the existing literature in future work.


**alignment research classifier.**
When quantifying the number of articles
across different sources, we noticed a dramatic drop-off in articles published on the
arXiv after 2019 (Fig. 1a). Especially in
contrast with the continued strong increase
in articles published on the Alignment Forum, we suspected that our data collection
might have missed some more recent, relevant work [1] .
To automatically detect articles published
more recently, we decided to train a logistic regression classifier on the semantic embeddings of arXiv articles. Besides
the AI alignment research articles already
included in our dataset ("arXiv level-0";
Fig. 4a green), we also collected all arXiv
articles cited by level-0 articles, which
were not level-0 articles themselves ("arXiv
level-1"; Fig. 4a blue). We trained the classifier on a training set (80%) to distinguish
level-0 from level-1 articles and evaluated
performance on a separate test set (20%).
The classifier achieved good performance
(AUC= 0 _._ 75; Fig. 4b inset), reliably rejecting level-1 articles and correctly identifying a large portion of level-0 articles
(Fig. 4b). To test whether the classifier robustly generalizes beyond AI research, we
tested it on 1000 recently published articles
on quantum physics and the Alignment Forum. We found that the classifier reliably
1In particular, for our dataset, we manually extended an existing collection of arXiv articles from
2020 [31], see Methods section for details.
rejects quantum physics and accepts Alignment Forum articles (Fig. 4b,d).
Most AI alignment research articles on the
arXiv are published in the cs.AI section.
Therefore we used the arXiv API [45] to collect all articles from that section (Fig. 4c).
When applying our classifier to the semantic embeddings of the cs.AI articles,
we observed a slightly bimodal distribution
with most articles receiving a score close
to 0%, and some articles receiving a score
close to 100% (Fig. 4d). Motivated by the
distribution of scores of Alignment Forum
articles and by individual inspection, we
chose a threshold at 75% and considered articles above that threshold as AI alignment
research-relevant and added them to our
dataset. As anticipated, we found that the
number of AI alignment-relevant arXiv articles increases as rapidly over time as the
articles published on the Alignment Forum
(Fig. 4e). Finally, to verify that the addition of AI alignment-relevant arXiv articles
does not affect our unsupervised decomposition, we repeated the UMAP dimensionality reduction on the updated dataset. We
found that cluster structure is not disrupted
(Fig. 4f ).
In conclusion, our analysis demonstrates
that semantic embedding can capture relevant characteristics of AI alignment research and that automatic filtering of new
publications might be feasible.


The field of AI alignment research is growing quickly, with many researchers publishing articles on diverse topics. We
found that semantic embedding and di
Understanding AI alignment research: A Systematic Analysis
**e** 1500
train
test
clu. 1 clu. 2 clu. 3
clu. 4 clu. 5
2000 2010 2020
time (years)


0.3
0.1
|1 d quantum physics|Col2|Col3|
|---|---|---|
|0
1
FP rate
0
1
TP rate
AUC
0.75
arxiv
level-0
arxiv
level-1
|0
1
FP rate
0
1
TP rate
AUC
0.75
arxiv
level-0
arxiv
level-1
|0
1
FP rate
0
1
TP rate
AUC
0.75
arxiv
level-0
arxiv
level-1
|
||||
|Col1|Col2|cutoff|Col4|
|---|---|---|---|
||alignment
forum
arxiv
cs.AI
|alignment
forum
arxiv
cs.AI
|alignment
forum
arxiv
cs.AI
|
|||||
|||||
Figure 4: **An AI alignment research classifier for filtering new publications.** ( **a** )
Top: Illustration of arXiv level-0 articles (alignment research; green) and level-1 articles (cited by alignment research articles; blue). Bottom: Schematic of test-train split
(20%-80% for training of a logistic regression classifier. ( **b** ) Fraction of articles as a function
of classifier score for arXiv level-0 (green), level-1 (blue), and arXiv articles on quantum
physics (grey). ( **c** ) Illustration of procedure for filtering arXiv articles. After querying
articles from the cs.AI section of arXiv, the logistic regression classifier assigns a score
between 0 and 1. ( **d** ) Fraction of articles as a function of classifier score for articles from
the cs.AI section of arXiv (grey) and AF (purple). Dashed line indicates cutoff for classifying articles as arXiv level-0 (75%). ( **e** ) Number of articles published as a function of
time on AF (purple) and arXiv (green), according to the cutoff in panel **d** . ( **f** ) Left inset:
Original UMAP embedding from Fig. 2d. Right: UMAP embedding of all original articles and updated arXiv articles with color indicating cluster membership as in Fig. 2d
or that the article is filtered from the arXiv (gray).
Understanding AI alignment research: A Systematic Analysis
mensionality reduction can produce a compact visualization of AI alignment research.
This decomposition of AI alignment research mirrors known structures in the
field, demonstrating that semantic embedding can capture relevant characteristics of
AI alignment research. Furthermore, we
demonstrate the possible feasibility of automatically detecting new publications relevant to AI alignment research. In the future, we hope that our decomposition can
provide researchers with structured access
to the existing literature.
**Tools for alignment researchers.** Our
presented research suggests several exciting possible applications for improving
the research landscape in AI alignment
research. We have begun to explore
this potential by developing several prototypes that use the collected dataset to
interactively explore semantic embeddings
(Sup. Fig. 2), to provide summaries of long
articles (Sup. Fig. 3), or to search and compare articles (Sup. Fig. 4). Thanks to the
focus on speed and the openness to innovation of the AI alignment research community, we believe that tools tailored to
this community might reach broad adoption and help accelerate research efforts.
**Paradigmatic AI alignment research.** In
the language of Thomas Kuhn [27], the successive transition from one paradigm to another via revolution is the usual developmental pattern of mature science. Some
researchers argue that AI alignment research is pre-paradigmatic, meaning that it
has not yet converged on a single, dominant paradigm or approach. While our
research demonstrates that decomposition
of AI alignment research into meaningful
subfields is possible, we note that the choice
of the number of subfields has a subjective
component (Fig. 2d). Furthermore, the semantic similarity between articles in a cluster does not imply similarity in methodology or underlying research agenda. However, we do not believe that this implies the
impossibility of progress. In fact, the current exploratory nature of AI alignment research might be a strength, as exploration
helps to avoid ossification.
**Limitations.** Especially due to the rapid
expansion of the field (Fig. 1), classifications and descriptions of the state-of-theart might become inaccurate soon after
publication. While the observation that
our clustering remains stable after including many articles not used for the original
clustering (Fig. 4) makes us hopeful, we still
plan to carefully monitor the field and publish regular updates to our analysis.
The decision to focus on the two largest,
non-redundant sources of articles (Alignment Forum and arXiv) might systematically exclude certain lines of research and
thus bias our analysis. However, as a substantial fraction of blog posts, reports and
the alignment newsletter tend to be crossposted or announced on the Alignment Forum we think a strong bias is unlikely.
In summary, by collecting a comprehensive dataset of published AI alignment research literature, we demonstrate rapid
growth of the field over the last five years
and identify emerging directions of research through unbiased clustering.
Understanding AI alignment research: A Systematic Analysis