11institutetext: P. N. Lebedev Physical Institute of the Russian Academy of
Sciences, Pushchino Radio Astronomy Observatory, Pushchino 142290, Russian
Federation 22institutetext: ASTRON, the Netherlands Institute for Radio
Astronomy, Postbus 2, 7990 AA Dwingeloo, The Netherlands

# The Discovery of Transitive Phenomenon in the Radio Emission of the mode-
switcher PSR B0943+10

S. A. Suleymanova The Discovery of Transitive Phenomenon in the Radio Emission
of the mode-switcher PSR B0943+10The Discovery of Transitive Phenomenon in the
Radio Emission of the mode-switcher PSR B0943+10 A. V. Bilous The Discovery of
Transitive Phenomenon in the Radio Emission of the mode-switcher PSR
B0943+10The Discovery of Transitive Phenomenon in the Radio Emission of the
mode-switcher PSR B0943+10

PSR B0943+10 is known to switch between two distinct, hours-long modes of
radio emission, Bright (B) and Quiet (Q). Up to now the switches in both
directions were believed to occur instantly (on the scale of a spin period).
We have found a transitive process around the Q-to-B-mode switch, which
consists of two additional short-lived modes, each with distinct average
profiles and subpulse drift rates. Based on observations at low radio
frequencies, we examine the properties of these transitive modes and discuss
their implications in the framework of the traditional carousel model of
drifting subpulses.

###### Key Words.:

pulsars – individual sources PSR B0943+10

##  1 Introduction

PSR B0943+10 is a classical example of the so-called “mode-switching” pulsars,
a small subset of radio pulsars that switch between several stable states of
the electromagnetic emission. For PSR B0943+10, two modes have been identified
so far: ”Bright” (or ”Burst”) and “Quiet” (hereafter B-mode and Q-mode, see
Suleymanova & Izvekova, 1984). In radio band, both the average pulse shape and
the properties of single-pulse emission change between the modes, with B-mode
being notorious for the organized temporal drift of individual subpulses (e.g.
Deshpande & Rankin, 2001).

In the X-ray band, the radio mode switch is accompanied by changes in average
pulse morphology and flux density (Hermsen et al., 2013; Mereghetti et al.,
2016). The X-ray emission in both modes has a pulsed thermal component
originating in the hot polar cap region on the neutron star surface, few
hundred kilometers away from the presumable origin of the magnetospheric radio
emission (Bilous et al., 2014). Thus, some global-scale magnetospheric
transformation is expected during mode transitions (Timokhin, 2010; Cordes,
2013).

Studying the properties of mode transitions may help constraining the nature
of said transformation and the searches for peculiar single-pulse behavior
around mode switches have been conducted regularly. To the extent of authors’
knowledge, no such effects have been found so far: recorded mode transitions
happen instantly and abruptly (Bartel et al., 1982; Wang et al., 2007; Esamdin
et al., 2005; Rajwade et al., 2021).

For PSR B0943+10 mode transitions have been considered to be instantaneous as
well, although there is no clear corroboration of this in the published
literature. In this paper we report the discovery of transitive phenomena
around Q-to-B mode switches in several archival low-frequency observations
conducted at 112 MHz with Large Phased Array (LPA) at Pushchino Radio
Observatory (PRAO), and at 25$-$80 MHz with the LOw-Frequency ARray (LOFAR,
van Haarlem et al., 2013). This transitive state (hereafter T-mode) lasts for
about 1 minute or 60 pulsar rotations, thus being much shorter than the hours-
long main modes. We describe the peculiar single-pulse properties during
T-mode and speculate on their implications for the mode switching theories.

##  2 Observations and data processing

###  2.1 PRAO

LPA is a transit instrument and the duration of observing session can not
exceed 3.5 min/$\cos\delta$, where $\delta$ is the declination of the source.
For PSR B0943+10, with its spin period $P_{1}=1.0977$ s, this translates to a
maximum of 194 pulses available per session. The pulses were recorded using a
digital receiver with a bandwidth of 2.5 MHz divided into 512 4.88-kHz
spectral channels by a Fast Fourier Transform (FFT) processor. The actual
total bandwidth taken into processing was 2.245 MHz. The signal was
dedispersed to the frequency of 111.88 MHz (hereafter 112 MHz).

The narrow bandwidth of the channels reduced the effect of pulse broadening
caused by interstellar dispersion delay. At 112 MHz the total pulse delay
within a single channel for PSR B0943+10’s DM of 15.4 pc cm-3 is 0.5 ms, much
smaller than the time resolution of 2.8672 ms. More detailed description of
LPA’s digital receiver and data pre-processing is given in Suleymanova et al.
(2012).

With a rotation measure of $15\pm 1$ rad/m-2 (Suleymanova et al., 1998), the
Faraday modulation period at 112 MHz is about 1.6 MHz, which is comparable to
the total bandwidth of the receiver. Thus, despite LPA being a linearly
polarized array, the recordings provide a reasonable estimate of the pulsar’s
total intensity emission (see also Suleymanova & Rankin, 2009).

###  2.2 LOFAR

PSR B0943+10 was observed with the low-band antennas (LBAs) of LOFAR core
stations at a centre frequency of 53.8 MHz, and 25600 channels across a
78.1-MHz bandwidth. The time resolution of the raw data was 0.65 ms.
Observations were pre-processed with the standard LOFAR pulsar pipeline
(Stappers et al., 2011). The signal was dedispersed and folded synchronously
with the topocentric pulsar period obtained with the ephemerides from
Shabanova et al. (2013). The dedispersion was subsequently refined using a
more precise value of the dispersion measure (DM), obtained by measuring the
$\nu^{-2}$ lag of the fiducial point in the B-mode profile of the same
observations (Bilous et al., 2014). Each period contained 512 longitude bins,
corresponding to time resolution of about 2 ms. For further details of data
acquisition and pre-processing we refer the reader to Bilous et al. (2014) and
Bilous (2018).

For both LOFAR and PRAO data the subsequent analysis was performed on
frequency-integrated pulse stacks, 2D arrays of the uncalibrated total
intensity as a function of rotational longitude $\phi$ and time $t$,
$s(\phi,t)$. In this notation, time is assumed to be constant within each
rotational period of pulse stack: $t=[$pulse number$]\times P_{1}$.

##  3 Overview of the radio emission in main B- and Q-modes

###  3.1 Single pulses

Figure 1: Cartoon example of a drifting subpulse sequence, characterized by
the longitudinal spacing between subpulses $P_{2}$ and the amount of time
between successive appearances at the same spin longitude $\hat{P}_{3}$. In
this example subpulses are drifting towards the trailing edge of the onpulse
window. For clarity, here we draw $\hat{P}_{3}$ being equal to the integer
number of rotation periods, however this is not necessarily true in general.

Soon after the discovery of PSR B0943+10 in 1968 at PRAO (Vitkevich et al.,
1969), a remarkable organized change of its subpulse positions had been
noticed by Taylor & Huguenin (1971). Further investigations at 430 MHz
demonstrated that subpulses shift within the onpulse window with the rate of
approximately $4\aas@@fstack{\circ}4$ per stellar rotation (Backer et al.,
1975).

Following Edwards & Stappers (2003) and Bilous (2018), the subpulse position
$\mathrm{pos}_{\mathrm{drift}}$ can be mathematically expressed as follows:

$\mathrm{pos}_{\mathrm{drift}}(\phi,t)\sim\mathrm{Re}\left[\exp\left(i\dfrac{2\pi}{\hat{P}_{3}}t+i\dfrac{P_{1}}{P_{2}}\phi\right)\right].$
(1)

Here $\hat{P}_{3}$ is the observed modulation period along the lines of
constant $\phi$ and $P_{2}$ is the longitudinal spacing between subpulses
recorded within same pulse period (see Fig. 1).

Both $\hat{P}_{3}$ and $P_{2}$ can be positive or negative, and the apparent
direction of drift (i.e. whether pulses seem to march towards the leading or
trailing edges of the profile) depends on whether $P_{3}$ and $P_{2}$ have the
same sign. Following Edwards & Stappers (2003), we assume that $P_{2}$ is
always positive and let the sense of drift be determined by the sign of
$\hat{P}_{3}$.

$\hat{P}_{3}$ is usually determined from the longitude-resolved fluctuation
spectra (LRFS). LRFS consist of 1D Fourier transforms of the pulse stacks,
computed over the lines of constant rotational longitude $\phi$. When drift is
present, LRFS have two peaks at Fourier frequencies of $\nu_{t}=\pm
1/\hat{P}_{3}$. In this case $P_{2}$ can be assessed from evolution of the
complex phase of the Fourier transform with the longitude. If
$S(\phi,\nu_{t})$ is the longitude-resolved Fourier transform of $s(\phi,t)$
computed over the lines of constant $\phi$, then from Eq. 1 it follows that

$\displaystyle\mathrm{Arg}\left[S(\phi,\nu_{t}=1/\hat{P}_{3})\right]\sim
P_{2}\phi,$ (2)
$\displaystyle\mathrm{Arg}\left[S(\phi,\nu_{t}=-1/\hat{P}_{3})\right]\sim-
P_{2}\phi.$

Selecting the peak with the observed positive phase gradient will fix the sign
of $\hat{P}_{3}$.

Figure 2: Single-pulse sequences for six observing sessions at LPA (112 MHz)
and LOFAR (30$-$80 MHz) telescopes. The designations for sessions at LPA are
given in ddmmyy format. Observations with IDs starting with L were taken at
LOFAR. For all sessions only the on-pulse region is shown and the colors are
saturated to highlight fainter pulses. Mode boundaries were determined based
on the average profile morphology and the presence of subpulse drift in 2D FFT
spectra (Sect. 4.2.1). Sessions 051112, 150518, L99010 and L102418 feature
Q-to-B mode transitions. Session 260520 shows a rare B-Tb-B mode transition
and 221219 exhibits a typical featureless B-to-Q mode switch.

For PSR B0943+10, $\hat{P}_{3}\approx-2.2P_{1}$ and $P_{2}=11\degree$, meaning
that subpulses drift to the trailing edge of the onpulse window (Bilous,
2018). However, the absolute value of $\hat{P}_{3}$ is commonly used in the
literature (e.g. Deshpande & Rankin, 2001, and other papers in this series).
Since $\hat{P}_{3}$ is close to a small multiple of $P_{1}$, the apparent
drift is not obvious: the subpulses exhibit even-odd modulation together with
a slow shift towards the leading edge of the average profile (see Fig. 2).

Measuring $\hat{P}_{3}$ with LRFS does not solve the problem of aliasing. This
problem is caused by the undersampling of the subpulse motion (subpulses can
be observed only for a small fraction of pulse period) and by volatile
subpulse shapes, which prevent tracing the path of each specific subpulse
throughout a pulse sequence (van Leeuwen et al., 2003). The true drift period
$P_{3}$ in presence of aliasing is related to observed $\hat{P}_{3}$ as

$\dfrac{P_{1}}{P_{3}}=n+\dfrac{P_{1}}{\hat{P}_{3}},$ (3)

with the signed integer $n$ being the degree of aliasing. Note that the true
direction of drift rate can be different from the observed one.

In the work of Deshpande & Rankin (2001), $n$ was determined to be 1 based on
fleeting $37P_{1}$ modulation of subpulse intensity. This modulation was
interpreted within the popular carousel model (Ruderman & Sutherland, 1975).
In this model, pulsar emission comes from discrete spots located on a ring
centered on magnetic pole. The slow rotation of the carousel causes the
observed subpulse drift. Deshpande & Rankin argued that in their observations
the individual subpulses retained their relative distribution of amplitudes
for approximately $256P_{1}$, which allowed to trace individual subpulses and
resolve aliasing. Such amplitude modulation is extremely rare, with only two
other instances being found despite extensive searches (Backus et al., 2011;
Bilous, 2018).

PSR B0943+10 is unique in its slow consistent evolution of the drift
properties. Rankin & Suleymanova (2006) have found that PSR B0943+10ś subpulse
drift rate changes exponentially by some 5% during several hours after B-mode
onset with the characteristic time of about 73 min. The change is faster at
B-mode onset. Later it was found that this behavior is independent of
observing frequencies between 40 and 327 MHz and over the timescale of several
years (Rankin & Suleymanova, 2006; Backus et al., 2011; Suleymanova &
Pugachev, 2017; Bilous, 2018; Suleymanova et al., 2021).

In turn, emission in the Q-mode is stable in the sense that no gradual changes
in its properties have been recorded. Despite systematic searches, no drifting
subpulses have been detected in the Q-mode (Suleymanova & Izvekova, 1984;
Backus et al., 2010), except for an occasional feature at 0.0275
cycles/$P_{1}$ corresponding to $\hat{P}_{3}=36.4P_{1}$ (Rankin & Suleymanova,
2006). The origin of this feature is unclear and no similar features have been
found since then (Bilous, 2018).

###  3.2 Average profile

In both modes the average pulse profile is composed of two components of equal
width which are moving away from each other at lower frequencies. The full
width at half maximum of the components is about $7\aas@@fstack{\circ}2$ for
the B-mode and $11\aas@@fstack{\circ}5$ in Q-mode and does not show a strong
dependence on frequency between 40 and 80 MHz (Bilous et al., 2014). Recently
Suleymanova et al. (2021) have shown that the width of the average pulse
components in the B-mode is constant over the wider frequency range of
62$-$1391 MHz with the separation between components increasing rapidly
towards lower frequencies in accordance with a power law:

$s(^{\circ})=130\aas@@fstack{\circ}8\times\nu_{\mathrm{MHz}}^{-0.56}.$

In B-mode the leading component is generally brighter than the trailing one,
however the ratio of components’ peak amplitudes changes in a frequency-
dependent manner as the mode evolves. For the first few minutes of the B-mode,
the trailing component may be brighter, again in a frequency-dependent manner.
The fiducial longitude (midpoint between profile components, corresponding to
the moment of time when the line-of-sight (LOS) passes closest to the magnetic
axis) is systematically delayed by about $1\aas@@fstack{\circ}4$ per mode,
resetting at the next Q-to-B transition. The amplitude of delay does not
depend on frequency at least between 40 and 327 MHz (Bilous et al., 2014;
Suleymanova et al., 2021). No such effect has been identified for Q-mode.

##  4 The transitive phenomenon around Q-to-B transition

###  4.1 Identification of the Tb- and Tq-modes

Figure 3: Five records of Q-to-B mode switches from the archives of 112-MHz
observations. The intensity of subpulses in units of signal-to-noise ratio is
given as a function of pulse number. Individual modes are highlighted with
different colors (black for B-mode, green for Q-mode, red for Tb-mode, and
magenta for Tq-mode).

Figure 2 shows examples of individual pulse sequences for some of our
observations. In general, the difference between the B- and Q-modes is evident
to the naked eye. In the B-mode, individual pulses form two columns
corresponding to components of the average profile. The drift of subpulses
near central longitudes is not visible due to a decrease in average pulse
intensity in the saddle between the components. In the Q-mode subpulses are
distributed randomly within the on-pulse window.

Panels 150518, L99010, L102418 and 260520 show unusual behavior of subpulses
around Q-to-B mode transitions. When subpulse drift recommences after the end
of Q-mode, for a short period of time subpulses drift through entire on-pulse
window and, unlike later on, there is no fading of subpulses at central
longitudes. During this period the on-pulse window is somewhat narrower than
in well-established B-mode sequences.

These features allowed us to identify these particular sequences of pulses as
a new mode, which we designated “Transitive B-like” mode, or Tb-modes. Tb-mode
has been recorded in all available observations except for session L169237 in
Bilous et al. (2014). Comparing with the sessions presented on Fig. 2, the S/N
ratio of the pulsed signal is smaller there, and emission is modulated by
scintillation, with one of the intensity troughs coinciding with Q-to-B
transition (see Fig. 1 in Bilous et al., 2014).

On panel 260520, the subpulse drift pattern characteristic to Tb-mode is
observed in the 30-second interval between B-mode pulses. There are no Q-mode
pulses in this record, but the shape of the average B-mode pulse profile, with
two equally bright components, indicates that the Q-to-B switch occurred a few
minutes before the start of observing session (Rankin & Suleymanova, 2006;
Suleymanova & Rankin, 2009). The presence of Tb-mode pulses within the B-mode
sequence suggests that B-mode emission in the first minutes after mode onset
is unstable.

The Tb-mode is not the only transitive phenomenon around Q-to-B switches. Some
time before Q-mode cessation there appear groups of pulses that slowly drift
towards the trailing edge of the on-pulse window. This drift is present in all
but one Q-to-B transitions observed. We have labeled these slowly drifting
pulses as Transitive Q-like modes, or Tq-modes.

Figure 4: An example of a 2D (spin longitude vs pulse number) FFT spectrum
featuring the Tb-mode of session L102418 (left) and Tq-mode of session 150518
(right). The Fourier transform was taken from the region enclosed in the blue
rectangle on the left-side pulse sequence plot. Frequencies close to zero were
eliminated from analysis to reduce the influence of red noise on the peak
finding algorithm. The colorbar range in each figure is set by the local
minimum and maximum and is not uniform across different LRF spectra.

Both Tb- and Tq-modes exhibit drifting subpulses and the presence of this
drift was used to establish mode boundaries. However, the Tb-mode does not
follow Tq-mode immediately. Between them there is a gap of several spin
periods with very scarce single pulses resembling those of the Q-mode.
Interestingly enough, the only observed B-Tb-B transition also exhibits the
absence of emission for a few seconds before the Tb-mode starts (Fig. 2, panel
260520).

Because the transit time of PSR B0943+10 through the BSA beam is much smaller
than the typical duration of its main modes, the records of mode switching are
rare, with only five sessions with Q-to-B transitions being found in the
archives. Subpulse intensities for these five records are shown in Fig. 3,
with different modes shown by different colors. There are no Q-mode pulses in
the 090112 session. The low values of the subpulse drift rate indicated that
the first 42 pulses correspond to the Tb-mode, and the remaining pulses to the
B-mode. In addition, the shape of the averaged pulse in B-mode with the ratio
of components $R(2/1)=2.1$ clearly pointed out to the Q-to-B switch occurring
shortly before the start of the observation session (Rankin & Suleymanova,
2006; Suleymanova & Rankin, 2009).

In five cases on Fig. 3 the Tq-mode is much shorter than the Tb-mode, and in
one session (230920) it is absent completely. The duration of the Tb-mode
varies between sessions, comprising 17$-$66 spin periods or 19$-$69 s. At
lower frequencies, the two transitions recorded exhibit shorter Tb-modes –
only 13 s, however this may be just a coincidence. More low-frequency
observations are needed to explore the Tb-mode duration below 100 MHz.

To our surprise, the opposite, B-to-Q mode transitions were featureless (e.g.
panel 221219 on Fig. 2). No transitive phenomena were found in any of our
recordings.

###  4.2 Subpulse drift

####  4.2.1 Tb- and Tq-modes

Both Tb- and Tq-modes are much shorter than pulse sequences typically used for
computing LRF spectra and determining drift parameters in the B-mode. Cutting
the usual few-hundred pulse sequences around Tb- and Tq- modes pollutes the
spectra with either B-mode drift or Q-mode noise, diminishing the S/N of the
transitive mode spectra peaks, which is detrimental for the fainter Tq-mode
sequences. However, finding peaks on LRF spectra usually involves integrating
spectral power within onpulse window, thus not taking into account the
regularity of the longitude separation between subpulses in the same period
(this information is stored in the complex phase of LRF spectra). The 2D FFT
transform (Edwards & Stappers, 2003) does not have this disadvantage and thus
is better suited for measuring the drift parameters of the short pulse
sequences of the Tq- and Tb-modes.

To measure $\hat{P}_{3}$ and $P_{2}$ simultaneously, we performed 2D FFT
transforms in a fixed-size window sliding along the pulse number axis. The
window size was 10 pulses by $22\degree$ or $40\degree$ of rotational
longitude for LPA and LOFAR observations, respectively. The sliding step was
$2P_{1}$. In order to measure the position of FFT peak more precisely,
sequences of zeros were added to each data row, boosting the nominal Fourier
frequency resolution by a factor of 10. Formal errors on $\hat{P}_{3}$ and
$P_{2}$ were derived from the frequency resolution of the padded data
transforms, however the real, noise-influenced errors are supposed to be
larger by a factor of a few.

To estimate the significance of recorded features we performed the same
feature extraction procedure on original pulse sequences but with randomized
subpulse positions. The randomization was done by shuffling the pulse periods
within the groups of 4 phase bins. This way the average shape of 10-pulse
integrations was preserved, while destroying any periodicity along the axis of
constant longitude and attenuating the periodicity in orthogonal direction.
This procedure was performed 1000 times and the percentile of peak on FFT
spectrum of the real data was compared to the distribution of the
corresponding peaks of the simulation. Given the total length of the pulse
sequences explored, the total number of chance detections above our threshold
is estimated to be between 0.5 (independent 10-pulse sequences) and 6
(independent 2-pulse sequences).

Examples of 2D FFT spectra are given on Fig. 4. Most of the features detected
came from Tb- and B-modes where subpulse drift is visible to the naked eye. In
all but one sessions there had been significant detections of drift
periodicity in the Q-mode short before the Q-to-B transition (Tq-mode). In
both transitive modes, as well as in the B-mode the feature at positive
$P_{2}$ had negative $\hat{P}_{3}$, meaning that pulses drifted to the
trailing edge of the onpulse window.

Figure 5: The absolute value of the modulation frequency around the lines of
constant spin phase ($f_{3}\equiv|P_{1}/\hat{P}_{3}|$) as a function of time
for the pulse sequences from Fig. 2. Horizontal errorbars mark the edges of
10-pulse samples used for $f_{3}$ calculation. Vertical errorbars show the
nominal frequency determination error taking into account the zero-padding.
For each subsample, only $f_{3}$ with the highest S/N is plotted (see text for
details on S/N estimates). Only peaks which were stronger than 99.5% of the
simulated sample are shown. The vertical lines mark mode edges. All points
here correspond to negative $\hat{P}_{3}$ except for the hollow one for
session L99010. For the PRAO sessions, the absence of $f_{3}$ points near the
observation end is due to pulsar signal attenuation.

$\hat{P}_{3}$ in the Tq-mode varies substantially between mode instances,
ranging from approximately $3.2P_{1}$ to $6.7P_{1}$. It also exhibits
variation within the Tq-mode itself. For the Tb-mode $\hat{P}_{3}$ stays
closer to the B-mode values, most of the times being larger than in the
B-mode. The jitter of measured $\hat{P}_{3}$ in the B-mode is partially due to
noise influence, and partially intrinsic – in Bilous (2018) LRF spectra on
512-pulse sequences recorded multiple peaks with frequency spread on the order
of $0.01P_{1}/P_{3}$.

Interestingly enough, the subpulse separation remains more or less constant
throughout Tq-, Tb- and B-modes, varying chaotically around $11\degree$ with a
magnitude of $1\degree-2\degree$. $P_{2}$ for the same LOFAR sessions was also
measured in Bilous (2018) using a more precise phase track method on 512-pulse
sequences, which takes into account the observed increase of subpulse
separation at the edge of the onpulse window due to the curved LOS path. In
their work $P_{2}$ at the fiducial longitude (middle of onpulse window for PSR
B0943+10) is $10\aas@@fstack{\circ}6-10\aas@@fstack{\circ}8$, with
$P_{2}\approx 18\degree$ at $\pm 15\degree$ of spin longitude. In our case,
the 2D FFT gathers information from the entire onpulse window, thus our
$P_{2}$ is larger. Since pulse sequences comprise only 10 pulses, the
illumination of the onpulse window is quite uneven, bringing extra variability
in measured $P_{2}$.

####  4.2.2 Comparing drift properties in Tb- and B-modes

The shape of the average pulse changes abruptly during Tb-to-B transition,
however the evolution of drift parameters seems to be smooth. It is
interesting to compare $f_{3}\equiv|P_{1}/\hat{P}_{3}|$ in the Tb-mode to the
global evolution of $f_{3}$ during the B-mode. At 112 MHz we used a Discrete
Fourier Transform to calculate $f_{3}$ for short sequences of pulses of the
transitive modes. In some cases we were forced to calculate $f_{3}$ on longer
pulse sequences which included non-modulated Q-mode emission. For the LOFAR
data we used mean values of the Tb-modes from Fig. 5, with the errorbar
corresponding to the standard deviation of $f_{3}$.

Examples of onpulse-integrated LRFS for three such longer 91-pulse sequences
observed at 112 MHz are shown in Fig. 6 for the Tb-mode (session 150518),
early B-mode (session 260520), and late B-mode (221219). Each spectrum is
normalized by the peak amplitude for clarity. The features corresponding to
frequencies $f_{3}=0.428$, $0.449$, and $0.472$ cycles/$P_{1}$, respectively,
are narrow and well resolved111Note that for the Tb-mode some excess power is
present at $f_{3}$ going up to 0.5 cycles/$P_{1}$, corresponding to higher
$f_{3}$ during the first half of the Tb-mode for session 150518 in Fig. 5.. It
is obvious that $f_{3}$ gradually increases throughout the combined Tb- and
B-modes.

A larger compilation of $f_{3}$ measurements is shown in Fig. 7. It comprises
the $f_{3}$ values for the Tb- and B-modes from the current work, as well as
LOFAR B-mode measurements from Bilous (2018), and Arecibo 327-MHz values from
Rankin & Suleymanova (2006). As indicated in these studies and in Backus et
al. (2011), the frequency of the amplitude fluctuations varies with time
according to the exponential law (dashed line), where $t$ is the time since
mode onset (min):

$f_{3}=0.471-0.022\times e^{-t/73}.$ (4)

This equation limits $f_{3}$ to the range of $0.449-0.471$ cycles/$P_{1}$.
Numerous observations of PSR B0943+10 at 112 MHz showed that for roughly 2.5%
of B-mode pulse sequences $f_{3}<0.449$ cycles/$P_{1}$. Thus, Suleymanova &
Pugachev (2017) have proposed a better power-law parametrization that
encompasses all B-mode $f_{3}$ measurements:

$f_{3}=0.439\times t^{0.0126}.$ (5)

In the Tb-modes, $f_{3}$ varies in the range of 0.428$-$0.439 cycles/$P_{1}$
with a mean value of 0.434$\pm$0.004 cycles/$P_{1}$ that is significantly
lower than has ever been measured for the B-mode. Nevertheless, these values
can be considered as compatible with the power law $f_{3}$-time dependence in
the B-mode. For both functions in Fig. 7, $t=0$ at B-mode onset. During the
Tb-mode $t<0$, thus its $f_{3}$ values were not included in the power-law
fitting procedure. The average value of $f_{3}$ at B-mode onset following the
Tb-mode is 0.449$\pm$0.002 cycles/$P_{1}$, as it was expected.

Figure 6: Examples of onpulse-integrated LRF spectra calculated for 91-pulse
sequences containing the Tb-mode (150518, red line), early B-mode (260520,
blue line), or late B-mode (221219, black line). Corresponding frequencies are
0.428, 0.449, and 0.472 cycles/$P_{1}$. Figure 7: A compilation of observed
$f_{3}$ values as a function of time since B-mode onset. Previously published
$f_{3}$ measurements are shown by black stars (Arecibo, 327 MHz) and black
crosses (LOFAR, 30$-$80 MHz). The 112-MHz measurements for the Tb- and B-modes
from this work are shown with red circles and crosses. The $f_{3}$ value for
91 B-mode pulses right before a B-to-Q mode transition (session 221219) is
plotted at an arbitrary time mark of 250 min. LOFAR Tb-mode $f_{3}$
measurements are shown with blue triangles. The points around $t=180$ min show
typical $f_{3}$ errorbars for PRAO and LOFAR measurements from this work.
Horizontal lines mark the range of validity of the exponential fit by Backus
et al. (2011, dashed magenta line). The black line shows power-law fit from
Suleymanova & Pugachev (2017). The measurements for the Tb-mode are in a good
accordance with a power law fit.

###  4.3 Average pulse profile during transitive modes

Figure 8: Average profiles integrated within the respective modes for two
LOFAR sessions with Q-to-B transitions normalized by the standard deviation of
signal outside the on-pulse window.

Figure 8 shows the average profiles for all four modes in two LOFAR sessions
with Q-to-B transition. The shape of the average profile in transitive modes
varies between the sessions and is dominated by the individual strong pulses.
Given the small number of modes and their relative shortness, it is hard to
compare the average profiles in transitive modes with the regular B- and
Q-modes, however it can be stated that neither the Tq- nor Tb-mode exhibit two
distinct separate components like the B-mode.

PRAO observations offer larger mode samples and, also, longer instances of the
Tb-mode. Figure 9 shows the average profiles integrated within B- and Tb-modes
for the three PRAO sessions which exhibited prominent B-mode component peaks
to facilitate alignment between sessions. The bottom panel presents integrated
profiles for these three sessions, comprising 135 individual pulses for the
Tb-mode and 390 pulses for the B-mode. It is evident that at 112 MHz the Tb-
mode has no separate components and the profile is asymmetric and skewed to
earlier spin longitudes.

Interestingly, the shape of the pulse profile in the averaged Tb-mode closely
matches the composite Q+B profile recorded close to the B-to-Q transition
(session 221219, Fig. 10a, b). In the session 221219, the B-to-Q switch
happened in the middle of the observation. For comparison, the average Tb-mode
profile from Fig. 9 was shifted by 5.7 ms toward earlier spin longitudes. This
close resemblance of the pulse shapes could indicate that around the Q-to-B
switch the regions responsible for the Q- and B-modes emit simultaneously and
that their contribution is equal. This is possible only under the condition
that the B- and Q-pulses are emitted from two independent regions in the
pulsar magnetosphere. In the core/cone model (Rankin, 1983), the Q- and B-
modes in PSR B0943+10 are associated with the core and conal beams of emission
which emit alternately. The discovery of the transitive modes allow us to
suggest that over some short time these two independent regions may emit
simultaneously.

If the Tb-mode emission is indeed a superposition of the Q- and B-modes, then
the 5.7 ms delay is naturally explained by the evolution of the on-pulse
window location throughout the B-mode. It is known that during the lifetime of
each B-mode instance, the average pulse shifts towards later longitudes. The
total shift varies from 4 to 6 ms per B-mode duration (Bilous et al., 2014;
Suleymanova & Rodin, 2014; Suleymanova & Pugachev, 2017). Thus, the Tb-mode
emission is a superposition of late B-mode and the Q-mode. During the
instantaneous Tb-to-B switch the emission window resets at earlier longitudes
and the slow shift to the later longitudes continues during new B-mode
instance. Within this interpretation it is hard to explain though the B-Tb-B
sequence of the 260520 session, where both B-mode sequences framing the Tb-
mode exhibited the properties of the early B-mode.

Observational evidence speaks against the Q-mode emission being produced by a
core component in the core/cone model of the pulsar radio beam. First of all,
this evidence includes the appearance of organized subpulse drift (Tq-mode)
within the sequence of Q- mode pulses right before the Q-to-B switch and the
crude similarities between the shapes of the average profile in both modes.
Also, at frequencies lower than 100 MHz Q-mode profiles exhibit conal
components that separate progressively (Suleymanova et al., 1998; Bilous et
al., 2014). It was shown that for PSR B0943+10 the sightline makes only a
grazing transverse of the polar cap (Deshpande & Rankin, 2001) and the
scenario in which the observer misses most of the core radiation because of
this peripheral sightline was previously put forward to explain the relative
faintness of PSR B0943+10’s radio emission during its bright X-ray mode
(Hermsen et al., 2013; Rankin et al., 2020). Another scenario can be proposed
in which core radio beam is missed completely and all modes observed in PSR
B0943+10 originate from conal beam shape variations. These variations are
correlated with E$\times$B drift behaviour of the localized spark discharges.

Figure 9: Average pulse shape of the Tb-mode (red line) and the B-mode (black
line with crosses) for sessions (from top to bottom) 150518, 260520, and
090112. Profiles for different days were aligned by the leading peak of B-mode
profile. The lowest panel shows profiles averaged over these three sessions.
Figure 10: (a): mode-separated average profiles for session 221219, where the
B-to-Q transition occurred in the middle of the observation. Violet and green
lines correspond to the B- an Q-modes, respectively, and the thin blue line
shows composite B+Q profile. (b): B+Q profile (blue line) superposed on the
average Tb-mode pulse profile (red line) shifted by 5.7 ms towards earlier
spin longitudes. (c): the B-mode pulse shape evolution starting from its onset
(session 260520, dotted line) up to cessation (session 221219, violet line),
together with Tb-mode pulse (red line) shifted by 5.7 ms towards earlier spin
longitudes. (d): Tq-mode profile (blue line) accumulated from sessions 150518
and 051112. The B-mode profile on 260520 is given for comparison. Profiles for
different days were aligned by the leading peak of the B-mode profile.

Observations at 112 MHz show that the width of the on-pulse window stays
similar throughout all four modes (Fig. 10). It is considered to be determined
by the size of the polar cap with the radius $R_{\mathrm{out}}$. Within the
framework of the traditional core/cone model of pulsar radio emission (e.g.
Rankin, 1983, and other papers in this series), the width of the conal
components in the average pulse profile is set by the thickness of the pair-
producing ring in the polar gap:
$W_{\mathrm{ring}}=R_{\mathrm{out}}-R_{\mathrm{inn}}$, where
$R_{\mathrm{inn}}$ is the inner radius of the ring. We suggest that the
transitions between modes are accompanied by variations in the inner radius.
This can explain the gradual increasing of the component’s width over the
B-mode lifetime and the appearance of drifting subpulses at the central
longitudes in the Tb and Tq-modes. At B-mode onset the two components of the
average pulse profile are well separated with intensity in the saddle region
close to zero below 100 MHz. The width of the components is at its minimum and
grows with B-mode age (Bilous et al., 2014). For the leading component 112
MHz, the width can increase by as much as 40% (Suleymanova & Rodin, 2014).
This effect is well demonstrated in Fig. 10c, where the profiles of the
average pulse for the onset and the end of the B-mode are shown. The width of
the first component at the level of half maximum increases from 15 to 24 ms,
i.e. by 60%. The same panel shows the profile of the average Tb-mode with the
width of 30 ms. The total change in profile width between the Tb- and early
B-mode is 100%. With such a significant increase in the width of
$W_{\mathrm{ring}}$, central longitudes become illuminated for our line of
sight and we observe drifting subpulses close to fiducial longitude in
transitive modes.

Figure 10d shows the Tq-mode profile obtained at 112 MHz after averaging 20
pulses using sessions 150518 and 051112. It is worth noting that because of
the short duration of the mode its average profile is distorted by bright
pulses. However, comparing the Tq-mode to the Q-mode profile (Fig. 10a)
reveals similarity in profile shape as far as they are both skewed to the
trailing side (unlike B-mode). Similar behaviour is observed in LOFAR data
(Fig. 8).

##  5 Summary

In this work we report on the discovery of a transitive process which takes
place for about a minute around a Q-to-B-mode switch. This process consists of
two stages which we labelled Tb- and Tq- modes.

###  5.1 Tb-mode and its comparison to the B-mode.

  1. 1.

This mode precedes the B-mode onset by 40$\pm$25 s. The duration of the Tb-
modes exhibit larger variations from one instance to another, ranging between
$12P_{1}$ and $66P_{1}$.

  2. 2.

Similarly to B-mode, the individual subpulses drift from the leading to
trailing edge of the onpulse window, however the drift extends now through the
whole onpulse window, including central spin longitudes.

  3. 3.

The amplitude modulation frequency in the Tb-mode varies in the range of
0.428$-$0.439 cycles/$P_{1}$ with the mean value of 0.434$\pm$0.005
cycles/$P_{1}$ that is significantly lower than $f_{3}$ values measured for
the B-mode. Nevertheless, these values are in accordance with the power-law
$f_{3}$ evolution throughout B-mode.

  4. 4.

The average pulse profile in the Tb-mode is skewed to the leading edge,
similar to the B-mode, however it does not have resolved conal components.

  5. 5.

Sometimes the Tb-mode happens within an early B-mode instance.

###  5.2 Tq-mode and its comparison to the Q-mode.

  1. 1.

The Tq-mode occurs within the late Q-mode and, unlike the latter, has a
specific subpulse drift pattern. This mode precedes the Tb-mode onset by
34$\pm$7 s and lasts for about $10-22P_{1}$. In one session no Tq-mode was
recorded, however the S/N of the recording was quite low.

  2. 2.

As in the Tb- and B-modes, subpulses in the Tq-mode drift towards the trailing
edge of the onpulse window. The drift frequency $f_{3}$ varies from 0.149 to
0.312 cycles/$P_{1}$ from one observation to another, with sometimes large
variation of $f_{3}$ within the mode.

  3. 3.

The average pulse profile in the Tq-mode has a tendency to be skewed to the
trailing edge which is characteristic of the Q-mode.

##  6 Discussion

Short-lived mode sequences have been previously observed from several pulsars,
for example PSR B1859+17 (Rajwade et al., 2021), PSR J1326$-$6700 (Wen et al.,
2020), PSR J1909$-$3744 (Miles et al., 2021), and others. The peculiarity of
PSR B0943+10’s transitive modes lies in the fact that they usually appear in a
1-minute interval around the switch between the two main hours-long modes, the
Q- and B-mode. Both modes show similarities to the main modes and are
considered as submodes, which is reflected in their designation.

Gil & Sendyk (2000) argued that subpulse drift is observed when a quasi-
central spark is formed at the local pole of a sunspot-like surface magnetic
field. This fixed spark prevents other sparks from moving towards the pole,
restricting their motion to slow drift around the pole. Although little is
known about PSR B0943+10’s small-scale magnetic field configuration, we can
qualitatively apply this model to PSR B0943+10’s mode sequences. During the
Q-mode no central spark is formed, sparks are quickly moving towards magnetic
pole and subpulses are observed at random onpulse longitudes. At the end of
the Q-mode the anchor spark appears, causing Tq-mode sequences. The carousel
rotates relatively slowly and exhibits a lot of variation from one mode
instance to another, as well as within the Tq-mode, possibly reflecting fast-
paced changes in the spatial or temporal variations of accelerating potential
in the polar gap. Subpulses are seen in the central region of the on-pulse
window, indicating a larger width of the carousel. Subpulses briefly disappear
(except for may be a few pulses) during the null-like period between the Tq-
and Tb-modes. During the Tb-mode the carousel width remains large, but then
gradually decreases throughout the B-mode. The carousel rotation rate evolves
in a similar manner, more rapidly during the Tb- and early B-mode and more
slowly at the end. During the reverse B-to-Q transition the anchor spark
disappears and the drift ceases.

Drifting subpulses are traditionally used as a voltmeter to measure the
gradient of accelerating potential across the polar cap (van Leeuwen &
Timokhin, 2012). Assuming a small degree of aliasing in the B-, Tb- and Tq-
modes, the large and fast fractional change of $P_{3}$ in the Tb- and Tq-modes
(comparing to the more gradual smaller change over the course of B-mode) means
some rapid and powerful magnetospheric current rearrangements.

The timescales of mode switching for PSR B0943+10 and other mode-switching
pulsars are much larger than characteristic time scales of force-free
magnetospheres ($\sim P_{1}$). It has been conjectured that mode switching are
a manifestation of meta-stable magnetospheric states, produced by non-linear
interaction between the neutron star magnetic fields, polar cap cascades and
current sheets (Timokhin, 2010). In particular, these quasi-stable states can
have different open fieldline zone sizes and/or different current density
distributions within the open field line zone. If switches between the B- and
Q-mode are accompanied by a shrinking or expanding of the open field line zone
(“polar cap”, for dipole external magnetic field), then, assuming that the
radio emission comes from the last open field lines one may infer the polar
cap radius from the width of profiles in the B- and Q-modes. Taking 0.06 of
spin phase for the former and 0.05 for the latter, for the plausible ranges of
the inclination angle and LOS impact angle (Bilous, 2018), one may infer a 5%
shrinking of the polar cap radius in the Q-mode. According to Timokhin (2010)
such change would correspond to a 20% change in spin-down rate between the B-
and Q-modes. This change is not possible to detect directly for the $3\times
10^{-15}$ s/s spin down rate of PSR B0943+10 considering that mode switching
happens on a timescale of hours. However, if the relative fraction of Q- and
B-modes change slowly over time, this would have influence on the overall
spin-down rate. A similar effect was detected for PSR B1828$-$11, where a
variable rate of mode transitions were directly related to the spin-down
changes (Stairs et al., 2019).

Our crude estimate above implies that the size of polar cap (PC) is larger in
the B-mode. Rigoselli et al. (2019) performed direct fitting of the mode-
separated thermal X-ray spectra and lightcurves. Generally, the Q-mode has
larger polar cap size and larger temperature than B-mode, however the error
contours do permit 5% larger PCs radius in B-mode. For this, Q-mode PCs should
have about a 20% higher temperature.

On the other hand, Szary et al. (2015) proposed that mode switching reflects
switching between two kinds of partially screened gap, with different pair
production and a gap screening mechanism. For both kinds the PC temperature
should be roughly the same in order to maintain the thermostat mechanism of
the partially screened gap. This also does not contradict the results of
Rigoselli et al. (2019), although in this case the size of PC in the Q-mode
should be larger. We must note that the heating patterns are generally poorly
known and the PC is almost certainly not illuminated uniformly. Radio emission
may also be a poor indicator of the PC size, coming from the same field lines
in both modes but shifting in height.

So far both transitive modes exhibited quite large variations of properties
from one session to another. In order to deepen our understanding of the
carousel formation, more mode instances should be explored, preferably in a
wide frequency range.

###### Acknowledgements.

AB acknowledges the support from the European Research Council under the
European Union’s Seventh Framework Programme (FP/2007-2013)/ERC Grant
Agreement No. 617199 (‘ALERT’) and Vici research programme ‘ARGO’ with project
number 639.043.815, financed by the Dutch Research Council (NWO).

## References

  * Backer et al. (1975) Backer, D. C., Rankin, J. M., & Campbell, D. B. 1975, ApJ, 197, 481
  * Backus et al. (2010) Backus, I., Mitra, D., & Rankin, J. M. 2010, MNRAS, 41, 30
  * Backus et al. (2011) Backus, I., Mitra, D., & Rankin, J. M. 2011, MNRAS, 418, 1736
  * Bartel et al. (1982) Bartel, N., Morris, D., Sieber, W., & Hankins, T. H. 1982, ApJ, 258, 776
  * Bilous (2018) Bilous, A. V. 2018, A&A, 616, A119
  * Bilous et al. (2014) Bilous, A. V., Hessels, J. W. T., Kondratiev, V. I., et al. 2014, A&A, 572, A52 (B14)
  * Cordes (2013) Cordes, J. M. 2013, ApJ, 775, 47
  * Deshpande & Rankin (2001) Deshpande, A. A. & Rankin, J. M. 2001, MNRAS, 322, 438 (DR01)
  * Edwards & Stappers (2003) Edwards, R. T. & Stappers, B. W. 2003, A&A, 410, 961 (ES03)
  * Esamdin et al. (2005) Esamdin, A., Lyne, A. G., Graham-Smith, F., et al. 2005, MNRAS, 356, 59
  * Gil & Sendyk (2000) Gil, J. A. & Sendyk, M. 2000, ApJ, 541, 351
  * Hermsen et al. (2013) Hermsen, W., Hessels, J. W. T., Kuiper, L., et al. 2013, Science, 339, 436
  * Mereghetti et al. (2016) Mereghetti, S., Kuiper, L., Tiengo, A., et al. 2016, ApJ, 831, 21
  * Miles et al. (2021) Miles, M. T., Shannon, R. M., Bailes, M., et al. 2021, MNRAS
  * Rajwade et al. (2021) Rajwade, K. M., Perera, B. B. P., Stappers, B. W., et al. 2021, MNRAS, 506, 5836
  * Rankin (1983) Rankin, J. M. 1983, ApJ, 274, 333
  * Rankin et al. (2020) Rankin, J. M., Olszanski, T. E. E., & Wright, G. A. E. 2020, ApJ, 890, 151
  * Rankin & Suleymanova (2006) Rankin, J. M. & Suleymanova, S. A. 2006, A&A, 453, 679
  * Rigoselli et al. (2019) Rigoselli, M., Mereghetti, S., Turolla, R., et al. 2019, ApJ, 872, 15
  * Ruderman & Sutherland (1975) Ruderman, M. A. & Sutherland, P. G. 1975, ApJ, 196, 51
  * Shabanova et al. (2013) Shabanova, T. V., Pugachev, V. D., & Lapaev, K. A. 2013, ApJ, 775, 2
  * Stairs et al. (2019) Stairs, I. H., Lyne, A. G., Kramer, M., et al. 2019, MNRAS, 485, 3230
  * Stappers et al. (2011) Stappers, B. W., Hessels, J. W. T., Alexov, A., et al. 2011, A&A, 530, A80
  * Suleymanova & Izvekova (1984) Suleymanova, S. A. & Izvekova, V. A. 1984, Sov. Ast., 28, 32
  * Suleymanova et al. (1998) Suleymanova, S. A., Izvekova, V. A., Rankin, J. M., & Rathnasree, N. 1998, Journal of Astrophysics and Astronomy, 19, 1
  * Suleymanova et al. (2021) Suleymanova, S. A., Kazantsev, A. N., Rankin, J. M., & Logvinenko, S. V. 2021, MNRAS, 502, 6094
  * Suleymanova et al. (2012) Suleymanova, S. A., Logvinenko, S. V., & Smirnova, T. V. 2012, Astronomy Reports, 56, 207
  * Suleymanova & Pugachev (2017) Suleymanova, S. A. & Pugachev, V. D. 2017, Astronomy Reports, 61, 428
  * Suleymanova & Rankin (2009) Suleymanova, S. A. & Rankin, J. M. 2009, MNRAS, 396, 870
  * Suleymanova & Rodin (2014) Suleymanova, S. A. & Rodin, A. E. 2014, Astronomy Reports, 58, 796
  * Szary et al. (2015) Szary, A., Melikidze, G. I., & Gil, J. 2015, MNRAS, 447, 2295
  * Taylor & Huguenin (1971) Taylor, J. H. & Huguenin, G. R. 1971, ApJ, 167, 273
  * Timokhin (2010) Timokhin, A. N. 2010, MNRAS, 408, L41
  * van Haarlem et al. (2013) van Haarlem, M. P., Wise, M. W., Gunst, A. W., et al. 2013, A&A, 556, A2
  * van Leeuwen et al. (2003) van Leeuwen, A. G. J., Stappers, B. W., Ramachandran, R., & Rankin, J. M. 2003, A&A, 399, 223
  * van Leeuwen & Timokhin (2012) van Leeuwen, J. & Timokhin, A. N. 2012, ApJ, 752, 155
  * Vitkevich et al. (1969) Vitkevich, V. V., Alekseev, Y. I., Zhuravlev, V. F., & Shitov, Y. P. 1969, Nature, 224, 49
  * Wang et al. (2007) Wang, N., Manchester, R. N., & Johnston, S. 2007, MNRAS, 377, 1383
  * Wen et al. (2020) Wen, Z. G., Yan, W. M., Yuan, J. P., et al. 2020, ApJ, 904, 72


# Ensuring Visual Commonsense Morality for Text-to-Image Generation

Seongbeom Park  Suhong Moon  Jinkyu Kim

###### Abstract

Text-to-image generation methods produce high-resolution and high-quality
images, but these methods should not produce immoral images that may contain
inappropriate content from the perspective of commonsense morality. In this
paper, we aim to automatically judge the immorality of synthesized images and
manipulate these images into morally acceptable alternatives. To this end, we
build a model that has three main primitives: (1) recognition of the visual
commonsense immorality in a given image, (2) localization or highlighting of
immoral visual (and textual) attributes that contribute to the immorality of
the image, and (3) manipulation of an immoral image to create a morally-
qualifying alternative. We conduct experiments and human studies using the
state-of-the-art Stable Diffusion text-to-image generation model,
demonstrating the effectiveness of our ethical image manipulation approach.

Machine Learning, ICML

##  1 Introduction

Notable progress has been made in text-to-image synthesis lately with the
arising of various new machine learning methods, such as large-scale
generative models trained with sufficient data and scale (Ramesh et al.,
2021). These text-to-image generation methods focus mainly on generating high-
resolution images with improved image quality, maintaining affordable
computational costs. However, we observe in our experiment that these models
often synthesize images that clearly should not have been generated as their
content deviates from commonsense morality (see supplemental Figure 5).

Figure 1: Given an immoral image generated by a text-to-image generation
model, our model first judges its immorality, and then localizes visual and
textual attributes that make the image immoral (e.g., smoking). Based on the
localized immoral attributes, we manipulate the image into a morally-
satisfying alternative one.

Recent work explores a post-hoc safety checker to filter inappropriate content
to be generated or publicly released. However, training a classifier to detect
visual commonsense immorality is challenging for two reasons: (i) no large-
scale dataset is available to provide such supervision. (ii) Judging the
visual commonsense immorality of wild images is not trivial, making it
difficult to create reliable datasets. To address these concerns, recent work
(Jeong et al., 2022) leverages a text-image joint embedding space where
language supervision allows zero-shot transfer for vision-based tasks. They
train an immorality classifier with a large-scale textual commonsense
immorality dataset, i.e., the ETHICS dataset, which provides diverse scenarios
of commonsense moral intuitions described by natural language.

Figure 2: An overview of our proposed ethical image manipulation approach,
which edits an immoral input image into visually moral alternatives. Our model
consists of three main modules: (1) Visual Commonsense Immorality Recognizer
(Section 2.1), (2) Immoral Attribute Identifier (Section 2.2), and (3) Ethical
Image Manipulator (Section 2.3).

Our work starts with building a visual commonsense immorality recognizer, and
we aim to manipulate immorally generated images into visually moral
alternatives (see Figure 1). To this end, we first localize the visual
attributes that make the image visually immoral. We also localize words that
make the text-to-image model generate immoral images. Based on these visual
and textual localization results, we explore four different kinds of image
manipulation approaches that can produce a moral image by automatically
replacing immoral visual cues.

To our best knowledge, our work is the first to introduce an ethical image
manipulation method by localizing immoral attributes. We empirically
demonstrate the effectiveness of our proposed method with the state-of-the-art
text-to-image generation model called Stable Diffusion (Rombach et al., 2021).
Also, our human study confirms that our method successfully manipulates
immoral images into a moral alternative. We summarize our contributions as
follows:

  * •

Based on a visual commonsense immorality recognition, we introduce a textual
and visual immoral attribute localizer, which highlights immoral attributes
that make the input image visually immoral.

  * •

Given immoral visual and texture attributes, we introduce four different
ethical image manipulation approaches that can produce a moral image as output
by automatically replacing immoral visual cues.

  * •

We empirically analyze the effectiveness of our proposed approach with the
state-of-the-art model, Stable Diffusion, which is also supported by our human
study.

##  2 Method

###  2.1 Visual Commonsense Immorality Recognition

The Visual Commonsense Immorality Recognizer acts like a judge, determining
the immorality of a given input image. Training such a judge, however, is
challenging due to the lack of a large-scale, high-quality dataset for the
visual commonsense immorality recognition task. Instead, following the recent
work (Jeong et al., 2022), we utilize a pre-trained (frozen) image-text joint
embedding space, e.g., CLIP (Radford et al., 2021). Given this, we first train
an auxiliary text-based immorality classifier with the large-scale ETHICS
dataset, which provides over 13,000 textual examples and corresponding binary
labels. The immorality of an unseen image is then recognized through the joint
embedder and the trained immorality classifier in a zero-shot manner. We
explain more details about visual commonsense immorality recognition in
Appendix B.1.

###  2.2 Immoral Semantic Attribute Identification

Textual Immoral Attribute Identification by Masking. As shown in Figure 3, our
model localizes semantic immoral (visual or textual) attributes that make
image $\mathcal{I}$ visually immoral. To localize such words, we employ an
input sampling approach, which measures the importance of a word by setting it
masked and observing its effect on the model’s decision. Formally, given a
text-to-image model $f_{g}:\mathcal{T}\rightarrow\mathcal{I}$ and a visual
commonsense immorality classifier $f_{c}:\mathcal{I}\rightarrow\mathbb{R}$,
our model generates an image $\mathcal{I}^{\prime}$ from the given input
sentence $\mathcal{T}\in\\{w_{1},w_{2},\dots\\}$ as well as its visual
immorality score $s\in[0,1]$. We use a per-word binary mask
$\mathcal{M}^{T}:|\mathcal{T}|\rightarrow\\{0,1\\}$ to have masked input
sentence $\mathcal{T}^{\prime}=\mathcal{T}\odot\mathcal{M}^{T}$ where $\odot$
denotes element-wise multiplication. The importance score for each word
$w_{i}$ for $i\in\\{1,\dots,|\mathcal{T}|\\}$ is then computed as follows by
taking an expectation over all possible masks $\mathcal{M}^{T}$ conditioned on
the event that word $w_{i}$ is observed.

$s(w_{i})=\mathbb{E}_{\mathcal{M}^{T}}[f_{c}(f_{g}(\mathcal{T}\odot\mathcal{M}^{T}))|\mathcal{M}^{T}(w_{i})=1],\vspace{-.3em}$
(1)

where an importance map is obtained by summing over a set of masks
$\\{\mathcal{M}^{T}_{1},\dots,\mathcal{M}^{T}_{K}\\}$ with weights
$f_{c}(f_{g}(\mathcal{T}\odot\mathcal{M}^{T}_{k}))$.

Visual Immoral Attribute Identification by Randomized Masking. We extend
textual attribute identification to visual identification to localize which
visual attributes contribute to making the image $\mathcal{I}$ visually
immoral. As shown in Figure 3 (b), we employ a randomized input sampling
approach (Petsiuk et al., 2018) that can measure the importance of an image
region by setting it masked and observing its effect on the model’s decision.
Formally, given a visual commonsense immorality classifier
$f_{c}:\mathcal{I}\rightarrow\mathbb{R}$, we use a randomized binary mask
$\mathcal{M}_{i}^{I}$ to have masked input image
$\mathcal{I}^{\prime}=\mathcal{I}\odot\mathcal{M}^{I}$ where $\odot$ denotes
element-wise multiplication. The importance score for each image region
$x_{i}$ for $i\in\\{1,\dots,W\times H\\}$ is then computed as follows by
taking summation over masks $\mathcal{M}^{I}$ using Monte Carlo sampling:

$s(x_{i})=\frac{1}{P[\mathcal{M}^{I}(x_{i})=1]}\sum_{k=1}^{K}f_{c}(f_{g}(\mathcal{I}\odot\mathcal{M}^{I}_{k}))\cdot\mathcal{M}^{I}_{k}(x_{i}),$
(2)

where we similarly can obtain an importance map by summing over a set of masks
$\\{\mathcal{M}^{I}_{1},\dots,\mathcal{M}^{I}_{K}\\}$ with weights
$f_{c}(f_{g}(\mathcal{I}\odot\mathcal{M}^{I}_{k}))$.

###  2.3 Ethical Image Manipulation

Lastly, we introduce various image manipulation approaches to produce a moral
image by automatically replacing immoral visual cues. Here, we explore four
kinds of image manipulation approaches. (i) Blurring Immoral Visual Semantic
Cues. Given an immoral score map from the earlier step, we apply a blur kernel
in the spatial domain to degrade the visual quality of inappropriate content
(e.g., blurring a gun). (ii) Immoral Object Replacement by Moral Image
Inpainting. Instead of making blurry images, we apply an image inpainting
technique to replace immoral objects with moral alternatives. (iii) Text-
driven Image Manipulation with Moral Words. Our model searches for word
candidates (e.g., “water”) that is conditioned to manipulate an input image
(e.g., “people shooting a gun at each other”) into moral scenes (e.g., “people
shooting a water gun at each other”). (iv) Text-driven Image Manipulation with
Moral Image Captions. We utilize pre-trained image captioning models that are
trained with moral datasets; thus, they learn to generate moral image captions
even for immoral images. For example, they create the caption “a man wearing a
helmet and holding a camera” for an image of people shooting a gun at each
other. Text-driven image manipulator produces moral images accordingly. We
explain more details of each manipulation method in Appendix B.2, and an
overview of manipulation approach is described in supplemental Figure 7.

Figure 3: An overview of our (a) textual and (b) visual immoral attribute
identification.

##  3 Experiments

Our model utilizes the CLIP-based textual and image encoders (Radford et al.,
2021), which use contrastive learning to learn a visual-textual joint
representation. In this paper, we train our model with ETHICS Commonsense
Morality (Hendrycks et al., 2021) dataset, transferring knowledge from texts
to visual data by utilizing a joint embedding space. We provide other
implementation details in the Appendix C.

###  3.1 Qualitative Analysis

Analysis of Immoral Attribute Identification. Recall from Section 2.2, our key
component towards ethical image manipulation is the immoral attribute
identification module, which localizes important visual (or textual)
attributes that make the image immorally classified. We first observe that our
baseline, Stable Diffusion, produces immorally generated images as shown in
supplemental Figure 8 (see top row). Note that this model enables a so-called
Safety Checker to filter out images with ethical and moral concerns. Given
these immoral images as input, we apply our module and visualize the image-
based immorality score map as shown in supplemental Figure 8 (see bottom row).
Our module reasonably highlights immoral objects, such as localizing
cigarettes, blood, and a gun. Further, our model can highlight a set of words
that drive the text-driven image generator to produce immoral scenes.

Analysis of Blurring Immoral Visual Attributes. Recall from Section 2.3, we
explore four different ways of ethical image manipulation approaches. As shown
in Figure 4, for (i) Blurring and (ii) Moral Image Inpainting, we first
compute the spatial immorality score (see 2nd column) map from an immoral
image (see 1st column) generated by the Stable Diffusion model. We also
provide the manipulation outputs (3rd column) by blurring immoral contents.
Our model successfully localizes immoral visual attributes (e.g., bleeding
blood on the face or holding cigarettes) followed by blurring such localized
contents.

Analysis of Immoral Object Replacement by Moral Image Inpainting. We further
explore replacing immoral visual attributes with moral content using image
inpainting models, i.e., reconstructing immoral image regions in an image so
that the filled-in image becomes morally classified. In Figure 4 (last
column), we provide manipulated outputs from our moral image inpainting
approach. The inpainting model successfully replaces immoral visual attributes
with moral contents, such as bleeding blood on the face being replaced by a
smiling face.

Analysis of Text-driven Image Manipulation with Moral Image Captioning. In
addition to leveraging the image inpainting model, another way would be
utilizing an image captioning model trained with a highly-curated dataset
where immoral images and texts are filtered out. This approach produces
descriptive captions from a moral perspective, and examples are shown in
supplemental Figure 10. For example, an image of “a bride is bleeding” is
described as “a painting of a woman in a red dress”. Using these generated
captions as a condition, we can successfully manipulate them into a moral
scene (compare 1st vs. last two columns).

Analysis of Replacing Immoral Words with Moral Alternatives. Lastly,
supplemental Figure 9 shows examples of image manipulation by replacing
immoral words with moral alternatives. For example, given a text input, “A
baby holding a sword,” the image generator produces the corresponding image
without ethical screening (see 1st row). Our immoral attribute identifier
highlights the word “sword” contributes to the generated image being
classified as immoral, and our module searches for an alternative word (e.g.,
“fantasy”) that can be additionally conditioned to manipulate the given image
with reduced immorality. The alternative word provided manipulates the
generated immoral image into being more moral (see two right columns).

###  3.2 Quantitative Analysis

We conduct a human study to demonstrate whether our generated images are
indeed morally manipulated. As shown in supplemental Figure 12 (a), we
recruited 178 human evaluators, and we asked them to judge the immorality of
each generated image on a Likert scale from 1 (not immoral) to 5 (extremely
immoral). We compare scores between originally generated images by Stable
Diffusion (with Safety Checker enabled) and manipulated images from our four
approaches (i.e., blurring, inpainting, alternative word, and moral captions).
Except for the blurring-based approach, all approaches significantly reduce
perceived immorality. Especially an inpainting-based method shows the best
performance in ethical image manipulation. This confirms that our morally
manipulated images are more morally perceived than the original ones. As shown
in supplemental Figure 12 (b), we also experiment with our visual commonsense
immorality recognizer to compute immorality scores for each image. We observe
trends similar to our human evaluation, and this further confirms that our
visual commonsense immorality recognizer matches human perception.

##  4 Conclusion

Figure 4: We provide examples of the original images generated by Stable
Diffusion (1st column), immorality score maps (2nd column), manipulation
results by blurring immoral visual semantic attributes (3rd column), and moral
image inpainting (4th column).

In this paper, we introduced a method to manipulate an immorally generated
image into a moral one where immoral contents are localized and replaced by a
moral alternative attribute. We presented three essential modules: judging
visual commonsense immorality, localizing input-level immoral attributes, and
producing morally-satisfying manipulation images. Our human study and detailed
analysis demonstrate the effectiveness of our proposed ethical image
manipulation model.

##  5 Acknowledgments

This work was supported by the National Research Foundation of Korea grant
(NRF-2021R1C1C1009608, 25$\%$), Basic Science Research Program
(NRF-2021R1A6A1A13044830, 25$\%$) and by Institute of Information &
communications Technology Planning & Evaluation (IITP) grant funded by the
Korea government (MSIT) (2022-0-00043, 50$\%$).

## References

  * Awad et al. (2018) Awad, E., Dsouza, S., Kim, R., Schulz, J., Henrich, J., Shariff, A., Bonnefon, J.-F., and Rahwan, I.  The moral machine experiment.  _Nature_ , 563(7729):59–64, 2018.
  * Christiano et al. (2017) Christiano, P. F., Leike, J., Brown, T., Martic, M., Legg, S., and Amodei, D.  Deep reinforcement learning from human preferences.  _NIPS_ , 30, 2017.
  * Crone et al. (2018) Crone, D. L., Bode, S., Murawski, C., and Laham, S. M.  The socio-moral image database (smid): A novel stimulus set for the study of social, moral and affective processes.  _PLOS ONE_ , 13:1–34, 01 2018.  doi: 10.1371/journal.pone.0190954.  URL https://doi.org/10.1371/journal.pone.0190954.
  * Dhariwal & Nichol (2021) Dhariwal, P. and Nichol, A.  Diffusion models beat gans on image synthesis.  _NIPS_ , 34:8780–8794, 2021.
  * Ganguly et al. (2017) Ganguly, D., Mofrad, M. H., and Kovashka, A.  Detecting sexually provocative images.  In _WACV_ , pp. 660–668. IEEE, 2017.
  * Goodfellow et al. (2020) Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y.  Generative adversarial networks.  _Communications of the ACM_ , 63(11):139–144, 2020.
  * Hendrycks et al. (2021) Hendrycks, D., Burns, C., Basart, S., Critch, A., Li, J., Song, D., and Steinhardt, J.  Aligning ai with shared human values.  _ICLR_ , 2021.
  * Jeong et al. (2022) Jeong, Y., Park, S., Moon, S., and Kim, J.  Zero-shot visual immorality prediction.  _BMVC_ , 2022.
  * Kingma & Welling (2013) Kingma, D. P. and Welling, M.  Auto-encoding variational bayes.  _arXiv preprint arXiv:1312.6114_ , 2013.
  * Kleinberg et al. (2016) Kleinberg, J., Mullainathan, S., and Raghavan, M.  Inherent trade-offs in the fair determination of risk scores.  _arXiv preprint arXiv:1609.05807_ , 2016.
  * Kong & Ping (2021) Kong, Z. and Ping, W.  On fast sampling of diffusion probabilistic models.  _arXiv preprint arXiv:2106.00132_ , 2021.
  * Lin et al. (2014) Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollár, P., and Zitnick, C. L.  Microsoft coco: Common objects in context.  In _ECCV_ , pp. 740–755. Springer, 2014.
  * NLP Connect (2022) NLP Connect.  vit-gpt2-image-captioning (revision 0e334c7), 2022.  URL https://huggingface.co/nlpconnect/vit-gpt2-image-captioning.
  * Petsiuk et al. (2018) Petsiuk, V., Das, A., and Saenko, K.  Rise: Randomized input sampling for explanation of black-box models.  _arXiv preprint arXiv:1806.07421_ , 2018.
  * Radford et al. (2021) Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al.  Learning transferable visual models from natural language supervision.  In _ICML_ , pp. 8748–8763. PMLR, 2021.
  * Ramesh et al. (2021) Ramesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Radford, A., Chen, M., and Sutskever, I.  Zero-shot text-to-image generation.  In _ICML_ , pp. 8821–8831. PMLR, 2021.
  * Ray et al. (2019) Ray, A., Achiam, J., and Amodei, D.  Benchmarking safe exploration in deep reinforcement learning.  _arXiv preprint arXiv:1910.01708_ , 7:1, 2019.
  * Roller et al. (2020) Roller, S., Dinan, E., Goyal, N., Ju, D., Williamson, M., Liu, Y., Xu, J., Ott, M., Shuster, K., Smith, E. M., et al.  Recipes for building an open-domain chatbot.  _arXiv preprint arXiv:2004.13637_ , 2020.
  * Rombach et al. (2021) Rombach, R., Blattmann, A., Lorenz, D., Esser, P., and Ommer, B.  High-resolution image synthesis with latent diffusion models, 2021.
  * Vahdat & Kautz (2020) Vahdat, A. and Kautz, J.  Nvae: A deep hierarchical variational autoencoder.  _NIPS_ , 33:19667–19679, 2020.

Appendix

##  Appendix A Related Work

AI Ethics. There has been a long effort to build the concept of ethical
machine learning (Awad et al., 2018). Recently, AI ethics have become a more
apparent interest of importance in AI and CV communities. From Natural
Language Processing (NLP) community, an increasing number of papers have been
introduced, examining five different ethical categories: (i) Fairness
(Kleinberg et al., 2016), (ii) Safety (Ray et al., 2019), (iii) Prosocial
(Roller et al., 2020), (iv) Utility (Christiano et al., 2017), and (v)
Commonsense Morality (Hendrycks et al., 2021). Especially the last topic,
commonsense morality, has limited been explored in the computer vision
community, which mainly focuses on safety and fairness. Thus, this paper
focuses on commonsense morality from the computer vision perspective. Our work
starts by analyzing state-of-the-art text-to-image generation model, Stable
Diffusion, and we propose a novel ethical image manipulation approach to edit
the immorally generated image into a moral one.

Text-driven Image Generation and its Social Impact. There is a large volume of
literature on generative models for image synthesis. Various approaches have
been introduced, and most of these can be categorized into three different
methods: (i) Generative Adversarial Networks (GAN)-based modeling (Goodfellow
et al., 2020), which learns full data distribution with an efficient sampling
of natural images, (ii) Variational AutoEncoders (VAE) (Kingma & Welling,
2013) and flow-based models (Vahdat & Kautz, 2020), which have advantages in
the efficient generation of high-resolution images, and (iii) Diffusion
Probabilistic Models (Dhariwal & Nichol, 2021), which are recently
increasingly introduced and achieved state-of-the-art synthesizing results
given its high generation power.

Most of these generative models focus mainly on generating high-resolution
images with improved image quality, maintaining affordable computational costs
(Kong & Ping, 2021). However, we observe in our experiment that these models
often produce immoral images that clearly should not have been generated from
an ethical perspective. Recently, there has been an effort to address such
ethical concerns. For example, the state-of-the-art image generation model,
Stable Diffusion (Rombach et al., 2021), applies a so-called Safety Checker to
filter inappropriate content to be generated. However, in our experiment, the
current version of Stable Diffusion with Safety Checker enabled often produce
immoral images, as shown in Figure 5. Thus, our work starts by analyzing
Stable Diffusion, and we propose a novel ethical image manipulation approach
to edit the immorally generated image into a moral one. Our model consists of
the following three key components: (i) Visual Commonsense Immorality
Recognizer, (ii) (Visual and Textual) Immoral Attribute Identifier, and (iii)
Ethical Image Manipulator. To the best of our knowledge, our approach is the
first work to address ethical concerns of image generation models.

Figure 5: Immoral output images along with text inputs (top) generated by the
current version of Stable Diffusion (Rombach et al., 2021) model with its
safety checker (which filters out generated images with potential ethical and
moral concerns) module enabled. Note that we blurred some images due to their
inappropriate content. Figure 6: An overview of training visual commonsense
immorality recognition model. Following (Jeong et al., 2022), an immorality
classifier is trained to predict whether the input text prompt is moral or
immoral, e.g., a sentence “I punched my friend” needs to be classified as
immoral, while “I punched the punching bag” as moral. We use the large-scale
ETHICS dataset, which provides over 13k pairs of sentences and binary
annotation of morality. A frozen CLIP-based multi-modal joint embedding space
is used to predict the morality from an unseen input image in a zero-shot
manner.

##  Appendix B Ethical Image Manipulation Details

Figure 7: An overview of four different kinds of ethical image manipulation
methods: (a) Blurring Immoral Visual Semantic Attributes, (b) Immoral Object
Replacement by Moral Image Inpainting, (c) Text-driven Image Manipulation with
Moral Words, and (d) Text-driven Image Manipulation with Moral Image Captions.

###  B.1 Visual Commonsense Immorality Recognition

Formally, given an input text $\mathcal{T}$, we leverage the frozen CLIP
(Radford et al., 2021)-based text encoder $f_{t}$ followed by an immorality
classifier $f_{c}$: $\hat{y}=f_{c}(f_{t}(\mathcal{T}))$, where the immorality
classifier is trained with Binary Cross-Entropy Loss (BCELoss) as follows:

$\mathcal{L}_{c}=-\frac{1}{n}\sum_{i=1}^{n}[y_{i}\log{\sigma{(\hat{y}_{i})}+(1-y_{i})\log(1-\sigma{(\hat{y}_{i})})]},$
(3)

where $y_{i}\in\\{0,1\\}$ for $i\in\\{1,2,\dots,n\\}$ represents the
immorality target, and $\sigma$ represents a sigmoid function. At inference
time, we utilize the CLIP-based image encoder $f_{v}$, which maps semantic
text-image pairs close together in the joint embedding space. Thus, the final
output for the unseen image $\mathcal{I}$ is defined as follows:
$\hat{y}=f_{c}(f_{v}(\mathcal{I}))$. Overall architecture of visual
commonsense immorality recognizer is shown in Figure 6.

###  B.2 Ethical Image Manipulation

In this section, we provide further details on four different kinds of ethical
image manipulations: (i) Blurring Immoral Visual Semantic Cues, (ii) Immoral
Object Replacement by Moral Image Inpainting, (iii) Text-driven Image
Manipulation with Moral Words, and (iv) Text-driven Image Manipulation with
Moral Image Captions.

Blurring Immoral Visual Semantic Cues. As shown in Figure 7 (a), an intuitive
and simple way to manipulate a given image to be moral is via blurring immoral
visual contents (e.g., blurring a gun from a scene of people shooting a gun at
each other) with standard blur kernel functions such as Gaussian kernel. Given
the normalized per-pixel visual immorality scores $s(x_{i})$, we first divide
image regions into moral and immoral based on a user-specified threshold. We
apply a blur kernel function only to pixels in immoral image regions to have
blurred immoral visual contents.

Immoral Object Replacement by Moral Image Inpainting. Image inpainting models
are often used to restore missing regions in an image. They have many
applications in image editing, such as removing objects by synthesizing
semantically plausible and visually realistic pixels for the missing regions,
keeping coherency with existing content. Such image inpainting approaches are
also applicable to remove immoral objects and complete their pixels with moral
ones. Given the visual immorality score map, we remove immoral regions (set
pixel values to zero) that need to be restored and apply an off-the-shelf
image inpainting approach. We summarize details in Figure 7 (b), where our
image inpainting model replaces a gun with a telescope; thus, the image is
morally manipulated.

Replacing Immoral Words with Moral Alternatives. Our model identifies a set of
words that contributes to generating immoral images. Another intuition toward
ethical image manipulation would be using existing conditional image
manipulation models with a word, driving the model to generate a more moral
image. For example, as shown in Figure 9, we search for a word (e.g., water)
that will be conditioned to reduce the output’s immorality. Finding such a
word is challenging as it only needs to modify the immoral contents, while
keeping the original unrelated contents remain the same. In our experiment, we
use Google’s suggested search results, which reflect real searches that have
been done on Google related to the query. Moreover, immoral suggested queries
are filtered out due to Google Search’s policy to prevent harassing, hateful,
sexually explicit, and immoral content.

Text-driven Image Manipulation with Moral Image Captioning. Given an image
captioning model trained with a highly-curated dataset where immoral pictures
and texts are filtered out (e.g., MS-COCO (Lin et al., 2014) though it
contains a few images with immoral contents), a description of an immoral
image is obtainable from a moral perspective. As shown in Figure 7 (d), we
observe that a captioning model trained with the MS-COCO dataset generates “a
man wearing a helmet and holding a camera” for a scene of people shooting a
gun at each other. Using this morally-described caption as a condition for the
text-driven image manipulation model, we obtain a morally-manipulated scene
that does not differ much from the original scene.

Figure 8: Textual and visual immoral attribute identification examples. We
provide the initially generated images (top), the word-level textual immoral
attributes (words highlighted in red), and the immorality score maps (bottom)
generated by our model. Note that our model reasonably localizes immoral
objects (e.g., cigarettes, blood) as well as immoral contexts (e.g., 3rd-4th
columns). Figure 9: Examples of image manipulation where immoral words
(“sword” and “gun”) are identified and replaced by moral alternatives
(“fantasy sword” and “water gun”). We provide the initially generated image
(1st column), alternative words found (2nd column), and manipulated images
(3rd and 4th columns). Figure 10: Ethically manipulated images with moral
image captioning. We use an image captioning model (NLP Connect, 2022) trained
with a highly-curated dataset, MS-COCO (Lin et al., 2014). Though immoral
images are given as an input, moral captions are generated such as “a painting
of a man cutting a statue of a man” for the torturing image. Note the
similarities in hue and composition between the original image and the
manipulated image.

##  Appendix C Implementation Details

Following the recent work, we use CLIP (Radford et al., 2021) text/image
encoder with ViT-B/32 backbone as it shows the best performance in zero-shot
visual commonsense immorality prediction task (Jeong et al., 2022). We use
AdamW as an optimizer with an epsilon value 1e-8. We train our model for 500
epochs with the learning rate 0.002, weight decay parameter 0.01, batch size
128, and dropout probability 0.3. Following Hendrycks (Hendrycks et al.,
2021), we use an MLP to build our immorality classifier $f_{c}$. Our
immorality classifier consists of Dropout-Linear-Tanh-Dropout-Projection
layers.

To produce image inpainting results, we use an off-the-shelf image inpainting
model (Rombach et al., 2021) that fills immoral regions of an image with moral
content. Also, we apply the off-the-shelf image captioning model (NLP Connect,
2022) that is trained with the MS-COCO dataset.

##  Appendix D Analysis

Table 1: Zero-shot visual commonsense immorality prediction accuracy of our
model compared to previous work (Jeong et al., 2022).

Dataset | Jeong et al. | Ours
---|---|---
ViT-B/32 | ViT-B/16 | ViT-L/14 | ViT-B/32
MS-COCO (Lin et al., 2014) | 0.688 | 0.681 | 0.632 | 0.816
Socio-Moral Image (Crone et al., 2018) | 0.646 | 0.646 | 0.600 | 0.697
Sexual Intent Detection Images (Ganguly et al., 2017) | 0.493 | 0.420 | 0.520 | 0.559
Visual Commonsense Immorality (Jeong et al., 2022) | 0.962 | 0.776 | 0.720 | 0.816

Figure 11: Immoral captions (bottom row) generated by an image captioning
model (NLP Connect, 2022) trained with a highly-curated dataset, MS-COCO. Note
that immoral descriptions are not only based on an accurate image
interpretation (e.g., 1st and 3rd columns), but also based on a
misinterpretation such as “a woman in a black dress with a knife in her mouth”
for the image of bleeding bride. Some images are blurred due to their
inappropriate content.

Visual Immorality Recognition. We report the zero-shot visual commonsense
immorality classification performance of our immorality recognizer in
comparison to a previous study (Jeong et al., 2022). As shown in Table 1, our
model achieves the highest performance in three datasets. These results
highlight the potential of our immorality recognizer to improve ethical
considerations in various applications, such as image captioning and text-to-
image generation.

Failure Case of Image Captioning Method. Even though an image captioning model
trained with a highly-curated dataset, such as MS-COCO (Lin et al., 2014),
produces moral captions for most immoral image inputs, we observe in our
experiment that image captioning model can also produces immoral description
for a given image as shown in Figure 11. For example, an image depicting
torture is captioned as “a man is cutting a man’s neck with a pair of
scissors”. Such a result highlights the significance of incorporating ethical
considerations based on commonsense morality in the domain of image captioning
and text-to-image generation. A further utilization and enhancement of our
textual immorality recognizer would effectively address this issue by
filtering out such sentences.

Human Study Question Design. To conduct a human evaluation, we initially
generate immoral images of 10 different prompts with Stable Diffusion model.
For each original image, 4 images (i.e., blurred image, inpainted image,
manipulated image with alternative word, manipulated image with image
captioning) are additionally generated by our model. In total, we use 50
images (5 images per 10 prompts) in our human study. Example question of the
human study is shown in Figure 13.

Figure 12: (a) Our human evaluation results. Overall 178 human evaluators are
asked to judge the immorality of a given image on a Likert scale from 1 (not
immoral) to 5 (extremely immoral). (b) We also compare visual commonsense
immorality in the same setting. Note that we use our visual commonsense
immorality recognizer to compute such immorality scores. Figure 13: Example
question of the human study. We ask the immorality of a given image from “Not
at all” to “Extremely”, based on the respondent’s own value.