# Perfect optical spin-filtering in antiferromagnetic stanene nanoribbons
induced by band bending and uniaxial strain

F. Rahimi<EMAIL_ADDRESS>A. Phirouznia  Department of Physics,
Azarbaijan Shahid Madani University, 53714-161, Tabriz, Iran
Condensed Matter Computational Research Lab, Azarbaijan Shahid Madani
University, 53714-161, Tabriz, Iran

###### Abstract

Non-equilibrium spin-polarized transport properties of antiferromagnetic
stanene nanoribbons are theoretically studied under the combining effect of a
normal electric field and linearly polarized irradiation based on the tight-
binding model at room temperature. Due to the existence of spin-orbit coupling
in stanene lattice, applying normal electric field leads to splitting of band
degeneracy of spin-resolved energy levels in conduction and valence bands.
Furthermore, unequivalent absorption of the polarized photons at two valleys
which is attributed to an antiferromagnetic exchange field results in unequal
spin-polarized photocurrent for spin-up and spin-down components.
Interestingly, in the presence of band bending which has been induced by edge
potentials, an allowable quantum efficiency occurs over a wider wavelength
region of the incident light. It is especially important that the variation of
an exchange magnetic field generates spin semi-conducting behavior in the
bended band structure. Moreover, it is shown that optical spin-filtering
effect is obtained under the simultaneous effect of uniaxial strain and narrow
edge potential.

## Introduction

Recently, spin-functionalized optoelectronics properties of nanostructures
have attracted significant interest in the scientific community [2, 3, 4]. In
this field, interaction among the light and electrons by considering their
spin degree of freedom in the absence of an external bias is studied. In
modern optoelectronics, a large number of theoretical and experimental works
have been performed by considering optoelectronic and spintronic properties,
simultaneously [5, 6, 7]. Several approaches have been proposed to produce
spin current using optical absorption [8, 9].

Successful synthesis and peculiar optical, electrical and spin transport
features of graphene paved the way for utilizing of other two dimensional
$(2D)$ graphene-like materials in optoelectronics applications. General name
for $2D$ buckled monolayer structures which are formed by other group-IV
elements is $X$enes (silicene (Si-based), germanene (Ge-based) and stanene
(Sn-based)). The stable structure of the buckled $X$enes in comparison with
graphene is a consequence of a $sp^{2}-sp^{3}$ mixed hybridization of Si, Ge,
or Sn atoms in the forming process of these materials [10, 11]. The layer
separation between two triangular sub-lattices in this group of $2D$ materials
is called buckling height [12]. This buckled structure allows us to tune the
band gap size by applying a vertical electric field [13, 14, 15]. One of the
outstanding materials in this $2D$ material family is stanene. The existence
of strong spin -orbit coupling (arising from heavy Sn atoms) introduces
stanene as an ideal $2D$ topological insulator. Topological insulators are
featured with an insulating band gap in the bulk and conducting state at the
edges. These phases are proposed as preeminent candidates for spintronic
applications [16]. Recently, ultrathin Sn films with $2D$ stanene structure
have been observed on the substrate of $Bi_{2}Te_{3}$ by molecular beam
epitaxy experiment [17]. Also, other dominant physics features such as large-
gap $2D$ quantum spin Hall states [18], giant magnetoresistance, perfect spin
filter [19] and near-room-temperature quantum anomalous Hall effect [20] have
been reported for stanene.

Besides spintronic applications, stanene nanostructures are shown to be
promising candidates for optoelectronic devices, and there have been important
advances in this field during the last decade. Recently, electromagnetic
response of staggered $2D$ lattices is studied via an external electrostatic
field and circularly polarized laser light. It has been found that different
topological phases in these lattices exert influence on the resonant behavior
of nonlocal Hall conductivity, considerably [21]. Using density functional
calculations, electronic and optical properties of the graphene/stanene
heterobilayers are investigated. Combination of the high carrier mobility of
graphene and excellent spin Hall effect of stanene in these heterobilayers
facilitate the performance of stanene related spintronic devices and suggest
this material as a suitable candidate for photoelectronic devices [22]. In a
previous study using work function computations, it is revealed that stanene
and doped stanene have lower work function in comparison with graphene and
accordingly stanene is a good candidate for photocatalysis devices [23].

Mechanical control or so-called strain engineering is reported as a suitable
procedure for tuning optical and electronic properties in $2D$ allotrope of
group-IV elements [24, 25, 26, 27]. Due to the special structure of stanene,
it seems possible that one can tune stanene’s electronic properties by
applying external strains. In this regard, some studies have been performed.
By taking into account many-body effects, optical properties of stanene and
stanane (fully hydrogenated stanene) have been investigated by applying
strain. Strain induced optical gap of stanane provides valuable information on
the potential application of stanene optoelectronic devices such as solar
cells [28]. Furthermore, continuous evolution of the electronic bands of
stanene across nanoribbon is reported under the effect of strain field
gradient [28].

Besides the strain, there have been performed numerous studies on the band
structures engineering and conductance properties of $2D$ materials. The edge
potential is regarded as an efficient approach for engineering of electronic
structure. Specially, Rachel and Ezawa observed quantum spin Hall effect
without edge states only by employing different perturbations at the edges of
silicene nanoribbons [19].

Inspired by the increasing attention paid to spintronic and optoelectronic, in
this study spin-dependent optoelectronic properties of antiferromagnetic
zigzag stanene nanoribbons $(ZSNRs)$ are investigated theoretically at room
temperature. Electric field spin-polarized photocurrent is computed by means
of the self-consistent nonequilibrium Green’s function $(NEGF)$ formalism and
the tight-binding Hamiltonian under the effect of a linearly polarized
illumination. In order to improve the performance of the system, effects of
some external fields, such as edge potential and uniaxial strain are studied.
The results show that applying a vertical electric field at two edges of the
antiferromagnetic device results in band bending effect in the corresponding
spin-resolved band structure of $ZSNR$. It was shown that with the narrowing
of edge potentials, one could broaden the acceptable photoresponsivity in a
broad range of incident photon energies as well as increase optical spin
polarization percent. Finally, the effect of uniaxial strain on the optical
spin transport properties of the antiferromagnetic nanodevice in the presence
of edge potential is studied. The numerical results reveal nearly full optical
spin-filtering properties under the effect of different strains.

## Results and Discussion

Spin-polarized photocurrent
Spin-photocurrent across the antiferromagnetic single layer zigzag stanene
nanoribbons was simulated through the tight-binding approximation and the
$NEGF$ formalism by considering the combining effect of the normal electric
field and the linearly polarized light. The incident light is monochromatic
with constant intensity of $I_{w}=100\,\frac{kW}{cm^{2}}$, which is radiated
normally on the top of central channel. In this study, the scattering region
has constant length which consisting of $120$ unit cells which is sandwiched
between two semi-infinite left and right leads. In addition, the scattering
region, the left and right leads have same structure.

In the first instance, spin transport properties of $ZSNR$ with $N=10$ zigzag
chains and $20$ atoms in the unit cell are investigated. To this end, spin-
resolved band structures of the antiferromagnetic $ZSNR$ for various strengths
of $E_{z}$ is shown in Fig. 1. These results are similar to reports of
previous study [29]. As can be seen in Fig. 1(a), in the absence of $E_{z}$,
twofold spin degeneracy of the band structure is observed. Applying the
external electric field breaks inversion symmetry. The inversion symmetry
breaking in combination with the large spin-orbit coupling lifts the band
degeneracy in stanene. Also, it is found that switching the direction of the
normal electric field will reverse the spin polarization of the band structure
and hence, sign of the spin polarized photocurrent. Moreover, finite energy
band gap is emerged between spin-up and spin-down energy levels. (Figs. 1 (b)
and 1(c)). As depicted in these figures, the magnitude of band gap is
different for spin-up and spin-down energy levels. In the absence of
antiferromagnetic term, the magnitude of band gap is equal for both spin
states. Physically, due to different effect of the antiferromagnetic term on
the potential energies of spin states in the on-site terms of the Hamiltonian,
it is expected unequal displacement of spin-up and spin-down energy levels.
Accordingly, the presence of the antiferromagnetic exchange field leads to
asymmetric spin-dependent band gap and breaking of time-reversal symmetry
[30].

The spin-polarized quantum efficiency of $10ZSNR$ with $M_{AF}=0.025t$ versus
photon energy under the linearly polarized light and for different strengths
of $E_{z}$ is plotted in Fig. 2. As presented explicitly in the inset of Fig.
1(b), the asymmetry of band gap energy at the $K$ and the $K^{{}^{\prime}}$
valleys results in unequal absorption of light which leads to spin population
imbalance in these valleys. It can be said that these valleys in $ZSNR$ are
approximately equivalent to the valleys of infinite stanene sheet which are
around the Dirac points [31]. Also, spin splitting of the energy band
structure gives rise to spin-dependent absorption when the linearly polarized
illumination is shed normally on the top of central region. On the other hand,
because of the relatively large enough spin relaxation time in stanene [32],
the electron preserves its spin in this photo-excited phenomena. In fact, the
spin-polarized carriers are excited from spin up(down) valence sub-bands to
spin up(down) conduction sub-bands by photons with an appropriate energy.
Based on these discussions, different occupation numbers between the $K$ and
the $K^{{}^{\prime}}$ ($K^{{}^{\prime}}=-K$ ) valleys, which has been induced
by the antiferromagnetic exchange field, leads to a unequal spin-polarized
photocurrent for spin-up and spin down components. It should be mention that
the normal electric field and the antiferromagnetic exchange field is applied
to the scattering region.

As can be observed in Fig.2, the acceptable quantum efficiency is obtained for
the photon energy within the range $2.5\>eV<E_{ph}<3.56\>eV$. From the results
represented in Fig.2, one can see considerable variations in spin
optoelectronic properties of $ZSNR$ in the whole allowable photon energy
range. In addition, position and magnitude of the most probable optical
transitions are varied by different strengths of $E_{z}$. It is obvious that
the electric field changes magnitude of the first optical absorption
considerably.

For more clarification, optical spin polarizations of $ZSNR$ for various
strengths of $E_{z}$ is displayed in Fig. 3. The spin polarization diagrams
for different magnitudes of the electric field have similar qualitative
behavior, nearly.

Moreover, spin optoelectronic properties of other narrow ribbons with various
widths has been studied. The results reveal similar qualitative behavior but
with differences in the magnitudes, positions of the highest peaks of quantum
efficiency and acceptable range of the photoresponsivity. These results
demonstrate the robustness of the obtained results to the ribbon size.

Band bending
In this section the effect of band bending on the spin transport properties of
single layer antiferromagnetic $ZSNR$ is investigated. A previous study on the
band structure and conductance of a zigzag silicene nanoribbon has shown that
band bending could be created and controlled by the edge potentials. The
bending near valleys can be realized by the edge states [33]. In this paper,
we proceed further by studying the benefits of both $2D$ buckled structure and
antiferromagnetic spintronics in order to harnessing spin dependent transport
in narrow $ZSNRs$ in the presence of band bending. To this end, firstly, the
band structures of $10ZSNR$ in the presence of edge electric field is analyzed
(Fig. 4). In Fig. 4(a), the edge field is applied to $N=8$ zigzag chains, such
that two chains which are located at the center of ribbon are not affected by
$E_{z}$. Also, in Fig. 4(b), the edge potential is applied to $N=4$ zigzag
chains and six chains at the center of ribbon are not affected by $E_{z}$. It
should be noted that applied edge fields at the two edges of ribbon are
symmetric, that is, $\vec{E_{z1}}=\vec{E_{z2}}=\vec{E_{z}}\vec{z}$. Owing to
the buckled structure of stanene, the edge potentials could significantly
impact on the edge states and the band structure. Fig. 4(a) and Fig. 4(b)
indicate that with the narrowing of edge field, the bending enhances
gradually, which is in good agreement with previous report [33]. Also, in Fig.
4(c) electronic band structure of $10ZSNR$ with narrow edge field and
$M_{AF}=0.03t$ is displayed. By increasing the magnitude of antiferromagnetic
exchange field from $M_{AF}=0.025t$ to $M_{AF}=0.03t$ in combination with
applied edge field to $N=4$ chains, the half-metal behavior is revealed at the
band structure as shown in Fig. 4(c). For spin-down electrons, the gap is
closed and metallic behavior is observed, while spin-up carries display still
semiconductor properties.

Quantum efficiency as a function of photon energy for the spin-photovoltaic
device based on antiferromagnetic $10ZSNR$ under applied edge field to $N=8$
chains is presented in Fig. 5. Note that, here, $elE_{z}=0.09t$ and
$M_{AF}=0.025t$. In comparison with Fig. 2(a), it is clear that , in general,
quantum efficiency is enhanced for both spin states in the presence of edge
potential. Note that, in Fig. 2, the electric field is applied to the whole
area of the central region. Furthermore, acceptable range of the
photoresponsivity is broaden under edge potential. In this case, the maximum
magnitude of the spin polarization is obtained $95.94\>\%$. at
$E_{ph}=4.04\>eV$. In Figs. 6(a) and 6(b), quantum efficiency and spin
polarization of $10ZSNR$ under applied edge field to $N=4$ chains are
computed, respectively. Other parameters are: $elE_{z}=0.09t$ and
$M_{AF}=0.025t$. By comparing Fig. 6(a) with Fig. 5(a), it is clear that
allowable range of the photoresponsivity is broaden with the narrowing of the
edge field. Additionally, the identical qualitative manner of the quantum
efficiency is realized, although position and height of the spin-dependent
optical transition lines are different, which comes from the difference in the
spin-resolved band structure for spin-up and spin-down states. By evaluating
of the spin polarization diagrams in Fig. 6(b) and Fig. 5(b), one can see that
spin polarization is improved with the narrowing of the edge potential. The
highest spin polarization peak of $99.43\>\%$ is appeared at
$E_{ph}=4.26\>eV$. The effect of the antiferromagnetic exchange field strength
increasing on spin optoelectronic behavior is investigated in Fig. 7. In this
figure, the edge potential is applied to the $N=4$ zigzag chains with
$elE_{z}=0.09t$ and here $M_{AF}=0.03t$. Obviously in Fig. 7(a), quantum
efficiency of spin-down carries is higher than quantum efficiency of spin-up
carries for a broad range of photon energies which is in contrast to the
observed overall trend for quantum efficiency in the presence of the edge
field (Fig. 5(a) and Fig. 6(a)). This distinguished behavior can be attributed
to the half-metallic feature of spin-down component. Moreover, as can be
observed in Fig. 7(b), the perfect $(100\%)$ optical spin polarization is
obtained at $E_{ph}=3.98\>eV$.

Strain
In the crystal structure of a unstrained single-layer stanene and equilibrium
condition, each atom of the upper sublattice is connected to its neighboring
atoms in the lower sublattice through three bond vectors:
$R_{1}^{0}=\frac{a}{\sqrt{3}}(\frac{\sqrt{3}}{2},\frac{1}{2},\cot\varphi)$,
$R_{2}^{0}=\frac{a}{\sqrt{3}}(-\frac{\sqrt{3}}{2},\frac{1}{2},\cot\varphi)$
and $R_{3}^{0}=\frac{a}{\sqrt{3}}(0,-1,\cot\varphi)$, where $a=4.7\hskip
5.69054pt\AA{}$ is lattice constant of stanene and $\varphi=107.1^{0}$. The
presence of an external tension T, which is defined as
$\textbf{T}=T\cos\theta\hskip 5.69054pt\hat{e_{x}}+T\sin\theta\hskip
5.69054pt\hat{e_{y}}$, leads to the transformation of these vectors.
Longitudinal expansion of stanene layer arising from tension is determined by
$\epsilon=(\acute{a}-a)/a$. The tight-binding approximation is a standard
approach to describe the electronic properties of nanodevices. One of the
important benefits of this approximation is that one can take into account the
effect of strain only by modifying the tight-binding parameters. By applying a
uniaxial strain in stanene, equilibrium distance,
$R_{0}=a/(\sqrt{3}\sin\varphi)$, is distorted. Thereby, the hopping energy is
changed. Calculations demonstrate that under the effect of strain, hopping
coefficients are modified as follows [34]:

$\displaystyle t_{n}(R_{n})=t(1-\beta\,\frac{\delta\,R_{n}}{R_{0}}),\quad
n=1,2,3$ (1)

where $\beta$ is Grüneisen parameter and in our simulation we take
$\beta=1.95$ [35, 36].

To study the effects of a uniaxial strain on the performance of proposed spin-
optoelectronic device based on antiferromagnetic ZSNRs, the spin-dependent
band structure and the quantum efficiency under various strains is inspected.
Experimentally, in 2D materials, local strains are generated by depositing
them on a prestretched elastomeric [37] or rough substrates [38].

The results mentioned in this sub-section are for the case in which spin-
optoelectronic device is based on antiferromagnetic $10ZSNR$ and edge
potential is applied to $N=4$ zigzag chains where six chains at the center of
ribbon are not affected by $E_{z}$. As depicted in Fig. 8, applying the
uniaxial strain leads to a shift in the spin-resolved sub-bands around the
Fermi energy and it therefore results in change of population of the states.
As a consequence, by employing strain, one can monitor accumulation of spin-
polarized carriers in the scattering region. In this case, the variation of
the kinetic energy induced by strain in the hopping term of the Hamiltonian is
included. This may lead to the alteration of magnitude and also the number of
peaks corresponding to spin-up and spin-down components.

Fig. 9 presents the numerical results for the spin-dependent quantum
efficiency of $10ZSNR$ for different applied tensions. As can be seen in this
figure, different tensions reveal spin-optoelectronic features in an energy
range between $2.2\>eV<E_{ph}<4.28\>eV$. In addition, the similar qualitative
behavior for the spin-dependent quantum efficiency diagram is obtained in the
presence of different strains. Nevertheless, due to the variation in spin-
resolved energy levels and the existence of various band gaps for spin-up and
spin-down states for different strains, location and height of the spin-
dependent optical transition peaks are varied. Moreover, by comparing Fig. 9
with Fig. 6(a) it can be understood that in the presence of strain the
magnitude of quantum efficiency is decreased strongly for spin down component
and moderately increased for spin up component. Accordingly, it is expected
that applying strain leads to spin-filtering effect in the spin optoelectronic
device.

In order to get an exact explanation of spin-filtering effect in the presence
of strain, the optical spin polarization of ZSNR as function of the photon
energy is shown in Fig. 10 for different strengths of the strain. As mentioned
earlier, the spin splitting of the electronic band structures which is
attributed to the simultaneous effect of vertical electric field and large
spin orbit coupling leads to appearance of the spin polarization and
particularly, a fully spin-polarized photocurrent for only one spin state.
Furthermore, the spin-filtering photoresponsivity which is induced under the
effect of strain is occurred for the wide photon energy range from $2.84\>eV$
to $4.28\>eV$, approximately. It can be said that strain improves the optical
spin-filtering property of stanene lattice such that the full spin
polarization range of the photon energy is broaden considerably.

Conclusion

In summary, spin-polarized photocurrent in the antiferromagnetic single layer
stanene nanoribbon under the perpendicular electric field is theoretically
investigated. Optical response of spin optoelectronic nanodevice in the
presence of linearly polarized illumination is calculated by means of the
self-consistent nonequilibrium Green’s function approach together with the
tight-binding model. In antiferromagnetic $SZNR$, twofold spin degeneracy of
spin-resolved energy levels is split due to combination effect of the vertical
electric field and the large spin-orbit interaction in stanene lattice. Also,
robustness of the spin-polarized photocurrent has been demonstrated when the
electric field is applied on the two edges. Interestingly, the spin-polarized
current is generated in the wide wavelength region of incident light in the
presence of the edge potential. Besides, the results indicate that band
bending enhances spin-polarization in device. In particular, it is shown that
in the presence of the narrow edge potential, by varying antiferromagnetic
exchange field, spin-semiconducting behavior is obtained in stanene
nanoribbon. This behavior arises as a consequence of the large spin-orbit
coupling in stanene lattice. Furthermore, it is found that the spin-resolved
photocurrent can be engineered by external strain and nearly full optical
spin-filtering is obtained in antiferromagnetic stanene lattice under the
combining effect of strain and narrow edge potential. The obtained results in
this study may be useful to develop stanene-based nanodevices such as spin-
photo detectors, spin photodiodes and generation of full spin-filtering.

## MODEL AND METHOD

The proposed spin optoelectronic device is designed based on $ZSNR$ in the
presence of some external field, such as normal electric field,
antiferromagnetic field and linearly polarized light field. The performed
simulations are divided into two self-consistent computations, in which the
first part is based on calculating spin-dependent electron features of $ZSNR$
and the second part taking into account the quantum transport equation of the
interaction of light with matter by employing the $NEGF$ approach. It is
worthy to mention that due to the absence of impurity or the electron-phonon
interaction in the present study, spin-flip mechanisms are neglected [32].
Consequently, transport equations have been solved for spin-up and spin-down
components, individually.

The total Hamiltonian of the proposed nanodevice is divided as follows:

$H_{T}=H_{L}+H_{R}+H_{C}+H_{CL}+H_{CR}.$ (2)

Where the first two contributions in Eq.(1) are the Hamiltonian of semi-
infinite left and right leads, respectively. $H_{LC}$ and $H_{RC}$ describe
coupling between the scattering region and the left and right leads. $H_{C}$
represents the Hamiltonian of scattering region:

$H_{C}=H_{0}+H_{e\gamma}.$ (3)

$H_{0}$ is the tight-binding model in the presence of antiferromagnetic field
and the normal electric field as follows [39, 40]:

$\displaystyle H_{0}$ $\displaystyle=$
$\displaystyle-t\sum_{\langle\,i,j\rangle,\alpha}c^{\dagger}_{i\alpha}c_{j\alpha}+i\frac{\lambda_{so}}{3\sqrt{3}}\sum_{\langle\langle\,i,j\rangle,\alpha,\beta}\nu_{ij}c^{\dagger}_{i\alpha}\sigma^{z}_{\alpha\beta}c_{j\beta}$
(4) $\displaystyle+e\ell
E_{z}\sum_{i,\alpha}\xi_{i}c^{\dagger}_{i\alpha}c_{i\alpha}+M_{AF}\sum_{i,\alpha,\beta}\xi_{i}c^{\dagger}_{i\alpha}\sigma^{z}_{\alpha\beta}c_{j\beta}.$

Where $t$ is the usual nearest-neighbor hopping in the scattering region and
its value is equal to $1.3\>eV$. $c_{i\alpha}(c^{\dagger}_{i\alpha})$
annihilates (creates) an electron with spin polarization $\alpha$ at atom $i$,
and $<i,j>$ ($<<i,j>>$) represents the sum over nearest (next-nearest) Sn-Sn
pairs. The second term in Eq.(3) accounts for the effective spin orbit
coupling parameter with a coupling strength of $\lambda_{so}=100\>meV$.
$\vec{\sigma}=(\sigma_{x},\sigma_{y},\sigma_{z})$ is the Pauli’s spin matrix.
$\nu_{ij}=-1(+1)$ for clockwise (anticlockwise) next-nearest-neighboring
hopping. The third contribution denotes the effect of a perpendicular electric
field $E_{z}$. Also, $\ell$ is the buckling height and $\xi_{i}$ is equal to
$+1(-1)$ for the upper (lower) sublattice. The last term is related to
antiferromagnetic exchange field [41, 30].
$H_{e\gamma}=\frac{e}{m_{e}}\,\vec{A}\,.\,\vec{P}$ indicates the electron-
photon interaction and it is considered as the first-order perturbation
Hamiltonian. $m_{e}$ is the mass of electron, $\vec{A}$ and $\vec{P}$
represent the time-dependent electromagnetic vector potential and the momentum
of the electron, respectively [42, 43].

After computing the Hamiltonian of the scattering region and the left and
right leads, the retarded Green’s function of the nanodevice, in the presence
of light radiation, can be written as:

$\displaystyle
G_{\sigma}(E)=[(E+i\eta)I-H_{C,\sigma}-\Sigma_{T,\sigma}]^{-1},$ (5)

where

$\displaystyle\Sigma_{T,\sigma}=\Sigma_{L,\sigma}+\Sigma_{R,\sigma}+\Sigma_{\gamma,\sigma}.$
(6)

In Eq.(4), $\eta$ and $I$ are infinitesimal broadening and identity matrix,
respectively. $\Sigma_{L(R),\sigma}$ is the retarded self-energy due to the
presence of the left and right leads. While the self-energies of the left and
right contacts were computed by the Sancho iterative approach [44, 45], the
electron-photon scattering is included as self-energy term. In Eq.(5),
$\Sigma_{\gamma,\sigma}$ is the self-energy of the electron-photon interaction
which is expressed as:

$\displaystyle\Sigma_{\gamma,\sigma}=\frac{-i}{2}[\Sigma_{\gamma,\sigma}^{\textless}(E)-\Sigma_{\gamma,\sigma}^{\textgreater}(E)].$
(7)

$\Sigma_{\gamma,\sigma}^{\textless}$ and
$\Sigma_{\gamma,\sigma}^{\textgreater}$ are the lesser and greater self-
energies of the electron-photon scattering which are given as follows:

$\displaystyle\Sigma_{\gamma,\sigma}^{\gtrless}(E)$ $\displaystyle=$
$\displaystyle(N_{\gamma}+1)M^{\gamma}G_{\sigma}^{\gtrless}(E^{\mp})M^{\gamma}$
(8)
$\displaystyle+N_{\gamma}M^{\gamma}G_{\sigma}^{\gtrless}(E^{\pm})M^{\gamma}.$

In the above equation, $E^{\pm}=E\pm\hslash\,\omega$ and $N_{\gamma}$ exhibits
the number of photon with energy $\hslash\,\omega$ [46]. $M^{\gamma}$ is the
electron-photon interaction arising from the perturbation Hamiltonian
$H_{e\gamma}$. Each element of $M^{\gamma}$ is given by:

$\displaystyle
M_{lm}^{\gamma}=\langle\,l|\vec{P}.\,A_{0}\,\hat{e_{p}}|\,m\rangle.$ (9)

$A_{0}$ is the amplitude of electromagnetic vector potential and it’s
direction is determined by the light polarization ($\hat{e_{p}}$).
$G_{\sigma}^{\textless}$ is the electron correlation function [47]:

$\displaystyle G_{\sigma}^{\textless}(E)$ $\displaystyle=$ $\displaystyle
G_{\sigma}(E)[\Gamma_{L,\sigma}(E)\,f_{L}(E)+\Gamma_{R,\sigma}(E)\,f_{R}(E)$
(10)
$\displaystyle+\Sigma_{\gamma,\sigma}^{\textless}]G_{\sigma}^{\dagger}(E)$

and the hole correlation function is:

$\displaystyle G_{\sigma}^{\textgreater}(E)$ $\displaystyle=$ $\displaystyle
G_{\sigma}(E)[\Gamma_{L,\sigma}(E)\,f_{L}(E)+\Gamma_{R,\sigma}(E)\,f_{R}(E)$
(11)
$\displaystyle+\Sigma_{\gamma,\sigma}^{\textgreater}]G_{\sigma}^{\dagger}(E).$

In Eqs.(9) and (10), $f_{L}(_{R})$ is the left (right) Fermi-Dirac function.
$\Gamma_{L(R),\sigma}=i(\Sigma_{L(R),\sigma}-\Sigma_{L(R),\sigma}^{\dagger})$,
represents the broadening functions of the left (right) electrode.
$\Sigma_{\gamma,\sigma}$ is determined self-consistently by the iteration
method. Once convergence is obtained, one can calculate the spin photocurrent
across the system by [48]:

$\displaystyle I_{\gamma,\sigma}$ $\displaystyle=$
$\displaystyle\frac{2e}{\hslash}\int\,\frac{dE}{2\pi}\,Tr[G_{(1,1),\sigma}^{\textgreater}(E)\Gamma_{L,\sigma}(E)\,f_{L}(E)$
(12) $\displaystyle-
G_{(1,1),\sigma}^{\textless}(E)\Gamma_{L,\sigma}(E)\,(1-f_{L}(E))].$

Where $G_{(1,1),\sigma}^{\textgreater}(G_{(1,1),\sigma}^{\textless})$ is the
first block of the hole (electron) correlation function [49].

Spin-dependent quantum efficiency can be written as:

$\displaystyle\eta_{\sigma}=\frac{E_{ph}\,I_{ph,\sigma}}{e\,A_{D}\,I_{w}}\times
100\>\%\>(\sigma=up,\>down).$ (13)

Where $A_{D}=L_{ch}\,W_{ch}$ and $E_{ph}$ are cross section of central channel
and photon energy, respectively. Also, spin polarization is defined as
$SP(\%)=(|I_{ph,\sigma}|-|I_{ph,-\sigma}|)/(|I_{ph,\sigma}|+|I_{ph,-\sigma}|)\times
100\>\%$.

## DATA AVAILABILITY

The data and codes that support the findings of this study are available from
the authors upon reasonable request.

## References

  * [1]

  * Koppens  _et al._ [2014] F. Koppens, T. Mueller, P. Avouris, A. Ferrari, M. Vitiello, and M. Polini, Photodetectors based on graphene, other two-dimensional materials and hybrid systems, Nature nanotechnology 9, 780 (2014).
  * Ganguly  _et al._ [2017] S. Ganguly, M. Kabir, and T. Saha-Dasgupta, Magnetic and electronic crossovers in graphene nanoflakes, Physical Review B 95, 174419 (2017).
  * Xiao  _et al._ [2021] R.-C. Xiao, D.-F. Shao, Y.-H. Li, and H. Jiang, Spin photogalvanic effect in two-dimensional collinear antiferromagnets, npj Quantum Materials 6, 1 (2021).
  * Endres  _et al._ [2013] B. Endres, M. Ciorga, M. Schmid, M. Utz, D. Bougeard, D. Weiss, G. Bayreuther, and C. Back, Demonstration of the spin solar cell and spin photodiode effect, Nature communications 4, 1 (2013).
  * Žutić  _et al._ [2002] I. Žutić, J. Fabian, and S. D. Sarma, Spin-polarized transport in inhomogeneous magnetic semiconductors: theory of magnetic/nonmagnetic p- n junctions, Physical review letters 88, 066603 (2002).
  * Ostovari and Moravvej-Farshi [2014] F. Ostovari and M. K. Moravvej-Farshi, Dual function armchair graphene nanoribbon-based spin-photodetector: optical spin-valve and light helicity detector, Applied Physics Letters 105, 072407 (2014).
  * Bottegoni  _et al._ [2014] F. Bottegoni, M. Celebrano, M. Bollani, P. Biagioni, G. Isella, F. Ciccacci, and M. Finazzi, Spin voltage generation through optical excitation of complementary spin populations, Nature materials 13, 790 (2014).
  * Ellsworth  _et al._ [2016] D. Ellsworth, L. Lu, J. Lan, H. Chang, P. Li, Z. Wang, J. Hu, B. Johnson, Y. Bian, J. Xiao, _et al._ , Photo-spin-voltaic effect, Nature Physics 12, 861 (2016).
  * Takeda and Shiraishi [1994] K. Takeda and K. Shiraishi, Theoretical possibility of stage corrugation in si and ge analogs of graphite, Physical Review B 50, 14916 (1994).
  * Cahangirov  _et al._ [2009] S. Cahangirov, M. Topsakal, E. Aktürk, H. Şahin, and S. Ciraci, Two-and one-dimensional honeycomb structures of silicon and germanium, Physical review letters 102, 236804 (2009).
  * Molle  _et al._ [2017] A. Molle, J. Goldberger, M. Houssa, Y. Xu, S.-C. Zhang, and D. Akinwande, Buckled two-dimensional xene sheets, Nature materials 16, 163 (2017).
  * Qi  _et al._ [2018] J. Qi, K. Hu, and X. Li, Electric control of the edge magnetization in zigzag stanene nanoribbons from first principles, Physical Review Applied 10, 034048 (2018).
  * Ni  _et al._ [2012] Z. Ni, Q. Liu, K. Tang, J. Zheng, J. Zhou, R. Qin, Z. Gao, D. Yu, and J. Lu, Tunable bandgap in silicene and germanene, Nano letters 12, 113 (2012).
  * Drummond  _et al._ [2012] N. Drummond, V. Zolyomi, and V. Fal’Ko, Electrically tunable band gap in silicene, Physical Review B 85, 075423 (2012).
  * Pesin and MacDonald [2012] D. Pesin and A. H. MacDonald, Spintronics and pseudospintronics in graphene and topological insulators, Nature materials 11, 409 (2012).
  * Zhu  _et al._ [2015] F.-f. Zhu, W.-j. Chen, Y. Xu, C.-l. Gao, D.-d. Guan, C.-h. Liu, D. Qian, S.-C. Zhang, and J.-f. Jia, Epitaxial growth of two-dimensional stanene, Nature materials 14, 1020 (2015).
  * Xu  _et al._ [2013] Y. Xu, B. Yan, H.-J. Zhang, J. Wang, G. Xu, P. Tang, W. Duan, and S.-C. Zhang, Large-gap quantum spin hall insulators in tin films, Physical review letters 111, 136804 (2013).
  * Rachel and Ezawa [2014] S. Rachel and M. Ezawa, Giant magnetoresistance and perfect spin filter in silicene, germanene, and stanene, Physical Review B 89, 195303 (2014).
  * Wu  _et al._ [2014] S.-C. Wu, G. Shan, and B. Yan, Prediction of near-room-temperature quantum anomalous hall effect on honeycomb materials, Physical review letters 113, 256401 (2014).
  * Rodriguez-Lopez  _et al._ [2018] P. Rodriguez-Lopez, W. J. Kort-Kamp, D. A. Dalvit, and L. M. Woods, Nonlocal optical response in topological phase transitions in the graphene family, Physical Review Materials 2, 014003 (2018).
  * Chen  _et al._ [2016] X. Chen, R. Meng, J. Jiang, Q. Liang, Q. Yang, C. Tan, X. Sun, S. Zhang, and T. Ren, Electronic structure and optical properties of graphene/stanene heterobilayer, Physical Chemistry Chemical Physics 18, 16302 (2016).
  * Garg  _et al._ [2017] P. Garg, I. Choudhuri, A. Mahata, and B. Pathak, Band gap opening in stanene induced by patterned b–n doping, Physical Chemistry Chemical Physics 19, 3660 (2017).
  * Levy  _et al._ [2010] N. Levy, S. Burke, K. Meaker, M. Panlasigui, A. Zettl, F. Guinea, A. C. Neto, and M. F. Crommie, Strain-induced pseudo–magnetic fields greater than 300 tesla in graphene nanobubbles, Science 329, 544 (2010).
  * Pereira and Neto [2009] V. M. Pereira and A. C. Neto, Strain engineering of graphene’s electronic structure, Physical review letters 103, 046801 (2009).
  * Roldán  _et al._ [2015] R. Roldán, A. Castellanos-Gomez, E. Cappelluti, and F. Guinea, Strain engineering in semiconducting two-dimensional crystals, Journal of Physics: Condensed Matter 27, 313201 (2015).
  * Guinea  _et al._ [2010] F. Guinea, M. Katsnelson, and A. Geim, Energy gaps and a zero-field quantum hall effect in graphene by strain engineering, Nature Physics 6, 30 (2010).
  * Lu  _et al._ [2017] P. Lu, L. Wu, C. Yang, D. Liang, R. Quhe, P. Guan, and S. Wang, Quasiparticle and optical properties of strained stanene and stanane, Scientific reports 7, 1 (2017).
  * Tao  _et al._ [2017] L. Tao, K. Cheung, L. Zhang, and J. Wang, All-electrical generation of spin-polarized currents in quantum spin hall insulators, Physical Review B 95, 121407 (2017).
  * Luo [2019] M. Luo, Antiferromagnetic spin valve based on a heterostructure of two-dimensional hexagonal crystals, Physical Review B 99, 165407 (2019).
  * Shahabi and Phirouznia [2020] N. Shahabi and A. Phirouznia, Normal electric field enhanced light-induced polarizations and magnetic detection of valley polarization in silicene, Scientific reports 10, 1 (2020).
  * Kurpas  _et al._ [2019] M. Kurpas, P. E. F. Junior, M. Gmitra, and J. Fabian, Spin-orbit coupling in elemental two-dimensional materials, Physical Review B 100, 125422 (2019).
  * Lu  _et al._ [2020] W.-T. Lu, Q.-F. Sun, H.-Y. Tian, B.-H. Zhou, and H.-M. Liu, Band bending and zero-conductance resonances controlled by edge electric fields in zigzag silicene nanoribbons, Physical Review B 102, 125426 (2020).
  * Farokhnezhad  _et al._ [2017] M. Farokhnezhad, M. Esmaeilzadeh, and K. Shakouri, Strain-modulated anisotropy of quantum transport properties in single-layer silicene: Spin and valley filtering, Physical Review B 96, 205416 (2017).
  * Yan  _et al._ [2015] J.-A. Yan, S.-P. Gao, R. Stein, and G. Coard, Tuning the electronic structure of silicene and germanene by biaxial strain and electric field, Physical Review B 91, 245403 (2015).
  * Huang  _et al._ [2015] L.-F. Huang, P.-L. Gong, and Z. Zeng, Phonon properties, thermal expansion, and thermomechanics of silicene and germanene, Physical Review B 91, 205433 (2015).
  * Castellanos-Gomez  _et al._ [2013] A. Castellanos-Gomez, R. Roldán, E. Cappelluti, M. Buscema, F. Guinea, H. S. van der Zant, and G. A. Steele, Local strain engineering in atomically thin mos2, Nano letters 13, 5361 (2013).
  * Shin  _et al._ [2016] B. G. Shin, G. H. Han, S. J. Yun, H. M. Oh, J. J. Bae, Y. J. Song, C.-Y. Park, and Y. H. Lee, Indirect bandgap puddles in monolayer mos2 by substrate-induced local strain, Advanced Materials 28, 9378 (2016).
  * Ezawa [2012] M. Ezawa, Valley-polarized metals and quantum anomalous hall effect in silicene, Physical review letters 109, 055502 (2012).
  * Shakouri  _et al._ [2015] K. Shakouri, H. Simchi, M. Esmaeilzadeh, H. Mazidabadi, and F. Peeters, Tunable spin and charge transport in silicene nanoribbons, Physical Review B 92, 035413 (2015).
  * Lü and Xie [2019] X.-L. Lü and H. Xie, Spin filters and switchers in topological-insulator junctions, Physical Review Applied 12, 064040 (2019).
  * Henrickson [2002] L. E. Henrickson, Nonequilibrium photocurrent modeling in resonant tunneling photodetectors, Journal of applied physics 91, 6273 (2002).
  * Aeberhard and Morf [2008] U. Aeberhard and R. Morf, Microscopic nonequilibrium theory of quantum well solar cells, Physical Review B 77, 125343 (2008).
  * Sancho  _et al._ [1985] M. L. Sancho, J. L. Sancho, J. L. Sancho, and J. Rubio, Highly convergent schemes for the calculation of bulk and surface green functions, Journal of Physics F: Metal Physics 15, 851 (1985).
  * Li and Lu [2008] T. Li and S.-P. Lu, Quantum conductance of graphene nanoribbons with edge defects, Physical Review B 77, 085408 (2008).
  * Aeberhard [2011] U. Aeberhard, Quantum-kinetic theory of photocurrent generation via direct and phonon-mediated optical transitions, Physical Review B 84, 035454 (2011).
  * Keldysh  _et al._ [1965] L. V. Keldysh _et al._ , Diagram technique for nonequilibrium processes, Sov. Phys. JETP 20, 1018 (1965).
  * Anantram  _et al._ [2008] M. Anantram, M. S. Lundstrom, and D. E. Nikonov, Modeling of nanoscale devices, Proceedings of the IEEE 96, 1511 (2008).
  * Tao  _et al._ [2018] X. Tao, L. Zhang, X. Zheng, H. Hao, X. Wang, L. Song, Z. Zeng, and H. Guo, h-bn/graphene van der waals vertical heterostructure: a fully spin-polarized photocurrent generator, Nanoscale 10, 174 (2018).

## acknowledgements

This research is supported by Post-doctoral research grant of Azarbaijan
Shahid Madani University (218/D/28672).

## author contributions

F.R. performed computations of the work and written the manuscript, A.P.
reviewed and analyzed the results.

## competing interests

The authors declare no competing interests.

Figure 1: The band structure of antiferromagnetic $10ZSNR$ subject to a
perpendicular electric field: (a) with $E_{z}=0$, (b) with $elE_{z}=0.09t$ and
(c) with $elE_{z}=0.12t$. Blue line denotes spin down and dashed red line
denotes spin up.

Figure 2:  Quantum efficiency as a function of the photon energy for the spin-
photovoltaic device based on antiferromagnetic $10ZSNR$ with $M_{AF}=0.025t$
under the simultaneous effect of linear illumination with
$I_{w}=100\,\frac{kW}{cm^{2}}$ and (a) $elE_{z}=0.09t$, (b) $elE_{z}=0.12t$.

Figure 3: The optical spin polarization as a function of the photon energy for
the spin-photovoltaic device based on antiferromagnetic $10ZSNR$ with
$M_{AF}=0.025t$ for various $elE_{z}$ strengths.

Figure 4: The band structure of antiferromagnetic $10ZSNR$ subjected to a edge
electric field: (a) with $M_{AF}=0.025t$ and applied electric field to $N=8$
zigzag chains, (b) $M_{AF}=0.025t$ and applied electric field to $N=4$ zigzag
chains, (c) $M_{AF}=0.03t$ and applied electric field to $N=4$ zigzag chains.
Blue line denotes spin down and red line denotes spin up. Here,
$elE_{z}=0.09t$.

Figure 5:  (a) Quantum efficiency and (b) Spin polarization as a function of
the photon energy for the spin-photovoltaic device based on antiferromagnetic
$10ZSNR$ under the simultaneous effect of linear illumination with
$I_{w}=100\,\frac{kW}{cm^{2}}$ and applied edge field to $N=8$ chains. Other
parameters are: $M_{AF}=0.025t$ and $elE_{z}=0.09t$.

Figure 6:  (a) Quantum efficiency and (b) Spin polarization as a function of
the photon energy for the spin-photovoltaic device based on antiferromagnetic
$10ZSNR$ under the simultaneous effect of linear illumination with
$I_{w}=100\,\frac{kW}{cm^{2}}$ and applied edge field to $N=4$ chains. Other
parameters are: $M_{AF}=0.025t$ and $elE_{z}=0.09t$.

Figure 7:  (a) Quantum efficiency and (b) Spin polarization as a function of
the photon energy for the spin-photovoltaic device based on antiferromagnetic
$10ZSNR$ under the simultaneous effect of linear illumination with
$I_{w}=100\,\frac{kW}{cm^{2}}$ and applied edge field to $N=4$ chains. Other
parameters are: $M_{AF}=0.03t$ and $elE_{z}=0.09t$.

Figure 8:  The band structure of antiferromagnetic $10ZSNR$ subjected to the
combining effect of strain and narrow edge potential with applied edge field
to $N=4$ chains. (a) $\epsilon=0.2$ and $\theta=0^{\circ}$ and (b)
$\epsilon=-0.2$ and $\theta=90^{\circ}$. Blue line denotes spin down and red
line denotes spin up. Also, dashed blue line denotes spin down and dashed red
line denotes spin up in the absence of strain.

Figure 9:  Quantum Efficiency as a function of the photon energy for the spin-
photovoltaic device based on antiferromagnetic $10ZSNR$ under the combining
effect of strain and narrow edge potential with applied edge field to $N=4$
chains. Other parameters are: $I_{w}=100\,\frac{kW}{cm^{2}}$, $M_{AF}=0.025t$
and $elE_{z}=0.09t$..

Figure 10:  Optical spin polarization as a function of the photon energy for
the spin-photovoltaic device based on antiferromagnetic $10ZSNR$ under the
combining effect of strain and narrow edge potential with applied edge field
to $N=4$ chains. Other parameters are: $I_{w}=100\,\frac{kW}{cm^{2}}$,
$M_{AF}=0.025t$ and $elE_{z}=0.09t$.


# Towards Relation-centered Pooling and Convolution for Heterogeneous Graph
Learning Networks

Tiehua Zhang1, Yuze Liu1∗, Yao Yao1, Youhua Xia2, Xin Chen1, Xiaowei Huang1,
Jiong Jin3 co-first author (corresponding author: Tiehua Zhang).

###### Abstract

Heterogeneous graph neural network has unleashed great potential on graph
representation learning and shown superior performance on downstream tasks
such as node classification and clustering. Existing heterogeneous graph
learning networks are primarily designed to either rely on pre-defined meta-
paths or use attention mechanisms for type-specific attentive message
propagation on different nodes/edges, incurring many customization efforts and
computational costs. To this end, we design a relation-centered Pooling and
Convolution for Heterogeneous Graph learning Network, namely PC-HGN, to enable
relation-specific sampling and cross-relation convolutions, from which the
structural heterogeneity of the graph can be better encoded into the embedding
space through the adaptive training process. We evaluate the performance of
the proposed model by comparing with state-of-the-art graph learning models on
three different real-world datasets, and the results show that PC-HGN
consistently outperforms all the baseline and improves the performance
maximumly up by 17.8%.

## Introduction

There has been increasing research on modelling graph data as such data
becomes more ubiquitous in real-world scenarios. These well-organized graph
data contain rich yet complex semantic and structural information of various
real-world systems such as recommendation (Shi et al. 2018), medical diagnosis
(Rong et al. 2020; Zhang et al. 2022) and text analysis (Bahdanau, Cho, and
Bengio 2014). To better leverage such information, graph representation
learning, which aims to learn a function that maps the input space into the
low-dimensional embedding space while preserving the attributes of the graph,
aroused to the spotlight to serve the purpose of node/graph classification and
clustering tasks. Conventionally, matrix factorization (e.g., adjacency
matrix) methods (Newman 2006; Weisfeiler and Leman 1968) have been used to
learn the latent embedding vectors of a graph, yet it suffers from both the
computational cost on large-scale graph data and statistical performance
drawback (Shi et al. 2016).

Graph Neural Networks (GNN) have recently become the most prevalent technique
to enhance graph learning performance. However, most GNN models, such as GCN,
GraphSAGE, GAT and GPS, are initially designed for homogeneous graphs (Wang et
al. 2022), which only involve one type of node and edge. These models thus
cannot be directly applicable to graphs with different types of entities
(i.e., heterogeneous graphs with various node/edge types). Specifically,
heterogeneous graphs present a more complex semantic-dependent topology,
meaning that the local structure of one node varies in different types of
relations. Apart from that, in heterogeneous graphs, there are a number of
types of nodes and edges, each of which represents a particular type of
attribute in the graph and thus requires different feature spaces. The
heterogeneity attributes need to be taken into account when designing
heterogeneous embedding methods, as it is essential to ponder on the
significant roles of nodes and edges altogether. Currently, much research
focuses on designing the specialized GNNs to learn representations in
heterogeneous graphs. For instance, both HetGNN (Zhang et al. 2019) and HAN
(Yang et al. 2021) rely on pre-defined meta-paths to perform graph learning.
Other existing works either emphasize on capturing the characteristics of
nodes (e.g., HetSANN (Hong et al. 2020), HGT (Hu et al. 2020)) or multi-typed
edge properties (e.g., RGCN (Schlichtkrull et al. 2018), MBGCN (Jin et al.
2020)). While the most recent work R-HGNN (Yu et al. 2022) starts to learn
both the semantic meaning of edge and node features in a collaborative manner,
it incurs a high computational cost due to the heavy use of attentions at both
node and edge level.

In light of these limitations, we propose an adaptive relation-centric
heterogeneous graph learning method, aiming to better incorporate the
information of multi-relation types without concerning pre-defined meta-paths
in heterogeneous graphs. Specifically, we first design the relation-specific
pooling to enable the importance-based sampling, aiming to only select a
subset of neighbor nodes to improve the learning efficiency. Based on the
sampled neighbors of each node, a cross-relation convolution is implemented to
learn the heterogeneity of the graph through different types of relations.
After that, both the pooling and convolution can be optimized end-to-end. The
contributions are summarized as follows:

  * •

We propose a novel graph learning model to enable both relation-specific
pooling and cross-relation convolutions on heterogeneous graphs. The model can
be directly applied to any heterogeneous graphs without concerning the pre-
defined meta-paths.

  * •

We project relation-specific neighbors into the same latent space regardless
of the neighbor types and design an adaptive importance-based pooling to
enable sampling for each relation type. Benefiting from the sampled neighbors
set, an effective cross-relation convolution is implemented to incorporate the
heterogeneity attributes of the graph into the node embeddings.

  * •

We conduct extensive experiments to evaluate the performance of the proposed
model. The results show that PC-HGN excels in all three real-world datasets
compared with state-of-the-art homogeneous and heterogeneous graph learning
models. We also analyze the impact of filters and hidden node dimensions to
interpret the effectiveness of the proposed model.

## Related Work

There has been a rich line of research on graph representation learning in
recent years. The graph convolution network (GCN) (Kipf and Welling 2017) is
the first of its kind on learning the node embedding through graph Laplacian
methods. Following that, graph attention network (GAT) (Veličković et al.
2018) introduces multi-head attention mechanisms on each edge to enable the
attentive message aggregation when updating the node embeddings. As opposed to
aggregating the message from all connected nodes like GCN and GAT, researchers
start to focus on designing more efficient graph learning algorithms. Several
sampling-based graph learning methods, including GraphSAGE (Hamilton, Ying,
and Leskovec 2017), AS-GCN (Huang et al. 2018), FastGCN (Chen, Ma, and Xiao
2018), GPS (Zhang et al. 2021), were developed for fast representation
learning on graphs. To be more specific, both GraphSAGE, and GPS adopt the
node-based sampling, and it considers only part of the connected neighbor
nodes when aggregating the neighbor messages. AS-GCN and FastGCN, on the other
hand, design different layer-based sampling strategies. While FastGCN
constructs each layer from sampled nodes independently, AS-GCN samples all
neighborhoods nodes altogether and allow the neighborhood sharing, in which
the lower layer is sampled conditionally on the top one to preserve the
between-layer connections. GraphSAINT (Zeng et al. 2020) proposes a graph-
level sampling approach, in which a full graph is downsampled into subgraphs
based on designated node, edge and random walk samplers. Similarly, some
research explore the pooling operations on graph. For instance, (Defferrard,
Bresson, and Vandergheynst 2016) uses a binary tree indexing for graph
coarsening, in which 1-D pooling operations are applied on the fixed node
indices in the tree. (Ying et al. 2018) achieves the pooling with the help of
an assignment matrix, and nodes can be assigned to different clusters of the
next layer. Graph U-Nets designs a encoder-decoder pooling architecture to
speed up the large-scale graph learning. The gPool encoding layer adaptively
selects nodes according to the scalar projection value on the trainable
projection vector to form a small subgraph, and the inverse gUnpool decoding
layer is used to restore the original structure of the graph by using the
position information of the selected nodes.

As pointed out in (Wang et al. 2020), the sampling on heterogeneous graph is
still in its infancy stage and worth exploring owing to the rich structure and
semantic information across different node/edge types. Two scalable
representation learning models, namely metapath2vec and metapath2vec++, are
developed (Dong, Chawla, and Swami 2017). Specifically, metapath2vec builds
heterogeneous neighborhoods of nodes based on random walks on the pre-defined
metapaths, and uses heterogeneous skip-gram model to perform node embedding.
Metapath2vec++ further explores synchronous modeling of structural and
semantic correlations across different edges in heterogeneous graphs.
Recently, many efforts aim to develop GNN-related models for heterogeneous
graph learning. HAN (Yang et al. 2021) aims to learn the importance between a
node and its meta-path based neighbors, and semantic-level attention is
designed to learning the hand-designed mete-paths. Following that, type-
specific parameters are considered in HGT (Hu et al. 2020) to learn the
characteristics of different nodes and relations. To make the training on web-
scale data more efficient, it designs a HGSampling algorithm to sample an
equal number of nodes per node type during training process. R-HGNN (Yu et al.
2022) proposes a relation-aware method to learn the semantic representation of
relations while discerning the node representations with respect to different
relation types.

Figure 1: The overall architecture of PC-HGN.

## Methodology

We present the proposed PC-HGN in this section. We first describe the
notations that denote the heterogeneous graphs and then elaborate on relation-
specific pooling and cross-relation convolutions, respectively.

### Heterogeneous Graph Definition

We formally define the heterogeneous graph in this part. Given a heterogeneous
graph
$\mathcal{G}=\left(\mathcal{V},\mathcal{E},\mathcal{T}_{v},\mathcal{T}_{e}\right)$,
it encompasses a number of nodes $\mathcal{V}$ with multiple node types
$\mathcal{T}_{v}$ and edges $\mathcal{E}$ with multiple edge types
$\mathcal{T}_{e}$. We define the node type mapping function
$\phi:\mathcal{V}\rightarrow\mathcal{T}_{v}$ and the edge type mapping
function $\psi:\mathcal{E}\rightarrow\mathcal{T}_{e}$, respectively (Sun and
Han 2013). Each heterogeneous graph presents multiple edge types, meaning
$\left|\mathcal{T}_{e}\right|>1$. We use $N$ to denote the number of nodes in
the graph $\left|\mathcal{V}\right|=N$, and the neighbor of each node $v$ is
represented as $\mathcal{N}\left(v\right)$. Simply, $\emph{e}_{uv}$ denotes
the edge connection from $u$ to $v$. We use $\emph{X}\in\mathcal{R}^{N\times
D}$ to represent the initial node feature matrix, and node $v$ ’s initial
feature vector is $\emph{x}_{v}\in\mathcal{R}^{D}$.

### Relation-specific Pooling

As pointed out in (Lee, Lee, and Kang 2019), pooling operation is considered
effective to improve both training efficiency and generalization ability of
the model. To enable the pooling on semantic-dependent heterogeneous graphs,
we propose the relation-specific pooling operations, which enables an adaptive
sampling on neighbor nodes for each relation type.

As illustrated in Fig. 1 (a), we first split the graph into different
subgraphs based on different relations. Given a target node $v$ and its
neighbor nodes $\mathcal{N}\left(v\right)$, we define a relation as
$\left<\phi\left(u\right),\psi\left(\emph{e}_{uv}\right),\phi\left(v\right)\right>$
between node v and node $u\in\mathcal{N}\left(v\right)$, indicating there
exists an edge $\emph{e}_{uv}$ from neighbor node $u$ to target node $v$ with
edge type $\psi\left(\emph{e}_{uv}\right)$. Then, We conduct relation-specific
pooling operation on each subgraph to get sampled neighbor nodes under that
relation. Specifically, for any node $v$, its neighbor node set can be
represented as
$\mathcal{N}_{v}^{\emph{t}}=\left\\{u\big{|}u\in\mathcal{N}\left(v\right),\psi\left(\emph{e}_{uv}\right)=t,t\in\mathcal{T}_{e},v\in\mathcal{V}\right\\}$,
in which all nodes belongs to only one relation. The initial node feature
matrix is then denoted as $\emph{X}_{\mathcal{N}_{v}}^{t}$. We formulate the
relation-specific pooling of $t\in\mathcal{T}_{e}$ in the following:

$\displaystyle\emph{s}^{t}_{\mathcal{N}_{v}}$
$\displaystyle=\emph{X}_{\mathcal{N}_{v}}^{t}\cdot\frac{\emph{v}_{t}}{\left\|\emph{v}_{t}\right\|},$
(1) $\displaystyle\emph{idx}_{\mathcal{N}_{v}}^{t}$
$\displaystyle=\emph{rank}\left(\emph{s}^{t}_{\mathcal{N}_{v}},k\right),$
$\displaystyle\hat{\emph{s}}^{t}_{\mathcal{N}_{v}}$
$\displaystyle=\sigma\left(\emph{s}^{t}_{\mathcal{N}_{v}}\left[\emph{idx}_{\mathcal{N}_{v}}^{t}\right]\right),$
$\displaystyle\hat{\emph{X}}^{t}_{\mathcal{N}_{v}}$
$\displaystyle=\emph{X}_{\mathcal{N}_{v}}^{t}\left[\emph{idx}_{\mathcal{N}_{v}}^{t},:\right],$
$\displaystyle\tilde{\emph{X}}_{\mathcal{N}_{v}}^{t}$
$\displaystyle=\hat{\emph{X}}^{t}_{\mathcal{N}_{v}}\odot\left(\hat{\emph{s}}^{t}_{\mathcal{N}_{v}}\cdot\textbf{1}_{1\times
D}\right)$

For each relation, we project the neighbors under that relation to a latent
space via a trainable vector $\emph{v}_{t}$, from which the respective
important scores are calculated as
$\emph{s}^{t}_{\mathcal{N}_{v}}\in\mathcal{R}^{\left|\mathcal{N}^{t}_{v}\right|}$.
In other word, it measures how much information of neighbor nodes can be
retained when projected onto the direction of $\emph{v}_{t}$ for each relation
$t$. $\emph{rank}\left(\emph{s}^{t}_{\mathcal{N}_{v}},k\right)$ is the
importance-based node ranking function, which returns indices of the
$k$-largest values in $\emph{s}^{t}_{\mathcal{N}_{v}}$.
$\emph{idx}_{\mathcal{N}_{v}}^{t}$, returned by the ranking function, contains
the indices of neighbors selected for target node $v$.
$\emph{s}^{t}_{\mathcal{N}_{v}}\left[\emph{idx}_{\mathcal{N}_{v}}^{t}\right]$
extracts values with indices, followed by a non-linear function $\sigma$ to
get weighted score vector $\hat{\emph{s}}^{t}_{\mathcal{N}_{v}}$. Similarly,
$\emph{X}_{\mathcal{N}_{v}}^{t}\left[\emph{idx}_{\mathcal{N}_{v}}^{t},:\right]$
perform the row extraction to form the feature matrix of selected neighbors,
whose result is denoted as $\hat{\emph{X}}^{t}_{\mathcal{N}_{v}}$.
$\textbf{1}_{1\times D}\in\mathcal{R}^{1\times D}$ is a row vector with all
elements being $1$, and $\odot$ denotes the element-wise matrix
multiplication. It is worth noting that in case of lack of neighbor nodes in a
specific relation, we apply mean operation on
$\hat{\emph{X}}^{t}_{\mathcal{N}_{v}}$ for padding purpose, guaranteeing
$\tilde{\emph{X}}_{\mathcal{N}_{v}}^{t}\in\mathcal{R}^{k\times D}$.

### Cross-relation Convolutions

The process of cross-relation convolution aims to consider both the
heterogeneity attributes and node feature embedding simultaneously, which is
shown in Fig 1 (c). The output of relation-specific pooling is represented as
$\mathcal{X}_{\mathcal{N}_{v}}=\left[\tilde{\emph{X}}_{\mathcal{N}_{v}}^{t_{1}},\tilde{\emph{X}}_{\mathcal{N}_{v}}^{t_{2}},...,\tilde{\emph{X}}_{\mathcal{N}_{v}}^{t_{\left|\mathcal{T}_{e}\right|}}\right]$,
which contains sampled neighbor node features
$\tilde{\emph{X}}_{\mathcal{N}_{v}}^{t}\in\mathcal{R}^{k\times D}$ for each
relation $t$. Therefore, the sampled feature matrices with different relations
are stacked into the three-dimensional tensor
$\mathcal{X}_{\mathcal{N}_{v}}\in\mathcal{R}^{\left|\mathcal{T}_{e}\right|\times
k\times D}$. Note that for computation convenience, we apply zero-padding
along the relation dimension if such relation does not exist for node $v$.
When it comes to convolution, we use $P$ trainable filters, each of which
encompasses different kernels stacked together along the relation dimension
$\mathcal{K}^{p}=\left[\emph{K}_{p}^{t_{1}},\emph{K}_{p}^{t_{2}},...,\emph{K}_{p}^{t_{\left|\mathcal{T}_{e}\right|}}\right]\in\mathcal{R}^{\left|\mathcal{T}_{e}\right|\times
s\times D},p\in\left[1,...,P\right]$. Each kernel
$\emph{K}_{p}^{t}\in\mathcal{R}^{s\times D}$ in $p$-th filter is used to
generate the feature map of relation $t$, where $s$ denotes the number of
search window. The process of cross-relation convolution of filter $p$ is
formulated as:

$\emph{h}_{v}^{p}=\mathcal{X}_{\mathcal{N}_{v}}\circ\mathcal{K}^{p}$ (2)

where $\emph{h}_{v}^{p}\in\mathcal{R}^{\left(k-s+1\right)}$ represents the
convoluted results. Concretely, the $m$-th element of $\emph{h}_{v}^{p}$ is
calculated as:

$\left(\mathcal{X}_{\mathcal{N}_{v}}\circ\mathcal{K}^{p}\right)_{\left(m\right)}=\sum_{i=1}^{\left|\mathcal{T}_{e}\right|}\sum_{j=1}^{s}\tilde{\emph{X}}^{t_{i}}_{\mathcal{N}_{v}}\left[m+j-1,:\right]\cdot\left(\emph{K}^{t_{i}}_{p}\left[j,:\right]\right)^{T}$
(3)

where $\tilde{\emph{X}}^{t_{i}}_{\mathcal{N}_{v}}\left[m+j-1,:\right]$ and
$\emph{K}^{t_{i}}_{p}\left[j,:\right]$ indicates the index dependent row
extractions. Following that, the convoluted results of each filter are stacked
to generate the input of a shallow multi-layer perceptions (MLP), represented
as:

$\hat{\emph{h}}_{v}=\emph{MLP}\left(\operatorname*{\mathchoice{\Big{\|}}{\big{\|}}{\|}{\|}}_{p=1}^{P}\emph{h}^{p}_{v}\right)$
(4)

Herein, $\hat{\emph{h}}_{v}$ represents the learnt hidden embedding of node
$v$.

## Experiment

In this section, we conduct extensive experiments, aiming to answer the
following research questions:

  * •

RQ1: how does our method perform compared with other state-of-the-art
homogeneous/heterogeneous baselines for representation learning.

  * •

RQ2: what is the impact of cross-relation convolutions on the model.

  * •

RQ3: how much the hyper-parameters (e.g., embedding dimension and the number
of sampled heterogeneous neighbors) affect the performance of the model.

Methods | Dataset
---|---
DBLP | ACM | IMDB
F1-Micro | F1-Macro | F1-Micro | F1-Macro | F1-Micro | F1-Macro
Homogeneous Models | GCN | 0.925 | 0.916 | 0.879 | 0.880 | 0.518 | 0.494
GAT | 0.909 | 0.900 | 0.897 | 0.898 | 0.545 | 0.513
GraphSAGE | 0.926 | 0.915 | 0.916 | 0.917 | 0.554 | 0.539
GraphSAINT | 0.923 | 0.912 | 0.908 | 0.909 | 0.535 | 0.504
Heterogeneous Models | HAN | 0.934 | 0.925 | 0.920 | 0.921 | 0.548 | 0.530
HGT | 0.838 | 0.824 | 0.898 | 0.897 | 0.556 | 0.408
R-HGNN | 0.930 | 0.919 | 0.916 | 0.917 | 0.561 | 0.543
PC-HGN | 0.938 | 0.929 | 0.928 | 0.926 | 0.599 | 0.581

Table 1: Comparisons with baseline models on node classification task

### Dataset

We adopt the the following three real-world datasets to verify the performance
of the proposed model, including two citation networks DBLP and ACM, and a
moive dataset ACM.

  * •

DBLP111https://s3.cn-north-1.amazonaws.com.cn/dgl-
data/dataset/openhgnn/dblp4GTN.zip contains three different types of nodes,
including Paper(P), Author(A), and Conference(C). Also, edges are presented as
P-A, A-P, P-C and C-P, each representing a respective edge type. Four
different categories of papers are defined as labels of this dataset. The
initial node features are calculated using bag-of-words.

  * •

ACM222 https://s3.cn-north-1.amazonaws.com.cn/dgl-
data/dataset/openhgnn/acm4GTN.zip shares a similar data characterises with
DBLP. It contains three types of nodes (Paper(P), Author(A) and Subject(S))
and four types of edges (P-A, A-P, P-S and S-P). The papers are labelled
according to three different categories. It also uses bag-of-words to
construct the initial node features.

  * •

IMDB333 https://s3.cn-north-1.amazonaws.com.cn/dgl-
data/dataset/openhgnn/imdb4GTN.zip contains movie(M), actors(A) and
directors(D) as node types. The genres of movies are used as different labels
for each node. Node features are also initialised using bag-of-words.

### Baselines

To verify the effectiveness of the proposed model, we compare it with several
state-of-the-art models designed for homogeneous and heterogeneous graph
learning, respectively.

  * •

GCN (Kipf and Welling 2017) is a graph convolutional network designed
specifically for homogeneous graph learning.

  * •

GAT (Veličković et al. 2018) is the first work that introduces attention
mechanism in homogeneous graph learning. It enables the weighted message
aggregations from neighbor nodes.

  * •

GraphSAGE (Hamilton, Ying, and Leskovec 2017) designs a sampling approach when
aggregating messages from neighbor nodes. It also supports different
aggregation functions.

  * •

GraphSAINT (Zeng et al. 2020) splits nodes and edges from a bigger graph into
a number of subgraphs, on which the GCN is applied for node representation
learning.

  * •

HAN (Yang et al. 2021) uses attention techniques on heterogeneous graph
learning, in which the node embeddings are updated through manually designed
meta-paths.

  * •

HGT (Hu et al. 2020) designs type-specific attention layers, assigning
different trainable parameters to each node and edge type.

  * •

R-HGNN (Yu et al. 2022) proposes a relation-aware method to learn the semantic
representation of edges while discerning the node representations with respect
to different relation types.

### Experiment Setup

We describe the experiment setup for both baseline models and the proposed PC-
HGN in this part. For baseline models dependent on attention mechanisms (i.e.,
GAT, HAN, and HGT), we set the number of attention heads to 8 uniformly. The
sample window of GraphSAGE is set to 10 (Han et al. 2022). We adopt the node
sampling strategy for GraphSAINT and use 8000 as the node budget and 25 as the
number of subgraphs (default from the released code). We use 256 as the hidden
dimension of node representation throughout all baseline models for fair
comparisons, and the layer depth of all models is set to 3. For the proposed
PC-HGN, we set the number of kernels to 64 and pooling size to 2. We randomly
split all three datasets into train/val/test with the ratio of 0.2/0.1/0.7,
respectively. All models are trained with a fixed 200 epochs, using an early
stopping strategy when the performance on the validation set is not improved
for 50 consecutive epochs. All trainable parameters of the neural network are
initialized through Xavier (Glorot and Bengio 2010) and optimized using Adam
(Kingma and Ba 2014) with the learning rate 15e-4. We use both f1-micro and
f1-macro as the evaluation metrics.The code of baseline models are available
at https://github.com/BUPT-GAMMA/OpenHGNN.

### Performance Comparison and Analysis

#### Effectiveness of representation learning.

To answer Q1, we evaluate the performance of our proposed model comparing with
other baselines and record the experimental results in Table 1. It can be
clearly observed that our model achieves the best result on all datasets
against both homogeneous and heterogeneous representation learning methods.
For traditional homogeneous graph learning models, GraphSAGE generally
achieves the best result even when learning the node representations on
heterogeneous graphs. Interestingly, other homogeneous graph learning models
also obtain promising results compared with heterogeneous graph learning
models such as HAN and HGT. Regarding the state-of-the-art heterogeneous graph
learning models, R-HGNN reports the second-highest score for both F1-micro and
F1-macro, implying the significance of integrating semantic information on
different edge types. Furthermore, our proposed model shows a better
performance than attention-based R-HGNN, which attributes to incorporating the
structural heterogeneity of the graph by combing both relation-specific
pooling and cross-relation convolution from neighbor nodes simultaneously.
Apart from that, our model obtains a significant improvement on both metrics
compared with the meta-paths dependent model HAN. We also visualize the
embedding result of PC-HGN for a more intuitive view. Specifically, we use
Principal Component Analysis (PCA) (Abdi and Williams 2010) to project the
learnt node embeddings of paper of ACM into a 2-dimensional space. As shown in
Fig. 2, we can see a clear division among different paper classes, implying
the paper nodes has been represented properly.

Figure 2: Paper embedding visualization of different classes Figure 3: Impact
of embedding dimensions

#### Analysis of cross-relation convolutions.

We investigate the contribution of cross-relation convolutions in this part
(RQ2). Specifically, we conduct experiments to remove the filter-based
convolutions and replace them with two steps: 1) mean operation on the sampled
neighbors embeddings $\tilde{\emph{X}}_{\mathcal{N}_{v}}^{t}$ to output the
hidden embedding under relation $t$; 2) stacking hidden embeddings from
different relations as the input to the MLP. Table 2 provides the comparison
results of PC-HGN and its varient. It can be seen a significant improvement on
performance when adopting cross-relation convolutions, leading to a margin by
11.4% on DBLP, 11.6% on ACM and 7.1% on IMDB, respectively.

Models | DBLP | ACM | IMDB
---|---|---|---
PC-HGN w/o Conv | 0.824 | 0.812 | 0.528
PC-HGN | 0.938 | 0.928 | 0.599

Table 2: Comparison of PC-HGN with and without cross- relation convolutions on
different datasets

#### Impact of node embedding size.

To answer RQ3, we test the impact of different node embedding sizes on the
performance. As shown in Fig. 3, it can be observed clearly that the
performance of the model increases steadily at first and then starts to drop,
reporting the best result with the embedding size 256. Intuitively, larger
dimension sizes bring in extra redundancies in the kernel space, thus causing
unexpected performance drops after convolutions.

## Conclusion

In this paper, we propose a novel relation-centric heterogeneous graph
learning method called PC-HGN, aiming to better incorporate the information of
multi-relation types without concerning pre-defined meta-paths in
heterogeneous graphs. The proposed PC-HGN designs an adaptive importance-based
pooling to enable sampling for each relation type, followed by the cross-
relation convolutions to incorporate the structural heterogeneity of graphs
into the embedding space. The experiment results show the effectiveness of PC-
HGN comparing with other baselines. Essentially, this research sheds light on
the way to heterogeneous graph learning in addition to meta-path or attention-
driven models.

## References

  * Abdi and Williams (2010) Abdi, H.; and Williams, L. J. 2010.  Principal component analysis.  _Wiley Interdisciplinary Reviews: Computational Statistics_ , 2(4): 433–459.
  * Bahdanau, Cho, and Bengio (2014) Bahdanau, D.; Cho, K.; and Bengio, Y. 2014.  Neural machine translation by jointly learning to align and translate.  _arXiv preprint arXiv:1409.0473_.
  * Chen, Ma, and Xiao (2018) Chen, J.; Ma, T.; and Xiao, C. 2018.  FastGCN: Fast learning with graph convolutional networks via importance sampling.  _arXiv preprint arXiv:1801.10247_.
  * Defferrard, Bresson, and Vandergheynst (2016) Defferrard, M.; Bresson, X.; and Vandergheynst, P. 2016.  Convolutional neural networks on graphs with fast localized spectral filtering.  In _International Conference on Neural Information Processing Systems_ , 3837–3845.
  * Dong, Chawla, and Swami (2017) Dong, Y.; Chawla, N. V.; and Swami, A. 2017.  metapath2vec: Scalable representation learning for heterogeneous networks.  In _ACM SIGKDD International Conference on Knowledge Discovery and Data Mining_ , 135–144.
  * Glorot and Bengio (2010) Glorot, X.; and Bengio, Y. 2010.  Understanding the difficulty of training deep feedforward neural networks.  In _International Conference on Artificial Intelligence and Statistics_ , 249–256.
  * Hamilton, Ying, and Leskovec (2017) Hamilton, W. L.; Ying, R.; and Leskovec, J. 2017.  Inductive representation learning on large graphs.  In _International Conference on Neural Information Processing Systems_ , 1025–1035.
  * Han et al. (2022) Han, H.; Zhao, T.; Yang, C.; Zhang, H.; Liu, Y.; Wang, X.; and Shi, C. 2022.  OpenHGNN: An Open Source Toolkit for Heterogeneous Graph Neural Network.  In _ACM International Conference on Information and Knowledge Management_ , 3993–3997.
  * Hong et al. (2020) Hong, H.; Guo, H.; Lin, Y.; Yang, X.; Li, Z.; and Ye, J. 2020.  An attention-based graph neural network for heterogeneous structural learning.  In _AAAI Conference on Artificial Intelligence_ , volume 34, 4132–4139.
  * Hu et al. (2020) Hu, Z.; Dong, Y.; Wang, K.; and Sun, Y. 2020.  Heterogeneous graph transformer.  In _Web Conference_ , 2704–2710.
  * Huang et al. (2018) Huang, W.; Zhang, T.; Rong, Y.; and Huang, J. 2018.  Adaptive sampling towards fast graph representation learning.  _Advances in Neural Information Processing Systems_ , 31.
  * Jin et al. (2020) Jin, B.; Gao, C.; He, X.; Jin, D.; and Li, Y. 2020.  Multi-behavior recommendation with graph convolutional networks.  In _International ACM SIGIR Conference on Research and Development in Information Retrieval_ , 659–668.
  * Kingma and Ba (2014) Kingma, D. P.; and Ba, J. 2014.  Adam: A method for stochastic optimization.  _arXiv preprint arXiv:1412.6980_.
  * Kipf and Welling (2017) Kipf, T. N.; and Welling, M. 2017.  Semi-supervised classification with graph convolutional networks.  In _International Conference on Learning Representations_ , 1–14.
  * Lee, Lee, and Kang (2019) Lee, J.; Lee, I.; and Kang, J. 2019.  Self-attention graph pooling.  In _International Conference on Machine Learning_ , 3734–3743.
  * Newman (2006) Newman, M. E. 2006.  Modularity and community structure in networks.  _Proceedings of the National Academy of Sciences_ , 103(23): 8577–8582.
  * Rong et al. (2020) Rong, Y.; Bian, Y.; Xu, T.; Xie, W.; Wei, Y.; Huang, W.; and Huang, J. 2020.  Self-supervised graph transformer on large-scale molecular data.  _arXiv preprint arXiv:2007.02835_.
  * Schlichtkrull et al. (2018) Schlichtkrull, M.; Kipf, T. N.; Bloem, P.; Berg, R. v. d.; Titov, I.; and Welling, M. 2018.  Modeling relational data with graph convolutional networks.  In _European Semantic Web Conference_ , 593–607.
  * Shi et al. (2018) Shi, C.; Hu, B.; Zhao, W. X.; and Philip, S. Y. 2018.  Heterogeneous information network embedding for recommendation.  _IEEE Transactions on Knowledge and Data Engineering_ , 31(2): 357–370.
  * Shi et al. (2016) Shi, C.; Li, Y.; Zhang, J.; Sun, Y.; and Philip, S. Y. 2016.  A survey of heterogeneous information network analysis.  _IEEE Transactions on Knowledge and Data Engineering_ , 29(1): 17–37.
  * Sun and Han (2013) Sun, Y.; and Han, J. 2013.  Mining heterogeneous information networks: a structural analysis approach.  _ACM SIGKDD Explorations Newsletter_ , 14(2): 20–28.
  * Veličković et al. (2018) Veličković, P.; Cucurull, G.; Casanova, A.; Romero, A.; Lio, P.; and Bengio, Y. 2018.  semi-ttention networks.  In _International Conference on Learning Representations_.
  * Wang et al. (2022) Wang, X.; Bo, D.; Shi, C.; Fan, S.; Ye, Y.; and Philip, S. Y. 2022.  A survey on heterogeneous graph embedding: methods, techniques, applications and sources.  _IEEE Transactions on Big Data_.
  * Wang et al. (2020) Wang, X.; Bo, D.; Shi, C.; Fan, S.; Ye, Y.; and Yu, P. S. 2020.  A survey on heterogeneous graph embedding: methods.  _Techniques, Applications and Sources_.
  * Weisfeiler and Leman (1968) Weisfeiler, B.; and Leman, A. 1968.  reduction of a graph to canonical form and the algebra which appears therein.  _NTI, Series_ , 2(9): 12–16.
  * Yang et al. (2021) Yang, T.; Hu, L.; Shi, C.; Ji, H.; Li, X.; and Nie, L. 2021.  HGAT: Heterogeneous graph attention networks for semi-supervised short text classification.  _ACM Transactions on Information Systems (TOIS)_ , 39(3): 1–29.
  * Ying et al. (2018) Ying, Z.; You, J.; Morris, C.; Ren, X.; Hamilton, W.; and Leskovec, J. 2018.  Hierarchical graph representation learning with differentiable pooling.  _Advances in Neural Information Processing Systems_ , 31.
  * Yu et al. (2022) Yu, L.; Sun, L.; Du, B.; Liu, C.; Lv, W.; and Xiong, H. 2022.  Heterogeneous graph representation learning with relation awareness.  _IEEE Transactions on Knowledge and Data Engineering_.
  * Zeng et al. (2020) Zeng, H.; Zhou, H.; Srivastava, A.; Kannan, R.; and Prasanna, V. 2020.  GraphSAINT: Graph sampling based inductive learning method.  In _International Conference on Learning Representations_.
  * Zhang et al. (2019) Zhang, C.; Song, D.; Huang, C.; Swami, A.; and Chawla, N. V. 2019.  Heterogeneous graph neural network.  In _ACM SIGKDD International Conference on Knowledge Discovery and Data Mining_ , 793–803.
  * Zhang et al. (2021) Zhang, T.; Liu, Y.; Chen, X.; Huang, X.; Zhu, F.; and Zheng, X. 2021.  GPS: A policy-driven sampling approach for graph representation learning.  _arXiv preprint arXiv:2112.14482_.
  * Zhang et al. (2022) Zhang, T.; Liu, Y.; Shen, Z.; Xu, R.; Chen, X.; Huang, X.; and Zheng, X. 2022.  FedRel: An adaptive federated relevance framework for spatial temporal graph learning.  _arXiv preprint arXiv:2206.03420_.


#  SmartIntentNN:
Towards Smart Contract Intent Detection

Youwei Huang1,2, Tao Zhang1, Sen Fang1, and Youshuai Tan1
1 Macau University of Science and Technology, Macao SAR, China
2 Institute of Intelligent Computing Technology, Suzhou, CAS, China
<EMAIL_ADDRESS>

###### Abstract

Researchers currently have been focusing on smart contract vulnerability
detection, but we find that developers’ intent to write smart contracts is a
more noteworthy security concern because smart contracts with malicious intent
have caused significant financial loss to users. A more unfortunate fact is
that we can only rely on manual audits to check for unfriendly smart
contracts. In this paper, we propose SmartIntentNN, Smart Contract Intent
Neural Network, a deep learning-based tool that aims to automate the process
of developers’ intent detection in smart contracts, saving human resources and
overhead.

The demo video is available on https://youtu.be/ho1SMtYm-wI.

###### Index Terms:

Smart Contract, Intent Detection, Automated Software Engineering, Deep
Learning

##  I Introduction

A smart contract is defined as a type of computer program and a transaction
protocol to automatically execute, control, or document legally relevant
events and actions according to the terms of a contract or an agreement[1].
Generally, users interact with smart contracts by sending transactions to
invoke functions. From the perspective of computer programs, current studies
on the security of smart contracts mainly focus on the detection of their
vulnerabilities or defects. However, as transaction protocols, smart contracts
can also be injected with malicious intent by some greedy developers, which
may cause potential financial loss.

Fig. 1 gives several samples of unfriendly intent in a real smart contract. We
can observe that all functions contain the same modifier: onlyOwner, which
means that these functions are owned by an account. For instance, if adding
the modifier onlyOwner to the function changeTax, a development team can, and
only they can, arbitrarily change the tax fee for swapping the assets in a
smart contract. Similar to changeTax, teamUpdateLimits gives the developer the
right to modify various limits for transactions. As for the remaining two
functions, they express an even worse development intent that allows the owner
directly turn on or off the trading function in the smart contract. The
mainstream approach to detect smart contracts is manual audits, which are
costly and require huge human resources.

To optimize the aforementioned detection process, we present an automated and
deep learning-based smart contract intent detection tool: SmartIntentNN. It is
composed of a universal sentence encoder[2] to generate the contextual
representations (embeddings)[3] of smart contracts, a K-means clustering
model[4, 5] to highlight the intent-related representations, and a
bidirectional LSTM-based (long-short term memory)[6, 7] multi-label
classification network to predict the intent in smart contracts.

Figure 1:  Examples of a smart contract with malicious intent. BSC address:
0xDDa7f9273a092655a1cF077FF0155d64000ccE2A.

Our contributions are summarized as the following points:

  * •

This is the first work to apply deep learning to implement an automated tool
for smart contract intent detection;

  * •

We collect an extensible dataset of smart contract source code with ten
different categories of intent;

  * •

Our research-used source code, dataset and document are released on
https://gitlab.com/web3se/smartintent.

##  II Dataset

As SmartIntentNN is implemented on a deep neural network (DNN), we collect a
large-scale dataset that contains over $40,000$ smart contracts from Binance
Smart Chain (BSC) explorer111https://bscscan.com and label them with $10$
different types of intent at the function code level. We first download open-
source smart contracts from the explorer, then we merge those smart contracts
in multiple files, and drop the redundant and noisy snippets. Finally, we
extract the function level code snippets in smart contracts.

###  II-A Intent Labels

We labelled $10$ common categories of intent for the smart contracts in our
dataset:

  * 1

Fee arbitrarily changes transaction fees. The transaction fees paid by users
are transferred to the specified wallet addresses.

  * 2

DisableTrading can directly turn on or off the trading action on a smart
contract.

  * 3

Blacklist restricts the behavior of designated users on smart contracts. This
can damage the right of some users to fair and free trade.

  * 4

Reflection is usually financed by a percentage tax on each transaction. Taxes
are redistributed to the holders according to their holding amount. It can
attract users to purchase the native tokens without any use case.

  * 5

MaxTX can limit the maximum number or volume of transactions on a smart
contract.

  * 6

Mint allows issuing new tokens. This issue can be unlimited or artificially
controlled.

  * 7

Honeypot is a smart contract that pretends to leak its funds to a user,
provided that the user sends additional funds to it. However, the funds
provided by the user will be trapped and retrieved by the honeypot creator[8].

  * 8

Reward is to reward users with specific crypto assets in the form of dividends
to attract users to buy or use the native tokens. These assets may not have
value.

  * 9

Rebase, or elastic, controls the token price by algorithmically adjusting the
supply.

  * 10

MaxSell limits the specified users’ selling times or amounts, so to lock their
liquidity.

Our label resource is from the StaySafu222https://www.staysafu.org and the
experience of decentralized application developers and auditors.

###  II-B Input Extraction

The source code of a smart contract on BSC can be published in two forms. One
is the single-file smart contract, whose imports are merged by developers
before uploading. The other form is a smart contract with multiple files,
whose code is uploaded as multiple files. For a multi-file smart contract, we
merge all the files into a single document.

The Solidity compiler version specification pragma, import statements, and
comments in a smart contract are dropped out. The Solidity compiler version
(pragma) does not express any developer’s intent, and the code comments take
no impact on the implementation of any intent. Since the external contracts in
the import statements have been merged in the previous step (multi-file smart
contracts), removing the import statements will not lose any intent
information.

Since a smart contract is a document of computer code, we cannot directly feed
an entire smart contract into a neural network. We apply two sets of regular
expressions to extract contract level code and function level code in smart
contracts. The function code in a smart contract is what we need to input to
our model for training and evaluating, denoted by $\mathcal{F}$.

##  III Implementation

The implementation of SmartIntentNN can be divided into three primary stages:
smart contract embedding, intent highlighting, and multi-label classification
learning.

###  III-A Smart Contract Embedding

We employ the universal sentence encoder to embed the context of functions. We
use $\Phi\left(\mathcal{F}\right):\mathcal{F}\rightarrow\bm{f}$ to describe
such process, where $\Phi$ represents the contextual encoder and its input
data $\mathcal{F}$ can be any context of function. It outputs a vector
$\bm{f}$ which is the embedding of the function $\mathcal{F}$.

The above operation will be performed on each function in a smart contract,
and we finally push all the $\bm{f}$ into a matrix $\bm{X}$ to represent an
entire smart contract. $\bm{X}$ is an $n\times m$ matrix where $n$ equals to
the number of functions in a smart contract and $m$ is the embedding
dimension.

###  III-B Intent Highlight

Although we can directly feed $\bm{X}$ into a DNN, not all functions are
related to the developer’s intent. Thus, we implement an intent highlight
module to extract the intent-related functions in a smart contract.
$\mathrm{H}\left(\bm{X}\right):\bm{X}\rightarrow\bm{X^{\prime}}$ describes the
highlighting process, where $\rm{H}$ is an unsupervised model and its output
is the intent-highlighted data $\bm{X^{\prime}}$.

We first train a K-means clustering model to predict the intent strength of
each function. We randomly select $1,500$ smart contracts from our dataset and
calculate the frequency of occurrence for each function. By our experiments,
we find that the frequency of $19$ functions is greater than $0.75$, and we
further find these $19$ functions are commonly used by developers. Through in-
depth analysis, we find that these code snippets are usually from public
libraries or the code in high-frequency reuse. We thus consider that these
functions with a high frequency of occurrence express weak intent from the
developers. On the contrary, those rarely used functions express some specific
and strong intent from the developers.

We set the initial $k$ value as $19$, according to the $19$ high-frequency
functions, and set a loop of $80$ rounds for K-means training. When comparing
the similarity of the two documents, we calculate the cosine distance between
their embedding vectors[9][10]. Formula 1 provides a method for calculating
the cosine similarity between two functions (A and B), that is, the cosine
value of $\bm{f^{A}}$ and $\bm{f^{B}}$. Then, we transform cosine similarity
to cosine distance by Formula 2.

$\cos\left\langle\bm{f^{A}},\bm{f^{B}}\right\rangle=\frac{\bm{f^{A}}\cdot\bm{f^{B}}}{\left\|\bm{f^{A}}\right\|\left\|\bm{f^{B}}\right\|}$
(1)
$\mathrm{D}\left(\bm{f^{A}},\bm{f^{B}}\right)=1-\cos\left\langle\bm{f^{A}},\bm{f^{B}}\right\rangle$
(2)

During the training process, the K-means model repeatedly performs the
calculation of the cosine distance between the centroids and their within-
cluster function vectors. The centroids will be updated after each round and
the training target is to minimize the total within-cluster variation (TWCV)
for all the clusters. The training is terminated when reaching the maximum
iteration limit or the minimum TWCV is no longer significantly reduced.
Eventually, we get the proper centroids for K-means and the value $k$ is
reduced to $16$. When obtaining the trained K-means model, we can pass any
vector $\bm{f_{i}}$ to it for predicting its within-cluster distance. We
regard the within-cluster distance as the strength of the intent of a
function–The farther the distance, the stronger the intent.

$\bm{X^{\prime}}=\mathrm{scale}\left(\bm{X}\right)\;\mathsf{by}\;\mu\bm{f_{i}}\;\mathsf{if}\;\mathrm{D}\left(\bm{f_{i}},\bm{c_{j}}\right)\geq\lambda$
(3)

In Formula 3, we scale $\bm{f_{i}}$ in $\bm{X}$ by the predicted within-
cluster distance to generate a new matrix $\bm{X^{\prime}}$, where
$i\in\left\\{1,2,\cdots,n\right\\}$, $j\in\left\\{1,2,\cdots,16\right\\}$, and
$\lambda=0.75$ is a threshold of the distance, beyond which, $\bm{f_{i}}$ is
scaled by $\mu=2$ times.

###  III-C Multi-label Classification

In this section, we leverage a DNN model for multi-label classification. Our
model can be divided into three layers: an input layer, a bidirectional LSTM
(BiLSTM) layer, and a multi-label classification layer. We feed the matrix
$\bm{X^{\prime}}$ into the model to train it by minimizing $10$ concatenated
binary cross entropy losses, according to the $10$ labels in Section II.A.

We assume that the input layer accepts a sequence of $a\times b$ size. The
number of functions input for each time should be equal to $a$. The number of
features in each function embedding should be equal to $b$. The feature number
is fixed, hence we do not need to make any change to the columns of
$\bm{X^{\prime}}$. The only thing we need to ensure is that $b$ equals to the
number of features in $\bm{f_{i}}$. However, the row size of $\bm{X^{\prime}}$
is determined by the number of functions in each smart contract. There is a
situation for $\bm{X^{\prime}}$, where the number of its rows may be less than
$a$. As our input layer is also a masking layer and the masking value is $0$,
we can pad the absent rows of $\bm{X^{\prime}}$ with zero vectors.

The second layer is a bidirectional LSTM layer, accepting an $a\times b$
matrix, which is the output of the previous input layer. Each LSTM layer
contains $a$ memory cells, thus there are a total of $2a$ cells. In each cell,
data is passed and processed through the LSTM input gate, forget gate, and
output gate to learn the representation of smart contract semantic context. We
set $h$ hidden units and use a vector $\bm{h}$ to represent the output of a
cell. We assume that the forward layer outputs $\bm{h^{f}}$ and the backward
layer outputs $\bm{h^{b}}$. Therefore, the final output of the BiLSTM layer is
the direct sum of the two outputs through $\bm{h^{f}}\oplus\bm{h^{b}}$[11],
denoted by $\bm{h}$.

$\bm{y}=\mathrm{sigmoid}\left(\bm{W}\bm{h}+\bm{b}\right)$ (4)

The output of the BiLSTM layer is eventually passed to a multi-label
classification dense layer. Formula 4 performs a binary classification on each
intent label through a $\mathrm{sigmoid}$ function. The shape of weight matrix
$\bm{W}$ is $l\times 2h$, where $2h$ is the size of input vector $\bm{h}$ and
$l$ is the number of target labels. Therefore, the final output is a vector
$\bm{y}=[y_{1},y_{2},\cdots,y_{l}]$ and the value of each element in it
indicates the probability of one intent category existing in a smart contract.
So far, the intent detection of a smart contract is completed.

##  IV Application

We utilize Tensorflow.js[12] to build SmartIntentNN as a website tool so that
anyone can easily access it on a browser. Specifically, SmartIntentNN contains
two major features: intent highlight and intent detection.

###  IV-A Intent Highlight

Figure 2:  Example of intent highlight applied on a smart contract. BSC
address: 0xE97CBB39487a4B06D9D1dd7F17f7fBBda4c2b9c4.

The intent highlight can help users quickly locate functions in smart
contracts that contain specific and strong development intent. In Fig. 2,
functions with strong intent are name-highlighted with red background.
Specifically, a hexagon node represents the centroid of its corresponding
cluster and the circle node represents a function with weak intent while a
star represents one with strong intent. When an edge is focused, the distance
from the centroid to the function is displayed, which represents the strength
of the intent. On the left side of the user interface, we list functions in a
smart contract in descending order of intent from strong to weak.

From Fig. 2, we can observe that there are several functions highlighted with
red background, e.g., setBotBlacklist and setAutoRebase, in which really
exists some suspicious intent, and they may belong to the intent category of
blacklist and rebase described in Section II.A. Those non-highlighted
functions are mainly interfaces or libraries, e.g., functions in
IPancakeSwapFactory.

###  IV-B Intent Detection

Figure 3:  Example of intent detection applied on a smart contract. BSC
address: 0xc4F082963E78deAaC10853a220508135505999E6.

The intent detection provides a text area for users to type or copy the real
smart contract source code and then utilizes SmartIntentNN to predict
functions’s intent in it. Those predicted as high probability intent labels
are displayed to users in red background, while the low-probability ones are
displayed in green font.

From Fig. 3, we can find that SmartIntentNN successfully detected three
malicious intent existing in the given smart contract, i.e., fee,
disableTrading, and maxTX. To further verify the output of SmartIntentNN, we
have checked the smart contract manually and found that these categories of
malicious intent really exist in this smart contract. For example, the
variable tradingOpen in line $403$ of the contract controls turning the
trading function on or off, which belongs to the disableTrading intent. The
other two types of intent, maxTx and fee, are also found in lines $511$ and
$548$ respectively.

##  V Evaluation

We apply the confusion matrix to evaluate our tool which allows us to measure
4 types of metrics: recall, precision, accuracy, and f1-score[13]. We evaluate
on $10,000$ real smart contracts which do not overlap with our trained
dataset. As this is the first work on smart contract intent detection, we have
no previous related work to compare. We perform a self-comparison with three
baselines, respectively, using a basic LSTM model, a BiLSTM model, and a
Convolutional Neural Network model[14] to detect the intent in smart
contracts.

TABLE I: Baselines Comparison Model | Accuracy | Precision | Recall | F1-score
---|---|---|---|---
SmartIntentNN
Scale$\times 2$ | $\bm{0.9482}$ | $\bm{0.8118}$ | $\bm{0.8308}$ | $\bm{0.8212}$
Scale$\times 4$ | $0.9455$ | $0.8380$ | $0.7677$ | $0.8013$
Scale$\times 10$ | $0.9435$ | $0.8250$ | $0.7682$ | $0.7956$
Other Models
LSTM | $0.9405$ | $0.8126$ | $0.7588$ | $0.7848$
BiLSTM | $0.9402$ | $0.8033$ | $0.7706$ | $0.7866$
CNN | $0.9309$ | $0.8395$ | $0.6392$ | $0.7258$

The results of evaluation in Table I shows that, of all the baselines and our
approach, SmartIntentNN with intent highlight scale$\times 2$ acquires the
highest f1-score of $0.8212$, the accuracy of $0.9482$, the precision of
$0.8118$, and the recall of $0.8308$. Compared with the baselines, f1-score is
nearly $3\%$ higher than that of LSTM and BiLSTM, and $9\%$ higher than that
of CNN. SmartIntentNN performs better than other typical baselines as we use a
BiLSTM layer to understand the context of smart contracts both from forward
and backward, and further use the intent highlight model to strengthen those
code representations with strong intent.

There are two variants of the intent highlight model: $4\times$scale ($\mu=4$)
and $10\times$scale ($\mu=10$). All the variants of SmartIntentNN can achieve
an f1-score of more than $0.8$ except the model using intent highlight of
$10\times$scale. It is slightly lower than the best variant of SmartIntentNN
but still higher than the other models. The reason for this issue is that
excessive scale of the embeddings can lead to serious deviation from the
actual representation of context.

##  VI Conclusion

In this initial work, we present a novel automated tool based on deep learning
techniques, namely SmartIntentNN, to detect the developers’ intent in smart
contracts. To implement SmartIntentNN, we leverage a universal sentence
encoder, a K-means-based intent highlight model, and a DNN integrated with a
BiLSTM layer. SmartIntentNN is trained on $20,000$ and evaluated on $10,000$
smart contracts, and it can achieve an f1-score of $0.8212$.

## References

  * [1] “Introduction to smart contracts.” [Online]. Available: https://ethereum.org/en/developers/docs/smart-contracts
  * [2] D. Cer, Y. Yang, S.-y. Kong, N. Hua, N. Limtiaco, R. S. John, N. Constant, M. Guajardo-Cespedes, S. Yuan, C. Tar _et al._ , “Universal sentence encoder,” _arXiv preprint arXiv:1803.11175_ , 2018.
  * [3] T. Mikolov, I. Sutskever, K. Chen, G. S. Corrado, and J. Dean, “Distributed representations of words and phrases and their compositionality,” _Advances in neural information processing systems_ , vol. 26, 2013.
  * [4] J. MacQueen, “Classification and analysis of multivariate observations,” in _5th Berkeley Symp. Math. Statist. Probability_ , 1967, pp. 281–297.
  * [5] K. Krishna and M. N. Murty, “Genetic k-means algorithm,” _IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics)_ , vol. 29, no. 3, pp. 433–439, 1999.
  * [6] S. Hochreiter and J. Schmidhuber, “Long short-term memory,” _Neural computation_ , vol. 9, no. 8, pp. 1735–1780, 1997.
  * [7] I. Sutskever, O. Vinyals, and Q. V. Le, “Sequence to sequence learning with neural networks,” _Advances in neural information processing systems_ , vol. 27, 2014.
  * [8] C. F. Torres, M. Steichen _et al._ , “The art of the scam: Demystifying honeypots in ethereum smart contracts,” in _28th USENIX Security Symposium (USENIX Security 19)_ , 2019, pp. 1591–1607.
  * [9] F. Rahutomo, T. Kitasuka, and M. Aritsugi, “Semantic cosine similarity,” in _The 7th international student conference on advanced science and technology ICAST_ , vol. 4, no. 1, 2012, p. 1.
  * [10] X. Gu, H. Zhang, and S. Kim, “Deep code search,” in _2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE)_. IEEE, 2018, pp. 933–944.
  * [11] C. Faith and E. A. Walker, “Direct sum representations of injective modules,” _J. Algebra_ , vol. 5, no. 2, pp. 203–221, 1967.
  * [12] D. Smilkov, N. Thorat, Y. Assogba, C. Nicholson, N. Kreeger, P. Yu, S. Cai, E. Nielsen, D. Soegel, S. Bileschi _et al._ , “Tensorflow. js: Machine learning for the web and beyond,” _Proceedings of Machine Learning and Systems_ , vol. 1, pp. 309–321, 2019.
  * [13] S. V. Stehman, “Selecting and interpreting measures of thematic classification accuracy,” _Remote sensing of Environment_ , vol. 62, no. 1, pp. 77–89, 1997\.
  * [14] Y. LeCun, Y. Bengio _et al._ , “Convolutional networks for images, speech, and time series,” _The handbook of brain theory and neural networks_ , vol. 3361, no. 10, p. 1995, 1995.