###  VI.3 Candidates of $K$-groups

For the $i$-th candidate $cE_{4,i}\in{\cal S}_{k}$ on the $E_{4}$-page, we
write the set of $K$-groups ${}^{\phi}K^{(z,c)-n}_{G}(X)$ that can be obtained
as a result of the extension (192) as

$\displaystyle cK^{-n}_{i}=\\{cK^{-n}_{i,a}\\}_{a=1,\dots,|cK^{-n}_{i}|},\quad
n=0,\dots,7.$ (306)

Similarly, for the $j$-th candidate $cE^{4,j}\in{\cal S}_{r}$ on the $E^{4}$
page, we write the set of $K$-groups ${}^{\phi}K^{\cal G}_{(z^{\rm
int},c)-n}(\mathbb{E}^{3})$ that can be obtained as a result of the extension
(194) as

$\displaystyle cK_{-n}^{j}=\\{cK_{-n}^{j,a}\\}_{a=1,\dots,|cK_{-n}^{j}|},\quad
n=0,\dots,7.$ (307)

Now, for all degrees $n=0,\dots,7$, if the intersection of the $K$-group
candidates $cK^{n}_{i}$ and $cK_{-n}^{j}$ is not an empty set, there is no
contradiction with the isomorphism (105). The set of compatible pairs $(i,j)$
is defined as

$\displaystyle{\cal S}_{\rm pair}=\\{(i,j)$ $\displaystyle|cK^{n}_{i}\cap
cK^{j}_{-n}\neq\emptyset{\rm\ for\ all\ }n=0,\dots,7\\}.$ (308)

The set of $\mathbb{Z}$-modules that can be candidates for the $K$-groups of
degree $(-n)$ in real space (i.e., the $K$-groups of degree $n$ in momentum
space) is obtained by the intersection

$\displaystyle SK_{-n}:=\bigcap_{(i,j)\in{\cal S}_{\rm pair}}cK^{n}_{i}\cap
cK^{j}_{-n}.$ (309)

The set of $K$-group candidates $SK_{-n}$ is shown in the Supplemental
material [52] and is also available at http URL.

For the example of spinful class D SC with MSG $P2_{1}1^{\prime}$ and
$A$-representation of pairing symmetry, of which $E_{2}$\- and $E^{2}$-pages
are shown in Tables 3 and 4, respectively, the set of candidates for the
$K$-groups is shown in Table 5. In cases like this example, despite the
existence of multiple possibilities for higher-order derivatives and
extensions, comparing the $E_{2}$-page in momentum space and the $E^{2}$-page
in real space allows us to impose significant constraints on the $K$-groups.

$\begin{array}[]{ll}SK_{-n}&\mbox{The set of candidate $K$-groups}\\\
\hline\cr n=0&\mathbb{Z}\oplus\mathbb{Z}_{4}^{\oplus
3},\mathbb{Z}\oplus\mathbb{Z}_{4}^{\oplus 2}\oplus\mathbb{Z}_{2}^{\oplus 2}\\\
n=1&\mathbb{Z}\oplus\mathbb{Z}_{2}^{\oplus 4}\\\
n=2&\mathbb{Z}\oplus\mathbb{Z}_{2}^{\oplus 3}\\\ n=3&\mathbb{Z}\\\
n=4&\mathbb{Z}\\\ n=5&\mathbb{Z}\\\ n=6&\mathbb{Z}\oplus\mathbb{Z}_{2}^{\oplus
3}\\\ n=7&\mathbb{Z}\oplus\mathbb{Z}_{4}\oplus\mathbb{Z}_{2}^{\oplus
2},\mathbb{Z}\oplus\mathbb{Z}_{2}^{\oplus 4}\end{array}$ Table 5: The set of
candidates $K$-groups of spinful class D SC with MSG $P2_{1}1^{\prime}$ and
$A$-representaion of pairing symmetry.

In three dimensions with MSG and one-dimensional representations of pairing
symmetries, three are 31050 symmetry settings in total. For the degree $n=0$
$K$-groups, which are the groups of classification of TIs and SCs,
approximately 59% of the $K$-groups are uniquely determined by comparing the
$E_{2}$ and $E^{2}$ pages. For other degrees, see Table 6.

Through this calculation, we can also obtain the set of pairs of $E_{4},E^{4}$
pages $(cE_{4,i},cE^{4,j}),(i,j)\in{\cal S}_{\rm pair}$ that have no
contradiction with the isomorphism (105). However, since the number of
elements in the set ${\cal S}_{\rm pair}$ is generally large, we do not show
the results in this paper.

##  VII Other symmetry settings

Up until the previous section, we have discussed the calculation methods for
$E_{2}$ and $E^{2}$ pages in three-dimensional space, as well as the
enumeration of possible higher-order derivatives and extensions. Extending
these methods to magnetic layer groups in two dimensions and magnetic rod
groups in one dimension is straightforward. We will not go into details here.
For magnetic layer and magnetic rod groups, we constructed the symmetry
operations using the BNS symbols listed in [53].

It is also possible to calculate the $E_{2}$ and $E^{2}$ pages and enumerate
the candidate $K$-groups for TIs and SCs protected solely by magnetic point
group symmetries, with spatial translations removed from the magnetic space
groups. The corresponding real-space $K$-groups are the relative $K$-groups
${}^{\phi}K^{\cal G}_{(z^{\rm
int},c)-n}(\mathbb{R}^{3},\partial\mathbb{R}^{3})$. For some magnetic point
groups, the $E^{2}$ pages for TIs were calculated in [54]. See also [19] for
SCs. The momentum space $K$-groups are also the relative $K$-groups
${}^{\phi}K_{G}^{(z,c)-n}(\mathbb{R}^{3},\partial\mathbb{R}^{3})$, where
$\mathbb{R}^{3}$ here represents infinite momentum space. In both real and
momentum space, the cell decomposition can be obtained by retaining only the
$p$-cells touching the origin $O$ from the cell decomposition of the
corresponding magnetic space group. As the other formulations are exactly the
same as for the magnetic space group case, we will not go into details here.
The same applies to magnetic point groups in one and two-dimensional spaces.

Similar to the magnetic space groups, Table 6 shows the percentage of symmetry
classes for which there is exactly one candidate $K$-group in the set
$SK_{-n}$ for each degree $(-n)$.

$\begin{array}[]{l|c|lllllllll}\mbox{Symmetry type}&\mbox{Number of symmetry
settings}&n=0&n=1&n=2&n=3&n=4&n=5&n=6&n=7\\\ \hline\cr\mbox{3D, magnetic space
groups}&31050&0.594&0.779&0.886&0.859&0.749&0.663&0.539&0.519\\\ \mbox{3D,
magnetic point groups}&2346&0.788&0.869&0.931&0.939&0.941&0.817&0.649&0.682\\\
\mbox{2D, magnetic layer
groups}&9264&0.88&0.966&0.975&0.964&0.941&0.914&0.801&0.751\\\ \mbox{2D,
magnetic point groups}&2364&0.951&0.978&0.976&0.974&0.984&0.936&0.769&0.795\\\
\mbox{1D, magnetic rod
groups}&6488&0.943&0.996&0.999&0.996&0.981&0.975&0.945&0.897\\\ \mbox{1D,
magnetic point groups}&1946&0.958&0.997&0.998&0.997&0.995&0.984&0.93&0.904\\\
\end{array}$ Table 6:  The proportion of symmetry classes for which the
candidate $K$-group $SK_{-n}$ is uniquely determined. The first column
indicates the spatial dimension and the presence or absence of lattice
translational symmetry.

##  VIII Conclusion

In this paper, we have developed the calculation methods for the $E_{2}$-page
and $E^{2}$-page of AHSS, and presented the results for the classification
problem of topological phases in free fermion systems, namely TIs and SCs. For
a given symmetry class, the $K$-groups in momentum space and real space are
defined independently, and both give the same $K$-group. The physical
interpretation of AHSS has already been detailed in momentum space in [14] and
in real space in [28]. In this paper, we have focused on the technical aspects
of the calculations. The $E_{2}$ and $E^{2}$ pages serve as a first
approximation in the classification problem, and in general, it is necessary
to solve higher differentials and extension problems as $\mathbb{Z}$-modules.
Although the physical interpretations of higher differentials and extension
problems are known, systematic calculation methods are still unknown except
for a few cases. In this paper, assuming that the rank of the $K$-group does
not change by higher differentials, we have enumerated possible combinations
of higher differentials and extensions for the obtained $E_{2}$ and $E^{2}$
pages, and calculated to what extent the classification results can be
restricted by the isomorphism of the $K$-groups between momentum space and
real space. As a result, about 59% of the classifications were determined for
TIs and SCs protected by MSGs. The calculation results can be obtained from
Supplemental Material [52] and url.

Finally, we summarize the calculation methods for $K$-groups that were not
mentioned in this paper.

– For simple MSG symmetries, the $K$-group may be determined by the Mayer-
Vietoris sequence. For example, in the case of Table 5, the $n=0$ degree is
known to be $\mathbb{Z}\oplus\mathbb{Z}_{4}^{\oplus
2}\oplus\mathbb{Z}_{2}^{\oplus 2}$ in Ref. [8].

– The choice of filtration for introducing AHSS is not unique. In Sec. III.2,
we set the condition that if the action of the group element $g\in G$ on the
$p$-cell is closed in $D^{p}$, then the action of $g$ preserves $D^{p}$
pointwise, but this condition can be relaxed. For example, one can take the
dual cell decomposition of the cell decomposition introduced in Sec. III.2.

– In the momentum-space AHSS, higher differentials $d_{2}^{0,0}$ and
$d_{3}^{0,0}$ correspond to symmetry indicators that detect gapless points at
generic momenta on 2-cells and 3-cells, respectively [14]. In normal states,
the correspondence between symmetry indicators and (higher) topological
insulators [55, 56, 57], or gapless semimetals [58, 57], is well-established.
As a result, some calculations in Sec. VI.1 can be replaced with known higher
differentials to get more correct $E_{\infty}$ page. Although symmetry
indicators for superconductors have been proposed and classified [59, 60, 61],
a comprehensive correspondence between (higher) topological superconductors
and gapless superconductors has yet to be achieved.

– In the real-space AHSS, some higher differentials have been systematically
calculated for some symmetry classes. In Ref. [21], for time-reversal
symmetric SCs with trivial pairing symmetry, a part of $d^{2}$ is calculated
based on the equivalence between the second differential $d^{2}_{2,-2}$ of the
real space AHSS and the superconducting vortex zero modes.

– $K$-groups are not just $\mathbb{Z}$-modules but are modules over some
$K$-group. For example, in the problem setting of this paper, the $K$-group is
a module over the representation ring $R(G_{0})$ of the point group $G_{0}$.
The differentials are homomorphisms as an $R(G_{0})$-module, and the extension
is that as an $R(G_{0})$-module. Although we did not discuss the
implementation of the module structure in this paper, it is expected to impose
strong constraints on the construction of higher differentials and the
solution of extension problems.

###### Acknowledgements.

We thank Hoi Chun Po for collaborations on earlier works. KS thanks Yosuke
Kubota for helpful discussions. KS was supported by The Kyoto University
Foundation, JST CREST Grant No. JPMJCR19T2, and JSPS KAKENHI Grant No.
22H05118. SO was supported by KAKENHI Grant No. JP20J21692 from the Japan
Society for the Promotion of Science. We thank the YITP workshop YITP-T22-02
on “Novel Quantum States in Condensed Matter 2022”, which was useful in
completing this work.

##  Appendix A An algorithm computing cell decomposition

This section presents an example of how to construct the cell decomposition
introduced in Sec. III.2. We describe the cell decomposition of real space in
three dimensions. The cell decomposition in momentum spaces in lower
dimensions can also be obtained in the same way. The input is an MSG ${\cal
G}$, which is equipped with the set of symmetry actions $x\to g(x)$ for
$g\in{\cal G}$ on points $x\in\mathbb{R}^{3}$. We first describe how a
stereohedron, a convex polyhedron that fills space isohedrally, is given. Such
a stereohedron is also called a fundamental domain or an asymmetric unit.
Next, we explain a method to compute 2-, 1-, and 0-cells in order, starting
from the boundary of the stereohedron.

###  A.1 Fundamental domain

Let ${\cal G}$ be an MSG. Pick a reference point $a\in\mathbb{R}^{3}$ such
that the little group ${\cal G}_{a}=\\{g\in{\cal G}|g(a)=a\\}$ is the same as
that for generic points in $\mathbb{R}^{3}$. From such a reference point, a
stereohedron is given by ([62], Theorem 1.2.1.)

$\displaystyle DV(a)$ $\displaystyle=\\{x\in\mathbb{R}^{3}|$
$\displaystyle|x-a|<|x-g(a)|\mbox{ for all }g\in{\cal G}\backslash{\cal
G}_{a}\\}.$ (310)

($DV$ means the Dirichlet-Voronoi stereohedron in [62].) Note that $DV(a)$ is
convex.

The set of vertices of the stereohedron $DV(a)$ is computed as follows. Only
points in the orbit ${\cal G}(a)=\\{g(a)|g\in{\cal G}\\}$ near the reference
point $a$ are needed. We represent the lattice translation group elements
$\tau\in\Pi$ by $\tau=\\{1|t\\}$, where $t\in\mathbb{R}^{3}$ is the lattice
translation vector. For $\tau=\\{1|t\\}\in\Pi$, we introduce the open slab

$\displaystyle S_{a}(t)$
$\displaystyle:=\\{x\in\mathbb{R}^{3}|(a-t,t)<(x,t)<(a+t,t)\\}.$ (311)

Let $t_{1},t_{2},t_{3}$ be a basis of the group of lattice translations. The
following holds true ([62], Lemma B.2.). The subset ${\cal O}$ of the orbit
${\cal G}(a)$ defined by

$\displaystyle{\cal O}$ $\displaystyle=\left(({\cal
G}(a)\backslash\\{a\\})\cap\bigcap_{i=1}^{3}S_{a}(t_{i})\right)$
$\displaystyle\cup\\{\pm t_{1}(a),\pm t_{2}(a),\pm t_{3}(a)\\}$ (312)

suffices for computing $DV(a)$. For a set of points ${\cal S}$, let us
introduce the Dirichlet-Voronoi stereohedron

$\displaystyle DV(a;{\cal S})$ $\displaystyle:=\\{x\in\mathbb{R}^{3}|$
$\displaystyle|x-a|<|x-p|\mbox{ for all }p\in{\cal S}\\}.$ (313)

The above implies that $DV(a)=DV(a;{\cal O})$. We call ${\cal O}$ the set of
relevant points of $a$.

To efficiently compute $DV(a)$, we can do the following. Introduce two subsets
of ${\cal O}$ by ${\cal O}_{0}:=\\{\pm t_{1}(a),\pm t_{2}(a),\pm t_{3}(a)\\}$
and ${\cal O}^{\prime}:=({\cal
G}(a)\backslash\\{a\\})\cap\bigcap_{i=1}^{3}S_{a}(t_{i})$ such that ${\cal
O}_{0}\cup{\cal O}^{\prime}={\cal O}$. As a starting big open polyhedron,
define $DV(a)_{0}=DV(a;{\cal O}_{0})$. We sort the set of points in order of
distance from $a$ and do the following for all the points
$p_{1},\dots,p_{|{\cal O}^{\prime}|}\in{\cal O}^{\prime}$ step by step. For
$p_{i}\in{\cal O}^{\prime}$, if there is a vertex of $DV(a)_{i-1}$ in the
region $\\{x\in\mathbb{R}^{3}||x-a|>|x-p_{i}|\\}$, set ${\cal O}_{i}={\cal
O}_{i-1}\cup\\{p_{i}\\}$ and update $DV(a)_{i-1}$ by $DV(a;{\cal O}_{i})$,
otherwise ${\cal O}_{i}={\cal O}_{i-1}$ and $DV(a)_{i}=DV(a)_{i-1}$. In the
end, we get $DV(a)=DV(a)_{|{\cal O}^{\prime}|}$.

Note that $DV(a)$ depends on the reference points $a$.

###  A.2 Cell decomposition of the boundary of $DV(a)$

In this section, we denote the interior of the convex hull of a convex set $e$
by $\tilde{e}$. To specify the 3-cell $DV(a)$, we use the set of corner
vertices $e^{3}=\\{x_{1},x_{2},\dots\\}$ of $DV(a)$. Similarly, let
$e^{2}_{i}\subset e^{3},i=1,\dots,$ be the sets of corner vertices of boundary
convex polygons of $DV(a)$.

The convex polygon $\tilde{e}^{2}_{i}$ may not be a 2-cell in the definition
in Sec. III.2, since there may exist $x\in\tilde{e}^{2}_{i}$ and $g\in{\cal
G}$ such that $g(x)\neq x$. If this is the case, we properly divide
$e^{2}_{i}$ into smaller polygons. There are only two cases: (i) There is an
inversion center in $\tilde{e}^{2}_{i}$. (ii) There is a two-fold axis in
$\tilde{e}^{2}_{i}$. Otherwise, there exists a reflection plane intersecting
$\tilde{e}^{2}_{i}$. The case (i) can be detected by comparing the little
group $G_{\bar{x}}$ of the midpoint $\bar{x}=\frac{1}{|e^{2}_{i}|}\sum_{x\in
e^{2}_{i}}x$ with the little group $G_{x}$ of a generic point in
$\tilde{e}^{2}_{i}$. The case (ii) can be detected by introducing the
barycentric subdivision of a convex polygon $e^{2}_{i}$ and comparing the
little groups $G_{x^{\prime}}$ of a generic point $x^{\prime}$ inside the line
segments of the barycentric subdivision and the little group $G_{x}$ of a
generic point of $\tilde{e}^{2}_{i}$. In this way, we get the set of 2-cells.

For the line segments $e^{1}_{i},i=1,\dots,$ of the boundary of each 2-cell,
we divide $e^{1}_{i}$ into a set of line segments, if necessary. The little
group of the midpoint $\bar{x}$ of the line segment $e^{1}_{i}$ may be
strictly larger than the little group of a generic point of the line segment
$e^{1}_{i}$. If this is the case, we divide $e^{1}_{i}$ into the two line
segments.

##  Appendix B Computing irreducible characters

In this section we give a method to derive all the irreducible characters for
a given finite group $G$ with a factor system $z_{g,h}$ [63]. For the basis
$\\{\ket{g}\\}_{g\in G}$ labeled by the group elements, the (left) regular
representation is defined by $\hat{g}\ket{k}=z_{g,k}\ket{gk}$. The
representation matrix $u^{R}_{g}$, which is defined by
$\hat{g}\ket{k}=\sum_{h\in G}[u^{R}_{g}]_{hk}$, is

$\displaystyle[u^{R}_{g}]_{hk}=z_{g,k}\delta_{h,gk}.$ (314)

As a matter of fact, the regular representation decomposes as a direct sum of
the irreps, and each irrep appears with the number of its dimension of the
irrep. Namely,

$\displaystyle R=\bigoplus_{\alpha\in\\{{\rm irreps}\\}}\alpha^{\oplus{\rm
dim\,}\alpha}.$ (315)

The key point here is that the regular representation includes all the irreps.

Given a Hermitian random matrix $H$, symmetrizing it by

$\displaystyle H^{G}=\frac{1}{|G|}\sum_{g\in G}u_{g}Hu_{g}^{-1}$ (316)

and diagonalizing $H^{G}$, we get the eigenvector $\ket{\phi_{\alpha}}$ for
irreps $\alpha$. If the matrix $H$ is taken at random, there is no accidental
degeneracy of ${\rm dim\,}\alpha$ numerically. The irreducible character is
given by $\chi^{\alpha}_{g}={\rm
tr\,}[\braket{\phi_{\alpha}}{\hat{g}}{\phi_{\alpha}}]$

##  Appendix C Computation in $\mathbb{Z}$-module

Let $A$ and $B$ $\mathbb{Z}$-modules. For a homomorphism

$\displaystyle f:A\to B,$ (317)

we summarize how to compute ${\rm Im\,}f$ and ${\rm Ker\,}f$. Firstly, we
express the group $A$ as the quotient groups between torsion free
$\mathbb{Z}$-modules as $A=\tilde{A}/P_{A}$ and $B=\tilde{B}/P_{B}$. For
example, if
$A=\mathbb{Z}^{n}\oplus\mathbb{Z}/k_{1}\mathbb{Z}\oplus\cdots\oplus\mathbb{Z}/k_{u}\mathbb{Z}$
be the invariant factor decomposition of $A$, then $\tilde{A}$ and $P_{A}$ can
be
$\tilde{A}=\mathbb{Z}^{n}\oplus\underbrace{\mathbb{Z}\oplus\cdots\oplus\mathbb{Z}}_{u}$
and $P_{A}=k_{1}\mathbb{Z}\oplus\cdots\oplus k_{u}\mathbb{Z}$. Set a lifted
homomorphism $\tilde{f}:\tilde{A}\to\tilde{B}$ such that the following diagram
commutes.

$\displaystyle\begin{CD}0@>{}>{}>P_{A}@>{}>{}>\tilde{A}@>{}>{}>A@>{}>{}>0\\\
@V{\tilde{f}}V{}V@V{\tilde{f}}V{}V@V{f}V{}V\\\
0@>{}>{}>P_{B}@>{}>{}>\tilde{B}@>{}>{}>B@>{}>{}>0\\\ \end{CD}$ (318)

Assuming commutativity on the right side of the diagram,

$\displaystyle\tilde{f}(\tilde{a}\in\tilde{A}){\rm\ mod\
}P_{B}=f(\tilde{a}{\rm\ mod\ }P_{A}),$ (319)

commutativity on the left side, $\tilde{f}(P_{A})\subset P_{B}$, follows from
$\tilde{f}(P_{A}){\rm\ mod\ }P_{B}=f(P_{A}{\rm\ mod\ }P_{A})=f(0)=0$. Given a
matrix expression $M_{f}$ of $f$ for bases of $A$ and $B$, a matrix expression
$M_{\tilde{f}}$ of such $\tilde{f}$ is obtained by considering the matrix
$M_{f}$ as $\mathbb{Z}$-valued.

###  C.1 ${\rm Im\,}f$

From (319), we have

$\displaystyle{\rm Im\,}f=\tilde{f}(\tilde{A}){\rm\ mod\
}P_{B}=\tilde{f}(\tilde{A})/(\tilde{f}(\tilde{A})\cap P_{B}).$ (320)

Using the second isomorphism theorem, we get

$\displaystyle{\rm Im\,}f=(\tilde{f}(\tilde{A})+P_{B})/P_{B}.$ (321)

Here, $\tilde{f}(\tilde{A})+P_{B}$ is the union

$\displaystyle\tilde{f}(\tilde{A})+P_{B}=\\{x+y\in\tilde{B}|x\in\tilde{f}(\tilde{A}),y\in
P_{B}\\}.$ (322)

###  C.2 ${\rm Ker\,}f$

Note that

$\displaystyle{\rm Ker\,}f$ $\displaystyle=\\{a\in A|f(a)=0\\}$
$\displaystyle=\\{\tilde{a}\in\tilde{A}|\tilde{f}(\tilde{a})\in P_{B}\\}{\rm\
mod\ }P_{A}.$ (323)

Using $\tilde{f}(P_{A})\subset P_{B}$,

$\displaystyle{\rm Ker\,}f=\\{\tilde{a}\in\tilde{A}|\tilde{f}(\tilde{a})\in
P_{B}\\}/P_{A}.$ (324)

Here, the numerator can be expressed as

$\displaystyle\\{\tilde{a}\in\tilde{A}|\tilde{f}(\tilde{a})\in P_{B}\\}$
$\displaystyle=\\{\tilde{a}\in\tilde{A}|{}^{\exists}\tilde{b}\in P_{B},{\rm\
s.t.\ }\tilde{f}(\tilde{a})+\tilde{b}=0\\}.$ (325)

Thus, introducing the homomorphism

$\displaystyle\tilde{f}\oplus{\rm Id}_{P_{B}}$ $\displaystyle:\tilde{A}\oplus
P_{B}\to\tilde{B},$
$\displaystyle(\tilde{a},\tilde{b})\mapsto\tilde{f}(\tilde{a})+\tilde{b},$
(326)

we have

$\displaystyle\\{\tilde{a}\in\tilde{A}|\tilde{f}(\tilde{a})\subset
P_{B}\\}={\rm Ker\,}(\tilde{f}\oplus{\rm Id}_{P_{B}})|_{\tilde{A}}.$ (327)

Here, ${\rm Ker\,}(\tilde{f}\oplus{\rm Id}_{P_{B}})|_{\tilde{A}}$ is the
projection of ${\rm Ker\,}(\tilde{f}\oplus{\rm Id}_{P_{B}})$ onto $\tilde{A}$.
We get

$\displaystyle{\rm Ker\,}f={\rm Ker\,}(\tilde{f}\oplus{\rm
Id}_{P_{B}})|_{\tilde{A}}/P_{A}.$ (328)

###  C.3 ${\rm Ker\,}g/{\rm Im\,}f$

Now let us consider a sequence of homomorphisms

$\displaystyle\begin{CD}A@>{f}>{}>B@>{g}>{}>C\end{CD}$ (329)

satisfying ${\rm Im\,}f\subset{\rm Ker\,}g$. By use of the formulas above, the
quotient group ${\rm Ker\,}g/{\rm Im\,}f$ is given by

$\displaystyle{\rm Ker\,}g/{\rm Im\,}f=\frac{{\rm Ker\,}(\tilde{g}\oplus{\rm
Id}_{P_{C}})|_{\tilde{B}}/P_{B}}{(\tilde{f}(\tilde{A})+P_{B})/P_{B}}.$ (330)

Applying the third isomorphism theorem to it, this is a quotient group between
torsion-free abelian subgroups of $\tilde{B}$,

$\displaystyle{\rm Ker\,}g/{\rm Im\,}f=\frac{{\rm Ker\,}(\tilde{g}\oplus{\rm
Id}_{P_{C}})|_{\tilde{B}}}{\tilde{f}(\tilde{A})+P_{B}}.$ (331)

Practically, this quotient group can be computed by first expanding the basis
of $\tilde{f}(\tilde{A})+P_{B}$ in the basis of ${\rm
Ker\,}(\tilde{g}\oplus{\rm Id}_{P_{C}})|_{\tilde{B}}$ (the pseudo-inverse
matrix can be used) and then computing the Smith normal form of the matrix
consisting of the expansion coefficients.

##  Appendix D Baer Sum

Consider two extensions of $\mathbb{Z}$-modules as follows:

$\displaystyle 0\to B\xrightarrow{f_{0}}E_{0}\xrightarrow{g_{0}}A\to 0,$ (332)
$\displaystyle 0\to B\xrightarrow{f_{1}}E_{1}\xrightarrow{g_{1}}A\to 0$ (333)

We want to construct an extension corresponding to the sum in ${\rm
Ext}_{\mathbb{Z}}^{1}(A,B)$.

$\displaystyle f:B\to E_{0}\oplus E_{1},\quad b\mapsto(f_{0}(b),-f_{1}(b)),$
(334) $\displaystyle g:E_{0}\oplus E_{1}\to A,\quad(e_{0},e_{1})\mapsto
g_{0}(e_{0})-g_{1}(e_{1}),$ (335)

Define the maps as above. The inclusion ${\rm Im\,}f\subset{\rm Ker\,}g$
follows from $b\mapsto(f_{0}(b),-f_{1}(b))\mapsto g_{0}\circ
f_{0}(b)+g_{1}\circ f_{1}(b)=0+0$. The Baer sum is given by [51]

$\displaystyle 0\to B\xrightarrow{f^{\prime}}{\rm Ker\,}g/{\rm
Im\,}f\xrightarrow{g^{\prime}}A\to 0.$ (336)

Here,

$\displaystyle f^{\prime}:B\to{\rm Ker\,}g/{\rm Im\,}f,$ $\displaystyle
b\mapsto[(f_{0}(b),0)]=[(0,f_{1}(b))],$ (337) $\displaystyle g^{\prime}:{\rm
Ker\,}g/{\rm Im\,}f\to A,$ $\displaystyle(e_{0},e_{1})\mapsto
g_{0}(e_{0})=g_{1}(e_{1}).$ (338)

Suppose $(f_{0}(b),0)=(f_{0}(b^{\prime}),-f_{1}(b^{\prime}))$. Then
$(f_{0}(b-b^{\prime}),f_{1}(b^{\prime}))=(0,0)$, and due to the injectivity of
$f_{0}$ and $f_{1}$, we have $b=b^{\prime}=0$. Notice that there is no
intersection between ${\rm Im\,}[B\to{\rm Ker\,}g,b\mapsto(f_{0}(b),0)]$ and
${\rm Im\,}f$. The well-definedness of $g^{\prime}$ follows from
$(f_{0}(b),-f_{1}(b))\mapsto g_{0}(f_{0}(b))=0=g_{1}(f_{1}(b))$. The exactness
is as follows. For the injectivity of $f^{\prime}$, suppose
$[(f_{0}(b),0)]=0$. Then, there exists $b^{\prime}\in B$ such that
$(f_{0}(b),0)=(f_{0}(b^{\prime}),-f_{1}(b^{\prime}))$, and similarly, we have
$b=0$. The surjectivity of $g^{\prime}$ follows from that $g_{0}$ and $g_{1}$
are surjective. The inclusion ${\rm Im\,}f^{\prime}\subset{\rm
Ker\,}g^{\prime}$ follows from $[f_{0}(b),0]\mapsto g_{0}(f_{0}(b))=0$. We
will show ${\rm Ker\,}g^{\prime}\subset{\rm Im\,}f^{\prime}$. Suppose
$[(e_{0},e_{1})]\mapsto g_{0}(e)=g_{1}(e^{\prime})=0$. Due to the surjectivity
of $g_{0}$ and $g_{1}$, there exist $b,b^{\prime}\in B$ such that
$e_{0}=f_{0}(b),e_{1}=f_{1}(b^{\prime})$. Then,
$[(e_{0},e_{1})]=[(f_{0}(b),f_{1}(b^{\prime}))]=[(f_{0}(b-b^{\prime}),0)]\in{\rm
Im\,}f^{\prime}$.

If we are only interested in the $\mathbb{Z}$-module resulting from the Baer
sum of extensions, it is sufficient to calculate ${\rm Ker\,}f/{\rm Im\,}g$.
If we want to take the Baer sum of the extensions obtained from the Baer sum
itself, we also need to compute the homomorphism $f^{\prime}$ and
$g^{\prime}$. We summarize the calculation method of the Baer sum, including
the homomorphisms $f^{\prime}$ and $g^{\prime}$, below.

We can assume that $A$ is a torsion $\mathbb{Z}$-module. We start with the
following commutative diagram:

$\displaystyle\begin{CD}P_{B}P_{E_{0}}\oplus P_{E_{1}}P_{A}\\\
@V{}V{}V@V{}V{}V@V{}V{}V\\\
\tilde{B}@>{\tilde{f}}>{}>\tilde{E}_{0}\oplus\tilde{E}_{1}@>{\tilde{g}}>{}>\tilde{A}\\\
@V{}V{}V@V{}V{}V@V{}V{}V\\\ B@>{f}>{}>E_{0}\oplus E_{1}@>{g}>{}>A\\\ \end{CD}$
(339)

Here, for a $\mathbb{Z}$-module $X$, $\tilde{X}$ and $P_{X}$ are free
$\mathbb{Z}$-modules such that $X=\tilde{X}/P_{X}$. Applying the formula
(331), we have

$\displaystyle\frac{{\rm Ker\,}g}{{\rm Im\,}f}\cong\frac{{\rm
Ker\,}(\tilde{g}\oplus{\rm
Id}_{P_{A}})|{\tilde{E}_{0}\oplus\tilde{E}_{1}}}{{\rm
Im\,}\tilde{f}+(P_{E_{0}}\oplus P_{E_{1}})}$ (340)

Let $b_{1},\dots,b_{n}$ be basis vectors for the sublattice ${\rm
Ker\,}(\tilde{g}\oplus{\rm
Id}_{P_{A}})|{\tilde{E}_{0}\oplus\tilde{E}_{1}}\subset\tilde{E}_{0}\oplus\tilde{E}_{1}$,
and introduce the matrix $M_{g}=(b_{1},\dots,b_{n})^{T}$. Let the generators
of the sublattice ${\rm Im\,}\tilde{f}+(P_{E_{0}}\oplus
P_{E_{1}})\subset\tilde{E}_{0}\oplus\tilde{E}_{1}$ be given by ${\rm
Im\,}\tilde{f}+(P_{E_{0}}\oplus P_{E_{1}})={\rm Span}(a_{1},\dots,a_{m})$, and
introduce the matrix $M_{f}=(a_{1},\dots,a_{m})^{T}$. (There is no need to
take $a_{1},\dots,a_{M}$ to be linearly independent.) Since ${\rm
Im\,}\tilde{f}+(P_{E_{0}}\oplus P_{E_{1}})\subset{\rm
Ker\,}(\tilde{g}\oplus{\rm Id}_{P_{A}})|{\tilde{E}_{0}\oplus\tilde{E}_{1}}$,
$a_{1},\dots,a_{m}$ can be expanded in terms of the basis $b_{1},\dots,b_{n}$,
and the expansion coefficients are given by the matrix $M_{f}M_{g}^{+}$, where
$M_{g}^{+}$ is the generalized inverse matrix of $M_{g}$. Perform the Smith
decomposition of the matrix $M_{f}M_{g}^{+}$:

$\displaystyle U(M_{f}M_{g}^{+})V=\left[\begin{array}[]{cc}\Lambda&O\\\ O&O\\\
\end{array}\right],$ (343) $\displaystyle\Lambda={\rm
diag}(\lambda_{1},\dots,\lambda_{k}),$
$\displaystyle\lambda_{i}|\lambda_{i+1}{\rm\ for\ }i=1,\dots,k-1.$ (344)

We obtain:

$\displaystyle\frac{{\rm Ker\,}g}{{\rm
Im\,}f}\cong\mathbb{Z}^{\oplus(n-k)}\oplus\bigoplus_{i=1}^{k}\mathbb{Z}_{\lambda_{i}}.$
(345)

Now, consider the transformed basis of the sublattice ${\rm
Ker\,}(\tilde{g}\oplus{\rm Id}{P_{A}})|{\tilde{E}_{0}\oplus\tilde{E}_{1}}$:

$\displaystyle V^{-1}M_{g}=(\tilde{b}_{1},\dots,\tilde{b}_{n})^{T}$ (346)

By expressing the homomorphisms $f^{\prime}$ and $g^{\prime}$ defined in (337)
and (338) in terms of the basis $\tilde{b}_{1},\dots,\tilde{b}_{n}$, we can
obtain their matrix representations. (Note that for $i$ such that
$\lambda_{i}=1$, the basis $\tilde{b}_{i}$ is for a trivial
$\mathbb{Z}$-module $\mathbb{Z}_{1}$.)

The matrix representation of the homomorphism
$f^{\prime}:b\mapsto[(f_{0}(b),0)]$ is given as follows. Let the matrix
representation of $f_{0}:B\to E_{0}$ be $M_{f_{0}}^{T}$ (where $M_{f_{0}}$ is
a ${\rm dim}\tilde{B}\times{\rm dim}\tilde{E}_{0}$ matrix). Add ${\rm
dim}\tilde{E}_{1}$ zeros to it and then expand it with the basis
$V^{-1}M_{g}$. That is,

$\displaystyle(M_{f_{0}},O_{{\rm dim}\tilde{B}\times{\rm
dim}\tilde{E}_{1}})(V^{-1}M_{g})^{+}$ (347)

is the matrix representation of $f^{\prime}$.

To find the matrix representation of the homomorphism
$g^{\prime}:(e_{0},e_{1})\mapsto g_{0}(e_{0})$, first project the components
of the basis vectors $\tilde{b}_{1},\dots,\tilde{b}_{n}$ onto $\tilde{E}_{0}$:

$\displaystyle(v^{-1}M_{g})|_{E_{0}}.$ (348)

This is an $n\times{\rm dim}\tilde{E}_{0}$ matrix. Let the matrix
representation of $g_{0}:E_{0}\to A$ be $M_{g_{0}}^{T}$. $M_{g_{0}}$ is a
${\rm dim}\tilde{E}_{0}\times{\rm dim}\tilde{A}$ matrix. The matrix
representation of $g^{\prime}$ is given by:

$\displaystyle(V^{-1}M_{g})|_{E_{0}}M_{g_{0}}.$ (349)

Note that any extension can be obtained by a finite number of Baer sums of the
following two types of extensions. ${\rm
Ext}(\mathbb{Z}_{n},\mathbb{Z})=\mathbb{Z}_{n}\ni 1:$

$\displaystyle 0\to\mathbb{Z}\xrightarrow{1\mapsto
n}\mathbb{Z}\xrightarrow{1\mapsto 1}\mathbb{Z}_{n}\to 0,$ (350)

and ${\rm Ext}(\mathbb{Z}_{n},\mathbb{Z}_{m})=\mathbb{Z}_{{\rm gcd}(n,m)}\ni
1:$

$\displaystyle 0\to\mathbb{Z}_{m}\xrightarrow{1\mapsto
n}\mathbb{Z}_{mn}\xrightarrow{1\mapsto 1}\mathbb{Z}_{n}\to 0.$ (351)

Therefore, by the formulation presented in this section, extensions
corresponding to any element of ${\rm Ext}_{\mathbb{Z}}^{1}(A,B)$ can be
constructed.

We give an example of a nontrivial Baer sum. Set $A=\mathbb{Z}_{4}$ and
$B=\mathbb{Z}\oplus\mathbb{Z}_{2}$. In the sense described in Sec. VI.2, there
exist five reduced extension matrices $M$:

$\displaystyle M=\begin{pmatrix}0\\\ 0\\\ \end{pmatrix},\begin{pmatrix}1\\\
0\\\ \end{pmatrix},\begin{pmatrix}2\\\ 0\\\ \end{pmatrix},\begin{pmatrix}0\\\
1\\\ \end{pmatrix},\begin{pmatrix}2\\\ 1\\\ \end{pmatrix}$ (352)

The matrix $M=(0,0)^{T}$ corresponds to the trivial extension to give
$\mathbb{Z}\oplus\mathbb{Z}_{2}\oplus\mathbb{Z}_{4}$. For both matrices
$M=(1,0)^{T}$ and $M=(2,0)^{T}$, $\mathbb{Z}_{2}\subset B$ do not contribute
to the extension, resulting in $\mathbb{Z}\oplus\mathbb{Z}_{2}$ and
$\mathbb{Z}\oplus\mathbb{Z}_{2}^{\oplus 2}$, respectively. For $M=(0,1)^{T}$,
$\mathbb{Z}\subset B$ does not contribute to the extension, yielding
$\mathbb{Z}\oplus\mathbb{Z}_{8}$. Finally, for $M=(2,1)^{T}$, both
$\mathbb{Z}$ and $\mathbb{Z}_{2}\subset B$ contribute to the extension.
Computing the Baer sum of $(2,0)^{T}$ and $(0,1)^{T}$, we have
$\mathbb{Z}\oplus\mathbb{Z}_{4}$.

## References

  * Schnyder  _et al._ [2008] A. P. Schnyder, S. Ryu, A. Furusaki, and A. W. W. Ludwig, Classification of topological insulators and superconductors in three spatial dimensions, Phys. Rev. B 78, 195125 (2008).
  * Kitaev [2009] A. Kitaev, Periodic table for topological insulators and superconductors, AIP Conference Proceedings 1134, 22 (2009).
  * Ryu  _et al._ [2010] S. Ryu, A. P. Schnyder, A. Furusaki, and A. W. Ludwig, Topological insulators and superconductors: tenfold way and dimensional hierarchy, New Journal of Physics 12, 065010 (2010).
  * Chiu  _et al._ [2013] C.-K. Chiu, H. Yao, and S. Ryu, Classification of topological insulators and superconductors in the presence of reflection symmetry, Phys. Rev. B 88, 075142 (2013).
  * Morimoto and Furusaki [2013] T. Morimoto and A. Furusaki, Topological classification with additional symmetries from clifford algebras, Phys. Rev. B 88, 125129 (2013).
  * Slager  _et al._ [2013] R.-J. Slager, A. Mesaros, V. Juričić, and J. Zaanen, The space group classification of topological band-insulators, Nature Physics 9, 98 (2013).
  * Shiozaki and Sato [2014] K. Shiozaki and M. Sato, Topology of crystalline insulators and superconductors, Phys. Rev. B 90, 165114 (2014).
  * Shiozaki  _et al._ [2016] K. Shiozaki, M. Sato, and K. Gomi, Topology of nonsymmorphic crystalline insulators and superconductors, Phys. Rev. B 93, 195413 (2016).
  * Chiu  _et al._ [2016] C.-K. Chiu, J. C. Y. Teo, A. P. Schnyder, and S. Ryu, Classification of topological quantum matter with symmetries, Rev. Mod. Phys. 88, 035005 (2016).
  * Kruthoff  _et al._ [2017] J. Kruthoff, J. de Boer, J. van Wezel, C. L. Kane, and R.-J. Slager, Topological classification of crystalline insulators through band structure combinatorics, Phys. Rev. X 7, 041069 (2017).
  * Po  _et al._ [2017] H. C. Po, A. Vishwanath, and H. Watanabe, Complete theory of symmetry-based indicators of band topology, Nat. Commun. 8, 50 (2017).
  * Bradlyn  _et al._ [2017] B. Bradlyn, L. Elcoro, J. Cano, M. G. Vergniory, Z. Wang, C. Felser, M. I. Aroyo, and B. A. Bernevig, Topological quantum chemistry, Nature 547, 298 (2017).
  * Watanabe  _et al._ [2018] H. Watanabe, H. C. Po, and A. Vishwanath, Structure and topology of band structures in the 1651 magnetic space groups, Science Advances 4, eaat8685 (2018).
  * Shiozaki  _et al._ [2022] K. Shiozaki, M. Sato, and K. Gomi, Atiyah-hirzebruch spectral sequence in band topology: General formalism and topological invariants for 230 space groups, Phys. Rev. B 106, 165103 (2022).
  * Cornfeld and Chapman [2019] E. Cornfeld and A. Chapman, Classification of crystalline topological insulators and superconductors with point group symmetries, Phys. Rev. B 99, 075105 (2019).
  * Cornfeld and Carmeli [2021] E. Cornfeld and S. Carmeli, Tenfold topology of crystals: Unified classification of crystalline topological insulators and superconductors, Phys. Rev. Res. 3, 013052 (2021).
  * Elcoro  _et al._ [2021] L. Elcoro, B. J. Wieder, Z. Song, Y. Xu, B. Bradlyn, and B. A. Bernevig, Magnetic topological quantum chemistry, Nature Communications 12, 5965 (2021).
  * Shiozaki [2022] K. Shiozaki, The classification of surface states of topological insulators and superconductors with magnetic point group symmetry, Progress of Theoretical and Experimental Physics 2022, 10.1093/ptep/ptep026 (2022), 04A104, https://academic.oup.com/ptep/article-pdf/2022/4/04A104/43471665/ptac026.pdf .
  * Zhang  _et al._ [2022] Z. Zhang, J. Ren, Y. Qi, and C. Fang, Topological classification of intrinsic three-dimensional superconductors using anomalous surface construction, Phys. Rev. B 106, L121108 (2022).
  * Peng  _et al._ [2022a] B. Peng, H. Weng, and C. Fang, Wire construction of class DIII topological crystalline superconductors in two dimensions, Phys. Rev. B 106, 174512 (2022a).
  * Ono  _et al._ [2022] S. Ono, K. Shiozaki, and H. Watanabe, Classification of time-reversal symmetric topological superconducting phases for conventional pairing symmetries, arXiv preprint arXiv:2206.02489 (2022).
  * Benalcazar  _et al._ [2017] W. A. Benalcazar, B. A. Bernevig, and T. L. Hughes, Quantized electric multipole insulators, Science 357, 61 (2017).
  * Fang and Fu [2019] C. Fang and L. Fu, New classes of topological crystalline insulators having surface rotation anomaly, Science Advances 5, eaat2374 (2019).
  * Song  _et al._ [2017a] Z. Song, Z. Fang, and C. Fang, $(d-2)$-dimensional edge states of rotation symmetry protected topological states, Phys. Rev. Lett. 119, 246402 (2017a).
  * Langbehn  _et al._ [2017] J. Langbehn, Y. Peng, L. Trifunovic, F. von Oppen, and P. W. Brouwer, Reflection-symmetric second-order topological insulators and superconductors, Phys. Rev. Lett. 119, 246401 (2017).
  * Schindler  _et al._ [2018] F. Schindler, A. M. Cook, M. G. Vergniory, Z. Wang, S. S. P. Parkin, B. A. Bernevig, and T. Neupert, Higher-order topological insulators, Science Advances 4, eaat0346 (2018).
  * Trifunovic and Brouwer [2019] L. Trifunovic and P. W. Brouwer, Higher-order bulk-boundary correspondence for topological crystalline phases, Phys. Rev. X 9, 011012 (2019).
  * [28] K. Shiozaki, C. Z. Xiong, and K. Gomi, Generalized homology and atiyah-hirzebruch spectral sequence in crystalline symmetry protected topological phenomena, arXiv:1810.00801 .
  * Song  _et al._ [2017b] H. Song, S.-J. Huang, L. Fu, and M. Hermele, Topological phases protected by point group symmetry, Phys. Rev. X 7, 011020 (2017b).
  * Huang  _et al._ [2017] S.-J. Huang, H. Song, Y.-P. Huang, and M. Hermele, Building crystalline topological phases from lower-dimensional states, Phys. Rev. B 96, 205106 (2017).
  * Song  _et al._ [2019] Z. Song, S.-J. Huang, Y. Qi, C. Fang, and M. Hermele, Topological states from topological crystals, Science Advances 5, eaax2007 (2019).
  * Song  _et al._ [2020] Z. Song, C. Fang, and Y. Qi, Real-space recipes for general topological crystalline states, Nature communications 11, 4197 (2020).
  * Freed and Hopkins [2019] D. S. Freed and M. J. Hopkins, Invertible phases of matter with spatial symmetry, arXiv preprint arXiv:1901.06419 (2019).
  * Xiong [2018] C. Z. Xiong, Minimalist approach to the classification of symmetry protected topological phases, Journal of Physics A: Mathematical and Theoretical 51, 445001 (2018).
  * Else and Thorngren [2019] D. V. Else and R. Thorngren, Crystalline topological phases as defect networks, Phys. Rev. B 99, 115116 (2019).
  * Freed and Moore [2013] D. S. Freed and G. W. Moore, Twisted equivariant matter, Annales Henri Poincaré 14, 1927 (2013).
  * Thiang [2016] G. C. Thiang, On the K-theoretic classification of topological phases of matter, in  _Annales Henri Poincaré_ , Vol. 17 (Springer, 2016) pp. 757–794.
  * Shiozaki  _et al._ [2017] K. Shiozaki, M. Sato, and K. Gomi, Topological crystalline materials: General formulation, module structure, and wallpaper groups, Phys. Rev. B 95, 235425 (2017).
  * Gomi [2017] K. Gomi, Freed-moore K-theory, arXiv preprint arXiv:1705.09134 (2017).
  * Atiyah [1967] M. Atiyah,  _K-theory_ (CRC Press, 1967).
  * Karoubi [2008] M. Karoubi,  _K-theory: An introduction_ , Vol. 226 (Springer Science & Business Media, 2008).
  * Kasparov [1981] G. G. Kasparov, The operator K-functor and extensions of C*-algebras, Mathematics of the USSR-Izvestiya 16, 513 (1981).
  * Higson and Roe [2000] N. Higson and J. Roe,  _Analytic K-homology_ (OUP Oxford, 2000).
  * Kubota [2016] Y. Kubota, Notes on twisted equivariant K-theory for C*-algebras, International Journal of Mathematics 27, 1650058 (2016).
  * Gomi  _et al._ [2021] K. Gomi, Y. Kubota, and G. C. Thiang, Twisted crystallographic t-duality via the baum–connes isomorphism, International Journal of Mathematics 32, 2150078 (2021).
  * Atiyah and Hirzebruch [2012] M. F. Atiyah and F. Hirzebruch, Vector bundles and homogeneous spaces, in  _Topological Library: Part 3: Spectral Sequences in Topology_ (World Scientific, 2012) pp. 423–454.
  * Stokes  _et al._ [2013] H. Stokes, D. Hatch, and B. Campbell, Iso-mag, ISOTROPY Software Suite. iso. byu. edu (2013).
  * Altland and Zirnbauer [1997] A. Altland and M. R. Zirnbauer, Nonstandard symmetry classes in mesoscopic normal-superconducting hybrid structures, Phys. Rev. B 55, 1142 (1997).
  * Thorngren and Else [2018] R. Thorngren and D. V. Else, Gauging spatial symmetries and the classification of topological crystalline phases, Phys. Rev. X 8, 011040 (2018).
  * Lück and Oliver [2001] W. Lück and B. Oliver, Chern characters for the equivariant K-theory of proper G-CW-complexes, in  _Cohomological Methods in Homotopy Theory_ , edited by J. Aguadé, C. Broto, and C. Casacuberta (Birkhäuser Basel, Basel, 2001) pp. 217–247.
  * Weibel [1995] C. A. Weibel,  _An introduction to homological algebra_ , 38 (Cambridge university press, 1995).
  * [52] See Supplemental Material.
  * Litvin [2013] D. B. Litvin, Magnetic group tables, International Union of Crystallography (2013).
  * Okuma  _et al._ [2019] N. Okuma, M. Sato, and K. Shiozaki, Topological classification under nonmagnetic and magnetic point group symmetry: Application of real-space atiyah-hirzebruch spectral sequence to higher-order topology, Phys. Rev. B 99, 085127 (2019).
  * Song  _et al._ [2018a] Z. Song, T. Zhang, Z. Fang, and C. Fang, Quantitative mappings between symmetry and topology in solids, Nature communications 9, 3530 (2018a).
  * Khalaf  _et al._ [2018] E. Khalaf, H. C. Po, A. Vishwanath, and H. Watanabe, Symmetry Indicators and Anomalous Surface States of Topological Crystalline Insulators, Phys. Rev. X 8, 031070 (2018).
  * Peng  _et al._ [2022b] B. Peng, Y. Jiang, Z. Fang, H. Weng, and C. Fang, Topological classification and diagnosis in magnetically ordered electronic materials, Phys. Rev. B 105, 235138 (2022b).
  * Song  _et al._ [2018b] Z. Song, T. Zhang, and C. Fang, Diagnosis for nonmagnetic topological semimetals in the absence of spin-orbital coupling, Phys. Rev. X 8, 031069 (2018b).
  * Geier  _et al._ [2020] M. Geier, P. W. Brouwer, and L. Trifunovic, Symmetry-based indicators for topological Bogoliubov–de Gennes Hamiltonians, Phys. Rev. B 101, 245128 (2020).
  * Ono  _et al._ [2020] S. Ono, H. C. Po, and H. Watanabe, Refined symmetry indicators for topological superconductors in all space groups, Science Advances 6, eaaz8367 (2020).
  * Ono  _et al._ [2021] S. Ono, H. C. Po, and K. Shiozaki, $\mathbb{Z}_{2}$-enriched symmetry indicators for topological superconductors in the 1651 magnetic space groups, Phys. Rev. Res. 3, 023086 (2021).
  * Schmitt [2016] M. W. Schmitt,  _On Space Groups and Dirichlet-Voronoi Stereohedra_ , Dissertation (2016).
  * Watanabe [2019] H. Watanabe, Irreducible representation of space groups and point group, SOLID STATE PHYSICS 54, 187 (2019), written in Japanese.


# Detecting Community Sensitive Norm Violations in Online Conversations

Chan Young Park♣ Julia Mendelsohn♠ Karthik Radhakrishnan♣ Kinjal Jain♣
Tushar Kanakagiri♣ David Jurgens♠ Yulia Tsvetkov♡
♣Language Technologies Institute, Carnegie Mellon University
♠ University of Michigan
♡Paul G. Allen School of Computer Science & Engineering, University of
Washington
<EMAIL_ADDRESS>
<EMAIL_ADDRESS><EMAIL_ADDRESS>
###### Abstract

Online platforms and communities establish their own norms that govern what
behavior is acceptable within the community. Substantial effort in NLP has
focused on identifying unacceptable behaviors and, recently, on forecasting
them before they occur. However, these efforts have largely focused on
toxicity as the sole form of community norm violation. Such focus has
overlooked the much larger set of rules that moderators enforce. Here, we
introduce a new dataset focusing on a more complete spectrum of community
norms and their violations in the local conversational and global community
contexts. We introduce a series of models that use this data to develop
context- and community-sensitive norm violation detection, showing that these
changes give high performance.111Dataset, code, and models are publicly
available at https://github.com/chan0park/NormVio.

##  1 Introduction

Online communities establish their own norms of what is acceptable behavior
(Danescu-Niculescu-Mizil et al., 2013; Jhaver et al., 2018; Rajadesingan et
al., 2020). These norms run the gamut from no hate speech or no personal
attacks to more idiosyncratic expectations of content formatting and content
sharing (Chandrasekharan et al., 2018; Fiesler et al., 2018). Community
moderators are responsible for identifying and removing rule-breaking content,
regardless of whether users violate rules intentionally or unintentionally due
to unfamiliarity with community norms.

Moderators of online communities often face a tough challenge of triaging the
massive flow of content (Kiene et al., 2016; Dosono and Semaan, 2019; Kiene et
al., 2019); for example, over 2 billion comments were posted to Reddit in just
2020.222https://backlinko.com/reddit-users#reddit-statistics Moderators have
looked to technology to help support their role, using regex-based tools like
Automoderator to flag potentially rule-breaking comments (Jhaver et al.,
2019). Prior work has aimed to assist by developing machine learning
techniques to recognize unacceptable content—yet these have focused on only
the most socially-harmful violations, such as hate speech. Furthermore, the
rules moderators enforce vary widely both in their formulation and
interpretation across communities, making a one-size-fits-all approach
increasingly brittle. Since successful moderation relies on fine-grained
understanding of a given community’s norms, we present a new dataset and
models for community-specific, contextualized norm violation detection for
over twenty types of norms.

Figure 1: Two example comments444All example comments used in this paper are
lightly paraphrased to preserve privacy. that were moderated due to violating
community norms. The examples highlight the importance of contexts (i.e.
conversation history and community information) in detecting community norm
violation.

We introduce a new approach to context-sensitive automated content moderation
that explicitly encodes community norms. Using a new dataset of 51K
conversations across 3.2K communities, we show that the most commonly-studied
norm violation behavior in NLP, hate speech, corresponds to a small minority
of cases in which moderators intervene in practice. We then create multiple
models to detect when moderators intervene and why they intervene, adapting to
the norms and rules of a community.

Our paper offers the following four contributions towards advancing the future
of NLP in community and context-specific moderation. First, in a large scale
analysis of rule and moderation behavior, we show that subreddits vary
considerably in their rules, with only some common themes. However, in
practice, most rules are not enforced and, further, the enforcement of some
types of rules, e.g., incivility, is highly varied across communities. Second,
we introduce a new dataset, NormVio, of 51K conversations across 3.2K
subreddits and map the 25K rules from these communities into nine categories
of context-specific unacceptable behavior, including five types of incivility.
Third, we introduce a new series of models aimed at detecting and explaining
rule-violating behavior based on norms and rules of the community. Our
approach enables not only identifying that conversation in a particular
community (with particular rules) is likely to violate a rule, but also which
rule. We demonstrate the effectiveness of these models, showing our best model
attains an F1 of 78.64 across all rule types, a 50% improvement over context-
insensitive baselines. Finally, we perform an in-depth analysis of how much
conversation context and community-sensitivity affects predictability. Our
work points towards key challenges in detecting particular rule violations,
while providing high accuracy in others, which can allow moderators to quickly
intervene. More generally, our work provides a clear next step for NLP to look
beyond one-size-fits-all methods for detecting incivility to developing
holistic, context-sensitive approaches that better suit the needs of
moderators and their communities.

##  2 NormVio Dataset

Prior work has created datasets used to detect single types of norm violations
in social media messages (e.g. incivility, hate speech or hostility) (Waseem
and Hovy, 2016; Founta et al., 2018). However, these datasets typically focus
on isolated texts and do not provide prior conversational context or
community-specific details.

In order to detect representative types of norm violations and account for
context, we construct a new dataset—NormVio—a collection of 52K English
conversation threads on Reddit. NormVio includes comments removed for
violating a variety of community norms beyond the traditional hate speech and
incivility, such as spamming or violating community format/topics.
Furthermore, NormVio provides additional context beyond the norm-violating
comment itself with (a) the entire conversation thread (i.e., the original
post and prior comments) and (b) the subreddit (i.e., community) in which the
comment was posted.

#### Data Collection

We collected our initial data via the Reddit API, which provides list of
moderators and their comments for each subreddit. For each of the top 100K
most popular subreddits,555Ranked by number of subscribers as of April 2021 we
identified the most recent 500 comments from each moderator and retrieved
comments that moderators posted in response to a removed comment (henceforth,
moderation comments).

Moderation comments often provide useful signals for inferring which community
norm was violated. From the full set of moderation comments, we selected those
that contain a phrase explicitly stating the rule number (e.g. “this comment
violates Rule 2”) or the exact text of one of its subreddit’s rules (e.g.
“don’t be rude”).

We then fetch the entire conversation thread for this set of moderation
comments: the original post and all parent comments prior to the moderator’s
comment. We also fetched the norm-violating comment that was removed by
moderators, by searching archived comments via the Pushshift API (Baumgartner
et al., 2020).666We were unable to retrieve an additional 21K removed norm-
violating comments, which were unavailable in the PushShift archive. We still
include these corresponding conversations in our data release as they can be
useful in the task of forecasting future norm violations.

The final dataset is comprised of 20K conversations that have the last comment
removed by one of the moderators of the community. Following the approach in
Chang and Danescu-Niculescu-Mizil (2019), we include 32K paired unmoderated
conversations as a control set. Each moderated conversation is matched with up
to two unmoderated conversations from the same post and with most similar
conversation lengths as the target moderated conversation.

#### Ethical Considerations for Protecting User Privacy

Our dataset focuses, in part, on comments that moderators have viewed as
objectionable and therefore removed. While these moderated comments are still
publicly available, their use requires additional ethical reflection and
precautions to preserve the dignity and privacy of users (Townsend and
Wallace, 2016). Moderated comments offer significant benefit to the study of
supporting moderators and authorities in their goals of having supportive
technologies that match their community’s norms. At the same time, users who
made those comments may object to having them included in a dataset (Fiesler
and Proferes, 2018). Therefore, we take additional measures to ensure that
user privacy is protected, especially for the deleted comments.

We use Reddit data through Pushshift Baumgartner et al. (2020), an archive
that has been widely used in NLP and related fields since its first release in
2015 (Hessel and Lee, 2019; Kennedy et al., 2020; Sap et al., 2020; Dinan et
al., 2020, among many others). Pushshift’s collection policy explicitly states
that it conforms to Reddit’s rules and user agreement with regards to data
collection. In releasing our dataset, we provide only the associated
identifiers of comments but not their textual content. Practitioners will need
to independently fetch the texts from Pushshift by using the provided comment
IDs. Releasing only IDs ensures that any users who request their data to be
removed in Pushshift will also have it removed in our dataset. Additionally,
in our dataset we anonymize individual usernames and personal identifiers of
posters and moderators. Finally, along with our data release, we provide
guidelines to the users who wish to delete their comments from the Pushshift
dump.

#### Classification of Community Norms

Moderator comments as well as rules defined in each subreddit are free-form
and diverse, and it is not trivial to map the rule/comment to a specific
community norm it refers to. In order to study norm violations, we thus first
train classifiers that given a rule description label it with a type of norm
it violates.

We follow Fiesler et al. (2018)’s qualitative analysis of 1K subreddits, that
identified main categories of rules through annotating 3,789 rules from the
subreddits.777Out of 24 categories, we exclude the ones describing the tone of
rules (whether a rule is “Prescriptive” or “Restrictive”) and one
(Behavior/Content) that is extremely broad, covering over 90% of coded rules.
We then use the annotations from (Fiesler et al., 2018) to fine-tune a BERT-
based binary classifier for each rule type.888Binary classifiers were used
since each community rule can be categorized with multiple types. We used the
default hyperparameters suggested in the Transformers library and trained each
model for 20 epochs. Table 1 shows the list of the resulting 21 categories of
community norms and the performance of our classifiers evaluated using macro
F1 scores with stratified 10-fold cross validation.

Rule Types | F1 | Rule Types | F1
---|---|---|---
Advertising | 71.0 | NSFW | 88.2
| Moderation
---
Enforcement
87.0 | Off-topic | 63.5
Copyright/Piracy | 70.6 |  | Personal
---
Army
43.2
Doxxing | 75.4 | Personality | 81.9
Format | 73.5 | Politics | 85.7
Harassment | 67.9 | Reddiquette | 83.2
Hate Speech | 84.2 | Reposting | 81.4
Images | 65.1 | Spam | 86.9
Outside Content | 68.0 | Spoilers | 76.7
| Low-Quality
---
Content
45.6 | Trolling | 96.0
|  | Voting | 85.6
AVERAGE | 75.3 |  |

Table 1: Macro F1 of classifying the diverse sets of rules across subreddits
to rule violation types.

We use the final models to map 183K rules from the top 100K subreddits to
their corresponding rule types. Table 2 shows the examples of labeled
community rules randomly sampled from our data. Finally, we classify
moderators’ explanations of the rule-violating comments in NormVio. Because we
only kept moderators’ comments that mention a rule number or a rule’s exact
text, we can determine which rule was violated by the conversation.999Any data
collection procedure that relies on user-generated labels has the risk to
absorb human biases. In our setting too, there is a risk of moderator biases
to be incorporated when we match moderation comments to rules and violation
types. However, in pilot work examining moderator comments with explicit rule
violations and those where we had to infer the rule(s), we found a near-
identical distribution of violation types. Using our binary classifiers on
rule text, we can now infer the type of norm that was violated by the
moderated (removed) comment.

Although the 21 types are well suited for fine-grained analysis of rules on
Reddit, they might leave insufficient number of examples per type which can
make it more challenging to computationally model them. We define relatively
more coarse-grained nine types and map the 21 types with the nine types as
shown in Table 2. We designed these types to reflect our interest in text-
based analysis of abusive language. We kept five different subcategories of
uncivil comments (general incivility, trolling, harassment, hate speech, spam)
while aggregating Voting, Reddiquette, and Moderation Enforcement into a broad
"Meta-rules" category. In the remainder of this paper, we only use the coarse-
level norm violation types.

Ultimately, each moderated comment in NormVio has the following information:
(1) its subreddit, (2) its conversation thread, (3) the community-specific
rule violated, and (4) the coarse- and fine-grained rule types that were
violated. To maximize user privacy, all comments are provided as IDs, the
content for which can be retrieved through the Reddit and PushShift APIs.

Incivility: {Personality} | “Be civil"
---|---
|  Harassment: {Harassment,
---
Doxxing}
“Don’t harass others"
|  Spam:{Spam, Reposting,
---
Copyright}
“No excessive posting"
|  Format: {Format, Images,
---
Links}
“Use the correct tags”
|  Content:{Low-quality Content,
---
NSFW, Spoilers}
“No low-quality posts”
Off-topic :{Off-topic, Politics} | “Only relevant posts”
Hate speech:{Hatespeech} | “No racism, sexism”
|  Trolling:{Trolling,
---
Personal Army}
“No trolls or bots”
|  Meta-rules:{Voting, Moderation
---
Enforcement, Reddiquette}
“No Downvoting”

Table 2: The mapping between coarse- and fine-grained rule types and examples.
Figure 2: % of rule types of rules (left) and comments violating those rules
(right) in NormVio. Figure 3: Average number of utterances between the
original post and the moderated comments.

#### Analysis of Community Norm Violations

We analyze the types of rules and comments comprising NormVio with a focus on
what kinds of rules are established by communities, what kinds of rules are
violated in practice, and when in conversations these rules are violated.

The results in Figure 2 show that the rule types are evenly distributed over
rules (left) while the actual violations (right) are relatively more focused
on abusive language rule types such as Incivility and Harassment. A large
proportion of all rules in our dataset fall under the Format and Content
categories, suggesting that there is a diverse set of community norms, beyond
regulating incivility, needed to operate healthy online communities.
Critically, while the majority of efforts on identifying abusive language in
the NLP community have been focused on hate speech, more subtle types of
incivility are significantly more prevalent in removed comments, which are
also harder to detect Jurgens et al. (2019); Breitfeller et al. (2019); Field
and Tsvetkov (2020). Moreover, only 55% of removed comments are violations of
Incivility and Hate Speech rules, again highlighting the importance of
understanding the spectrum of community norms in designing automated
moderation assistance systems.

Figure 3 shows the average number of utterances from the original post to the
norm-violating removed comment. Overall, violations related to abusive
language such as Harassment, Incivility, and Trolling occur later in
conversations than comments removed for other reasons (e.g. Spam and Format).
This timing has implications for the “forecastability” of violation types. For
example, the average conversation length within the Spam category is about 0.5
which indicates that half of the violations happen in the original post or a
reply to it, making it impractical trying to forecast such violations.

Even though Hate Speech and Harassment are both related to abusive language,
comments removed due to Harassment occur after more interactions. We
hypothesize this is because harassment and trolling are intentionally
expressed in less overt forms to delay the moderators’ intervention. These
findings illustrate that with a more representative set of community rules and
a larger-scale dataset, NormVio facilitates deeper understanding of community
norm violation behaviors and provides guidance on more urgent tasks our field
should be focusing on for a practical impact.

(a)  (b)

Figure 4: Structure of the baselines of the two proposed tasks: detecting norm
violation (left) and explaining norm violation (right). Inputs in gray
(conversation history and community information) are optional context.

##  3 Detecting and Explaining Community Norm Violations

With NormVio, we can now train models for detecting contextualized, fine-
grained community norm violations. We present two tasks: (1) Detecting
community norm violations, and (2) Explaining community norm violations. The
former identifies coarse categories of norm violations detailed in §2, and the
latter is aimed at identifying specific local community rules being violated,
to facilitate moderation transparency. For each task, we compare model
variants without or with varying types of incorporated context, including
conversation history and community information (e.g. subreddit name).

###  3.1 Detecting Community Norm Violations

In this task we assume a set of pre-defined categories of norm violations. For
each category, we train a binary classifier to detect violations, since the
categories are not mutually exclusive.

As shown in Figure 4, we encode a conversational context of arbitrary length
along with community rules. Following Chang and Danescu-Niculescu-Mizil
(2019), we use a uni-directional LSTM context encoder. The utterance encoder
is initialized with a pretrained BERT model, with each classifier is then
fine-tuned using training data specific to each rule type (data statistics are
detailed in Appendix A). The last hidden state from the last comment is fed
into the classifier. The flexibility of this design allows for both
retroactive detection after violations occur (the focus of this work) as well
as proactive prediction of future rule violations.

We experiment with four model variants with different input contexts:

  * •

Comment: Only the final comment.

  * •

+History: Past conversation history and the final comment.

  * •

+Community: Community information and the final comment. We concatenated the
subreddit name in front of the comment (e.g. “r/AskReddit ask
anything!”).101010Note that the model variants without conversation history do
not use a context encoder at all and thus have a smaller number of trainable
parameters.

  * •

+History+Community: Conversation history and community information.

###  3.2 Explaining Community Rule Violations

In addition to categorizing rule violations by type (type-based), we develop a
model that leverages the specific community rule text to identify violations
in context. This text-based model facilitates explanations of rule violations,
and improves transparency (Juneja et al., 2020). Such a system could lighten
moderators’ workload through highlighting why they might moderate a comment,
enable more productive interventions, and improve the relationship between
community members and moderators.

Similar to the violation category detection task, we construct binary
classifiers that detect violations given conversational and community context.
However, as shown in Figure 4, the full input and training procedure are
different; we include the community’s verbatim rule description as a model
input. The rule text is appended to the input comment with a special token
([SEP]) added between the comment and the rule to leverage pretrained language
models’ ability to infer relationships between two sentences. Since the
precise formulation of the target rule is given as an input, we no longer need
to train one model per rule type; we train one universal model with all
available training data.

NormVio contains information about which rules are violated in each removed
comment, and we use these rule-comment pairs as positive examples. If a
comment is tagged for violating more than one rule, we include all comment-
rule pairs as positive examples. We construct negative training examples using
matched unmoderated conversations from NormVio (described in §2) by adding the
text of the violated rule to the corresponding unmoderated conversation.

To guide the model in better discriminating rules, we construct additional
negative examples by mapping each removed comment with an randomly chosen
incorrect rule from the same subreddit (e.g. “Here’s my referral code! [SEP]
No Politics”).

Similarly, we experiment with three model variants with different input
contexts:

  * •

+Rule: Only the final comment and a rule text.

  * •

+Rule+History: Past conversation history, the final comment, and a rule text.

  * •

+Rule+History+Community: Both conversation and community history, the final
comment, and a rule text.

The main advantage of the text-based model is in its interpretability and
generalizability. Since the model now looks at the community-specific rule
texts, the system can provide more meaningful feedback to moderators and
users. For example, instead of saying “potential hate speech detected”, now
the model can be more informative in notifying users that “the comment has
breached our community’s Rule 2: No Racial Slurs”. Moreover, since the model
takes free-form rules as input, it can generalize to unseen rules and novel
rule types.

##  4 Experiments

Figure 5: Average and breakdown of Macro F1 scores of the baselines and the
model variants. Error bars indicate 95% confidence interval and the types are
sorted by their violation frequency (percentage below x-axis labels).

#### Baselines

In addition to the seven model variants in §3, we consider three baselines
that represent current common approaches:

  * •

Majority: Majority class baseline.

  * •

Perspective: Perspective API’s toxicity score of the final comment to make a
binary decision. For each rule type, a threshold value was tuned to maximize
development set F1 score.

  * •

IncivilHate: We train a model using just the incivility and hate speech
violations from NormVio. The test set predictions from the trained model was
evaluated over different rule types.

#### Training Details

We perform an 80-10-10 train/dev/test random split of moderated comments in
NormVio and then appended paired unmoderated comments into the same split. The
resulting number of examples of train/dev/test split was 41667, 5214, and
5131, respectively. We ran training for five different random seeds and report
the average scores of multiple runs except for Majority and Perspective
baselines.

The base utterance encoder is a pretrained Conversational BERT model. Each
model was trained for 10 epochs with an early stopping patience of 5, and with
Adam optimizer with a learning rate of 1e-5. We used a batch size of 32 for
models that do not leverage past conversations and 8 for the ones that use
comment history. We used 2 layers of GRUs with a hidden size of 768 for the
context encoder and 2 linear layers for the final classifier.

#### Evaluation

We used macro F1 to evaluate all models. For models in §3.2, at test time we
cannot assume that we know which rule will be violated in a given
conversation. We thus create multiple comment-rule pairs for each comment in
the test set by matching it with each community rule. Out of the resulting
pairs, we mark the pairs that were observed in the original test set as
positive, and the remaining pairs are marked as negative. We refer to these
negative pairs added to the test set of models explaining rule violations as
augmented pairs. Note that the test sets of models in §3.2 are now different
from the text sets in §3.1 and the F1 scores of two tasks are not directly
comparable.

#### Experiment Results

Information from the social context of a comment substantially improves
performance (Figure 5). Compared to current approaches for inferring toxicity,
all type-based violation detection model performed significantly better—even
for rule violation categories those approaches are tailored for. While
Perspective and IncivilHate performed better in Incivility and almost
comparable with Comment and +History, adding community information still
resulted in a significant improvement of +8.0 absolute increase in F1.

Across all rule violation types, adding the context about community
significantly improved the performance, often resulting in the highest
performing models when added. Adding conversation history showed mixed
results. +History showed improvements over Comment whereas +History+Community
was not necessarily better than +Community. Models with conversation history
tend to perform worse on scarce violation types such as Meta-rules and
Trolling; we speculate that this decreased performance is due to the increased
number of parameters from adding context encoder layer to process conversation
history and future work with more examples of these violations may
substantially improve performance. This result for history greatly expands an
analysis by Pavlopoulos et al. (2020) that found minimal performance gain when
adding a single prior comment to identify toxicity; while we too find minimal
improvement for Incivility and Harassment norms, adding history does improve
the recognition for other norm violations (e.g., Format and Content)
indicating that prior context can be useful.

While the results of text-based violation detection models (+Rule,
+Rule+History, +Rule+History+Community) and type-based models are not directly
comparable due to the augmented pairs, they were evaluated over the same set
of comments so the numbers can provide a general sense of text-based model
performance. An interesting distinction between the two detection tasks is in
how much additional context helps. In type-based models, adding context made
significant improvements in all or in some cases. However, with text-based
models, the performance was relatively more uniform and additional context did
not contribute as much. This result suggests that providing full text of rules
may help resolve certain ambiguous comments and thus the model rely less on
the additional context.

##  5 Analysis

Figure 6: Confusion matrices of two baselines over the norm violation
detection task. Figure 7: Confusion matrices of Comment and +Community for the
Harassment detection task (top), and of Comment and +History for the Format
violation detection task (bottom).

#### How many violations do current systems miss?

In part due to their targeted focus, the Perspective and IncivilHate baseline
models miss a substantial proportion of the total norm violations. Figure 6
shows the confusion matrices of the violation detection task, where labels are
aggregated over all violation types to test how many violations overall are
not captured by these systems. The results show that Perspective and
IncivilHate fail to recognize 42% and 34% of all violations, respectively.
Moderators on platforms like Reddit must triage huge numbers of comments daily
and this points to a clear gap between current practice (represented by the
baselines) and indicates what moderators act on in practice.

#### How does community information help?

We observed that adding community information provides the most significant
improvements in Harassment in Figure 5. We now look into the Harassment type
to understand more about how did the additional community information actually
help to improve the performance.

What kinds of errors are corrected by adding community context? By comparing
confusion matrices of Comment and +Community (Figure 7), we find that
+Community has fewer false positives. Out of 154 false positives from the
Comment model that were corrected in the +Community model, 106 (69%) were
Incivility violations. Consider the following example:

Comment: That game’s already dead to 99% of the world a few weeks later, get
over it you stupid idiot.
Moderator Comment: Your comment has been removed for Rule 2. Be civil and
respectful. Do not attack or harass other users or engage in hate-speech.
Paired Rule: Rule 2: Be civil and respectful. Violation: Incivility Community:
r/classicwow

The final comment in this example could be considered as both a Incivility and
Harassment violation and Comment model labels it as Harassment. Although the
moderator refers to the community’s Incivility rule, the rule mentions "do not
attack or harass other users", which makes it clear that this example falls
into both categories. However, the +Community model labels this comment as
Incivility and not Harassment. We speculate that the +Community model learns
about what rules exist in each community; r/classicwow has 8 rules and none of
them are about Harassment, so moderators refer to the Incivility rule when
moderating Harassment violations. In other words, depending on the community
and their available community rules, the same comments can be moderated as
either incivility or harassment violation. Therefore, providing the community
information can help the model disambiguate this decision and ground its
moderator support in the norms of the community.

#### How does conversation history help?

Likewise, for the conversation history context, the largest gain was achieved
in the Format type. In Figure 7, we compare confusion matrices of Comment and
+History. The result again shows that additional context can help the model in
reducing the false positive rate.

Among the corrected false positives, the most prevalent type mistaken for
Format was Spam. One example of such case is given below:

Comment: UPDATE: I found it! here you go if you need it_LINK_
Violation: Spam (Piracy) Moderator Comment: See Rule 1: No Merchandise / Spam
Previous Message: Does anyone know where to buy this?

If we only consider the final comment, there are two possible explanations for
which rule was violated: 1) Format: the outside link does not follow the
community guideline 2) Spam: self-promotion / promoting specific merchandise
is banned. However, the previous message makes it clear that the author had
just posted about a product and then made a self-reply with a link to buy the
product. With this information, model can disambiguate this situation and
choose the right violation type.

##  6 Related Work

#### Community Norms and Rules

Many studies have investigated how online conversations are moderated and how
each community has different norms to ensure a safe environment for
discussions Chandrasekharan et al. (2018); Jhaver et al. (2018, 2019); Juneja
et al. (2020); Almerekhi et al. (2020); Rajadesingan et al. (2020). Fiesler et
al. (2018) conduct an analysis over the rules of Reddit communities and define
24 types of the rules. They provide a thorough and large-scale analysis over
how the rules are phrased and how rules are different across subreddits. We
adopt their rule categorization and extend it to code actual rule violations.

Chandrasekharan et al. (2018) also studied removed comments on Reddit to
understand what types of rules exist on Reddit by clustering the moderator
comments and investigated how they are governed. However, their dataset
provides limited context of moderated comments, whereas we focus on providing
a dataset that has enough context and also explicit violation type that can be
leveraged in modeling rule violation.

#### Context in Detecting Online Abuse

Most of the existing datasets for abusive language detection implicitly
assumes that comments may be judged independently taken out of context.
Pavlopoulos et al. (2020) challenged this assumption and examined if context
matters in toxic language detection. While they found a significant number of
human annotation labels were changed when context is additionally given, they
could not find evidence that context actually improves the performance of
classifiers. Our work also examines the importance of context, but we do not
limit our scope to toxic language detection and investigate a broader set of
community norm violation ranging from formatting issues to trolling.

#### Beyond Incivility and Hate Speech

Jurgens et al. (2019) claims “abusive behavior online falls along a spectrum,
and current approaches focus only on a narrow range” and urges to expand the
scope of problems in online abuse. Most work on online conversation has been
focused on certain types of rule violation such as incivility and toxic
language (e.g., Zhang et al., 2018; Chang and Danescu-Niculescu-Mizil, 2019;
Almerekhi et al., 2020). In this work, we focus on a broader concept of
community norm violation and provide a new dataset and tasks to facilitate
future research in this direction.

##  7 Conclusion

Online communities establish their own norms for what is acceptable behavior.
However, current NLP methods for identifying unacceptable behavior have
largely overlooked the context in which comments are made, and, moreover, have
focused on a relatively small set of unacceptable behaviors such as
incivility. In this work, we introduce a new dataset, NormVio, of 51K
conversations grounded with community-specific judgements of which rule is
violated. Using this data, we develop new models for detecting context-
sensitive rule violations, demonstrating that across nine categories of rules,
by incorporating community and conversation history as context, our best model
provides a nearly 50% improvement over context-insensitive baselines; further,
we show that using our models, we can explain which rule is violated,
providing a key assistive technology for helping moderators identify content
not appropriate to their specific community and better communicate to users
why. Our work enables a critical new direction for NLP to develop holistic,
context-sensitive approaches that support the needs of moderators and
communities.

##  8 Ethical Considerations

We hope to draw attention to the mismatch between the standard tasks of
harmful content detection that NLP researchers are typically focusing on (e.g.
sentence-level toxicity detection) and the broad spectrum of context-sensitive
content violation types that actually occur in the wild. To enable future
research on detecting community-specific norm violations, we constructed a
dataset that retrieves online conversation threads and comments deleted by
moderators, categorized by community norm violations. We discuss ethical
considerations related to protecting user privacy in §2.

Additionally, we acknowledge that the dataset itself can incorporate
unintentional biases. For example, it can incorporate moderators’ biases in
deciding which comments are selected to be removed Binns et al. (2017); Myers
West (2018); Shen and Rose (2019). The unmoderated comments can include norm-
violating comments that were missed by the moderators Chandrasekharan et al.
(2018). By constructing a large scale dataset that spans multiple subreddits
and moderators’ teams we partially mitigate these concerns. To investigate
this further, future work could incorporate an additional evaluation procedure
with test sets containing held-out moderators (cf. Geva et al., 2019).

## Acknowledgments

This material is based upon work funded by the DARPA CMO under Contract No.
HR001120C0124, and by the National Science Foundation under Grants No.
IIS2040926 and 1850221. The views and opinions of authors expressed herein do
not necessarily state or reflect those of the United States Government or any
agency thereof.

## References

  * Almerekhi et al. (2020) Hind Almerekhi, Supervised by Bernard J Jansen, and co-supervised by Haewoon Kwak. 2020.  Investigating toxicity across multiple reddit communities, users, and moderators.  In _Companion Proceedings of the Web Conference 2020_ , pages 294–298.
  * Baumgartner et al. (2020) Jason Baumgartner, Savvas Zannettou, Brian Keegan, Megan Squire, and Jeremy Blackburn. 2020.  The pushshift reddit dataset.  In _Proceedings of the International AAAI Conference on Web and Social Media_ , volume 14, pages 830–839.
  * Binns et al. (2017) Reuben Binns, Michael Veale, Max Van Kleek, and Nigel Shadbolt. 2017.  Like trainer, like bot? inheritance of bias in algorithmic content moderation.  In _International conference on social informatics_ , pages 405–415. Springer.
  * Breitfeller et al. (2019) Luke Breitfeller, Emily Ahn, David Jurgens, and Yulia Tsvetkov. 2019.  Finding microaggressions in the wild: A case for locating elusive phenomena in social media posts.  In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , pages 1664–1674, Hong Kong, China. Association for Computational Linguistics.
  * Chandrasekharan et al. (2018) Eshwar Chandrasekharan, Mattia Samory, Shagun Jhaver, Hunter Charvat, Amy Bruckman, Cliff Lampe, Jacob Eisenstein, and Eric Gilbert. 2018.  The internet’s hidden rules: An empirical study of reddit norm violations at micro, meso, and macro scales.  _Proceedings of the ACM on Human-Computer Interaction_ , 2(CSCW):1–25.
  * Chang and Danescu-Niculescu-Mizil (2019) Jonathan P. Chang and Cristian Danescu-Niculescu-Mizil. 2019.  Trouble on the horizon: Forecasting the derailment of online conversations as they develop.  In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , pages 4743–4754, Hong Kong, China. Association for Computational Linguistics.
  * Danescu-Niculescu-Mizil et al. (2013) Cristian Danescu-Niculescu-Mizil, Robert West, Dan Jurafsky, Jure Leskovec, and Christopher Potts. 2013.  No country for old members: user lifecycle and linguistic change in online communities.  In _22nd International World Wide Web Conference, WWW ’13, Rio de Janeiro, Brazil, May 13-17, 2013_ , pages 307–318. International World Wide Web Conferences Steering Committee / ACM.
  * Dinan et al. (2020) Emily Dinan, Angela Fan, Adina Williams, Jack Urbanek, Douwe Kiela, and Jason Weston. 2020.  Queens are powerful too: Mitigating gender bias in dialogue generation.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 8173–8188, Online. Association for Computational Linguistics.
  * Dosono and Semaan (2019) Bryan Dosono and Bryan C. Semaan. 2019.  Moderation practices as emotional labor in sustaining online communities: The case of AAPI identity work on reddit.  In _Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems, CHI 2019, Glasgow, Scotland, UK, May 04-09, 2019_ , page 142\. ACM.
  * Field and Tsvetkov (2020) Anjalie Field and Yulia Tsvetkov. 2020.  Unsupervised discovery of implicit gender bias.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 596–608, Online. Association for Computational Linguistics.
  * Fiesler et al. (2018) Casey Fiesler, Jialun Jiang, Joshua McCann, Kyle Frye, and Jed Brubaker. 2018.  Reddit rules! characterizing an ecosystem of governance.  _Proceedings of the International AAAI Conference on Web and Social Media_ , 12(1).
  * Fiesler and Proferes (2018) Casey Fiesler and Nicholas Proferes. 2018.  “participant” perceptions of Twitter research ethics.  _Social Media + Society_ , 4(1):2056305118763366.
  * Founta et al. (2018) Antigoni Founta, Constantinos Djouvas, Despoina Chatzakou, Ilias Leontiadis, Jeremy Blackburn, Gianluca Stringhini, Athena Vakali, Michael Sirivianos, and Nicolas Kourtellis. 2018.  Large scale crowdsourcing and characterization of twitter abusive behavior.  In _Proceedings of the International AAAI Conference on Web and Social Media_ , volume 12.
  * Geva et al. (2019) Mor Geva, Yoav Goldberg, and Jonathan Berant. 2019.  Are we modeling the task or the annotator? an investigation of annotator bias in natural language understanding datasets.  In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , pages 1161–1166, Hong Kong, China. Association for Computational Linguistics.
  * Hessel and Lee (2019) Jack Hessel and Lillian Lee. 2019.  Something’s brewing! early prediction of controversy-causing posts from discussion features.  In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_ , pages 1648–1659, Minneapolis, Minnesota. Association for Computational Linguistics.
  * Jhaver et al. (2019) Shagun Jhaver, Iris Birman, Eric Gilbert, and Amy Bruckman. 2019.  Human-machine collaboration for content regulation: The case of reddit automoderator.  _ACM Transactions on Computer-Human Interaction (TOCHI)_ , 26(5):1–35.
  * Jhaver et al. (2018) Shagun Jhaver, Sucheta Ghoshal, Amy Bruckman, and Eric Gilbert. 2018.  Online harassment and content moderation: The case of blocklists.  _ACM Transactions on Computer-Human Interaction (TOCHI)_ , 25(2):1–33.
  * Juneja et al. (2020) Prerna Juneja, Deepika Rama Subramanian, and Tanushree Mitra. 2020.  Through the looking glass: Study of transparency in reddit’s moderation practices.  _Proceedings of the ACM on Human-Computer Interaction_ , 4(GROUP):1–35.
  * Jurgens et al. (2019) David Jurgens, Libby Hemphill, and Eshwar Chandrasekharan. 2019.  A just and comprehensive strategy for using NLP to address online abuse.  In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_ , pages 3658–3666, Florence, Italy. Association for Computational Linguistics.
  * Kennedy et al. (2020) Brendan Kennedy, Xisen Jin, Aida Mostafazadeh Davani, Morteza Dehghani, and Xiang Ren. 2020.  Contextualizing hate speech classifiers with post-hoc explanation.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 5435–5442, Online. Association for Computational Linguistics.
  * Kiene et al. (2019) Charles Kiene, Jialun Aaron Jiang, and Benjamin Mako Hill. 2019.  Technological frames and user innovation: exploring technological change in community moderation teams.  _Proceedings of the ACM on Human-Computer Interaction_ , 3(CSCW):1–23.
  * Kiene et al. (2016) Charles Kiene, Andrés Monroy-Hernández, and Benjamin Mako Hill. 2016\.  Surviving an "eternal september": How an online community managed a surge of newcomers.  In _Proceedings of the 2016 CHI Conference on Human Factors in Computing Systems, San Jose, CA, USA, May 7-12, 2016_ , pages 1152–1156. ACM.
  * Myers West (2018) Sarah Myers West. 2018.  Censored, suspended, shadowbanned: User interpretations of content moderation on social media platforms.  _New Media & Society_, 20(11):4366–4383.
  * Pavlopoulos et al. (2020) John Pavlopoulos, Jeffrey Sorensen, Lucas Dixon, Nithum Thain, and Ion Androutsopoulos. 2020.  Toxicity detection: Does context really matter? In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 4296–4305, Online. Association for Computational Linguistics.
  * Rajadesingan et al. (2020) Ashwin Rajadesingan, Paul Resnick, and Ceren Budak. 2020.  Quick, community-specific learning: How distinctive toxicity norms are maintained in political subreddits.  In _Proceedings of the International AAAI Conference on Web and Social Media_ , volume 14, pages 557–568.
  * Sap et al. (2020) Maarten Sap, Saadia Gabriel, Lianhui Qin, Dan Jurafsky, Noah A. Smith, and Yejin Choi. 2020.  Social bias frames: Reasoning about social and power implications of language.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 5477–5490, Online. Association for Computational Linguistics.
  * Shen and Rose (2019) Qinlan Shen and Carolyn Rose. 2019.  The discourse of online content moderation: Investigating polarized user responses to changes in Reddit’s quarantine policy.  In _Proceedings of the Third Workshop on Abusive Language Online_ , pages 58–69, Florence, Italy. Association for Computational Linguistics.
  * Townsend and Wallace (2016) Leanne Townsend and Claire Wallace. 2016.  Social media research: A guide to ethics.  _University of Aberdeen_ , 1:16.
  * Waseem and Hovy (2016) Zeerak Waseem and Dirk Hovy. 2016.  Hateful symbols or hateful people? predictive features for hate speech detection on Twitter.  In _Proceedings of the NAACL Student Research Workshop_ , pages 88–93, San Diego, California. Association for Computational Linguistics.
  * Zhang et al. (2018) Justine Zhang, Jonathan Chang, Cristian Danescu-Niculescu-Mizil, Lucas Dixon, Yiqing Hua, Dario Taraborelli, and Nithum Thain. 2018.  Conversations gone awry: Detecting early signs of conversational failure.  In _Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 1350–1361, Melbourne, Australia. Association for Computational Linguistics.

##  Appendix A Dataset Description

NormVio |
---|---
# of total comments | 52012
|  # of moderated comments with
---
original final comment restored
20137
# of unmoderated comments | 31875
Additional dataset for forecasting |
(without original violation comments) |
# of total comments | 53829
# of moderated comments | 20727
# of unmoderated comments | 33102
# of subreddits | 3234
# of rules | 24916
# of moderators | 29841
# of moderators per subreddit | 9.2
Avg. comment length (# of words) | 34.4
| Avg. number of context per comment
---
(including the original post)
2.8
Avg. # of rules per community | 7.7

Table 3: Summary statistics of NormVio

Table 3 presents the basic summary statistics of NormVio. Our main dataset
used in the analysis consist of 52K comments in total, and each comment is
accompanied with its conversation history, subreddit information, tagged rule,
and its violation type.

The dataset also provides additional 54K comments that contains 21K violation
comments and its paired 33K unmoderated comments. For these moderated
comments, we could not fetch its original comment before getting moderated, so
these could not be used for detection task. However, these comments could
still be used in training norm violation forecasting models.

##  Appendix B Additional Details for Reproducibility

Our work includes two series of model training: rule classifier training and
violation detection model training. For all training runs we trained with one
GPU with 11GB of memory.

For rule classifiers, we had to train one binary model for each violation
type, so we had to run 21 final training using 3.7K annotated rules. Each run
took about 5-6 minutes which results in about 2 hours of training.

Violation detection models are trained with 52K examples thus took
significantly longer than training rule classifiers. Again, for type-based
detection models, we needed to train one model per coarse-grained violation
types. Each run took about 40 minutes for models without conversation history
and took about 2 hours for models with history. In summary, to run one set of
training for one model, we needed to train for 6 hours for models without
history and 18 hours for models with history.

For text-based detection models, we did not need to train a model per type
which significantly reduces the total training amount. Models without
conversation history took about an hour to train and models with history took
about 7 hours to train one model.

The number of trainable parameters was 109 million for models without
conversation history (i.e., those without a context encoder) and 116 million
for models with a context encoder.