# Adaptive Prototypical Networks with Label Words and Joint Representation
Learning for Few-Shot Relation Classification

Yan Xiao, Yaochu Jin, and Kuangrong Hao Y. Xiao and K. Hao are with the
Engineering Research Center of Digitized Textile & Apparel Technology,
Ministry of Education, College of Information Science and Technology, Donghua
University, Shanghai 201620, China. Email<EMAIL_ADDRESS><EMAIL_ADDRESS>Jin is with the Engineering Research Center of Digitized
Textile & Apparel Technology, Ministry of Education, College of Information
Science and Technology, Donghua University, Shanghai 201620, China. He is also
with the Department of Computer Science, University of Surrey, Guildford,
Surrey GU2 7XH, United Kingdom. Email<EMAIL_ADDRESS>(Corresponding
author)Manuscript received xxxx, 2021; revised xxxx, 2021.

###### Abstract

Relation classification (RC) task is one of fundamental tasks of information
extraction, aiming to detect the relation information between entity pairs in
unstructured natural language text and generate structured data in the form of
entity-relation triple. Although distant supervision methods can effectively
alleviate the problem of lack of training data in supervised learning, they
also introduce noise into the data, and still cannot fundamentally solve the
long-tail distribution problem of the training instances. In order to enable
the neural network to learn new knowledge through few instances like humans,
this work focuses on few-shot relation classification (FSRC), where a
classifier should generalize to new classes that have not been seen in the
training set, given only a number of samples for each class. To make full use
of the existing information and get a better feature representation for each
instance, we propose to encode each class prototype in an adaptive way from
two aspects. First, based on the prototypical networks, we propose an adaptive
mixture mechanism to add label words to the representation of the class
prototype, which, to the best of our knowledge, is the first attempt to
integrate the label information into features of the support samples of each
class so as to get more interactive class prototypes. Second, to more
reasonably measure the distances between samples of each category, we
introduce a loss function for joint representation learning to encode each
support instance in an adaptive manner. Extensive experiments have been
conducted on FewRel under different few-shot (FS) settings, and the results
show that the proposed adaptive prototypical networks with label words and
joint representation learning has not only achieved significant improvements
in accuracy, but also increased the generalization ability of few-shot RC
models.

###### Index Terms:

Relation classification (RC), few-shot learning (FSL), adaptive prototypical
networks.

##  I Introduction

TABLE I: A data example of a 3-way 2-shot scenario of FSRC. The head entity
and tail entity are indicated by red and blue respectively for each sentence.
The original label words and descriptions of each category are also given in
the left column of the table. The correct relation class for the query
instance is R2. Support Set
---
R1: country of citizenship (the object is a country that recognizes the subject as its citizen) |  | Instance1: Chris Huffins (born 15 April 1970) is an athlete from the United States who competed
---
in the field of Decathlon.
Instance2: During the Three Kingdoms era, Liu Bei’s Shu was based in Sichuan.
R2: religion (religion of a person, organization or religious building, or associated with this subject) | Instance1: He founded a literary prize which in 1901 was won by Ndoc Nikaj, a Catholic priest.
| Instance2: These 67 used an old candle from prominent Unitarian preacher
William Ellery Channing
---
to supply the flame.
R3: developer (organisation or person that developed the item) | Instance1: MicroIllusions published The Faery Tale Adventure first in 1986.
| Instance2: Since tcsh was based on the csh code originally written by Bill
Joy, it is not considered
---
a clone.
Query Instance
R1, R2 or R3 | In 1689, Konstanty was one of the judges who sentenced Kazimierz to death for atheism.

AS the core task of text information extraction, relation classification (RC)
is essential to text understanding, which has found many applications in
natural language processing (NLP), such as text mining, question answering and
knowledge graphs. The main purpose of RC is to generate relational triples
$<e_{1},r,e_{2}>$ from plain natural language text, where $e_{1}$ and $e_{2}$
are entities and $r$ implies the relation between the two entities in a
sentence. For example, the instance “ _Beijing is the capital of China._ ”
expresses the relation “ _capital of_ ” between the two entities “ _Beijing_ ”
and “ _China_ ”.

With the continuous development of deep learning technologies, conventional
methods of RC have been gradually replaced by neural network methods, among
which the most popular and effective paradigm is the supervised RC. Since
convolutional neural networks (CNN) based methods [1] that automatically
capture relevant lexical and sentence level features were first proposed for
supervised RC task, subsequent research based on neural networks has gradually
prevailed and achieved the state-of-the-art. However, as neural networks are
data-hungry methods, the performance of supervised RC methods heavily depends
on the quality and quantity of the training data, meaning that these methods
suffer from the lack of large-scale training data sets.

In order to address the above issue, Mintz et al. [2] proposed distant
supervision relation extraction (DSRE) that can automatically generate
training data via aligning triples in knowledge graphs (KGs) with sentences in
corpus. To be specific, the method assumes that if a pair of entities has a
relation in KGs, all sentences that contain these two entities will describe
the same relation. In this way, DSRE effectively alleviates the problem of
manually labeling large-scale data set, but it inevitably introduces noise
into the dataset because of the strong hypothesis it makes. Therefore, most
current research has been devoted to solving this problem through various
methods such as multi-instance learning and attention mechanism. However,
there are still a large number of categories with very few samples in DSRE,
resulting in a clear long-tailed distribution in the entire dataset. For those
categories with few samples, the classification performance will be
dramatically deteriorated, which is a serious problem that most existing DSRE
methods neglect. In fact, in real life, there may exist a situation where only
few or even zero samples are available due to the complexity of operations, in
which we humans indeed have the ability to learn knowledge from a few examples
or even a single sample [3]. In other words, humans are able to learn quickly
and make inferences by analogy, which inspired researchers to propose the
concept of few-shot learning (FSL). The main challenge of FSL is how to
produce models that can generalize from a small amount labeled data to
understand new categories. A new category here means that the relation
category to which the test sample belongs and has never appeared during the
training. Through the training mechanism of FSL, the model combines the
generalized knowledge learned from the basic data with a limited number of
training samples of the new category, achieving the purpose of rapid knowledge
learning.

In the past few years, research on FSL originated mainly from the field of
computer vision (CV), and the commonly used data sets, Omniglot and Mini-
ImageNet, are both image classification data sets. One most commonly used
method for solving few-shot tasks is transfer learning [4], which aims to
learn new classes more quickly by making use of knowledge learned from basic
classes with sufficient samples. Transfer learning is mainly realized by fine-
tuning the weights of the pretrained network. Based on a similar principle,
the recently proposed meta-learning method [5] works by learning a
parameterized function, which embeds various learning tasks and then can be
generalized to new tasks. Another simple and effective method is the metric
learning method, where the core idea is to model the distance distribution
among all samples in the entire data set and then classify them according to
different metrics. Among them, the most representative approach is the
prototypical networks, which is based on the assumption that there exists a
prototype for each class, and has achieved the state-of-the-art performance on
most FS benchmarks. Even though FSL has developed very rapidly in recent
years, most methods introduced above are derived from the field of CV. So far,
FSL is still a young research field, especially when it is applied to the
field of NLP. Compared with FSL in other fields, the RC task has its own
unique challenges due to the fact that text is more diverse and complex than
images, making it very difficult to directly generalize existing FSL models to
NLP applications. Consequently, it is of great significance to extend and
adapt FSL techniques to NLP tasks such as RC. To promote the research of FSL
in the field of NLP, Han et al. [6] first introduced FSL to the task of
relation extraction and constructed a few-shot relation classification (FSRC)
dataset FewRel, aiming to predict the relation for a pair of entities in a
sentence by training with a few labeled examples in each relation. Table I
shows a part of the dataset, which is an episode of data in 3-way 2-shot
scenarios. In the left column, two parts of label information are shown
respectively, namely the specific label words and label description (enclosed
in parentheses) of each category. The purpose of the FSRC task is to determine
which category the query instance of the last line belongs to.

In this work, we propose adaptive prototypical networks with label words and
joint representation learning based on metric learning for FSRC, which
performs classification by calculating the distances in the learned metric
space. Considering that only few samples are available in the FSRC, our
motivation is to maximize the advantage of existing data information. On the
one hand, we augment the metric-based prototypical networks with an adaptive
mixture mechanism to get a more precise class prototype, where a convex
combination is formed by incorporating the label information. To be specific,
not only the samples from each category, but also the label words of each
category are taken into account in an adaptive convex combination of two
homologous embedding spaces. On the other hand, a joint training algorithm
consisting of a classification loss function and a representation learning
loss function is proposed to achieve the effective representation of each
sample. The purpose of the representation learning loss is to make the
distance between samples of the same category much greater than that of
different types in a space, which is inspired by the margin triplet loss in
the face recognition task [7]. Consequently, not only the problem of feature
sparsity is effectively alleviated, but also the performance degradation of
models with fewer samples can be substantially improved, thereby improving the
classification performance. Moreover, in order to fully verify the
effectiveness of our proposed model, we conducted several experiments on the
FewRel dataset, which is derived from real-world corpus Wikipedia and
Wikidata. Experimental results demonstrate that our model achieves significant
performance over the state-of-the-art baseline methods.

To sum up, the main contributions of this work are as follows:

  * •

We propose an adaptive label information mixture mechanism based on the
prototypical networks. To the best of our knowledge, this is the first time
that information of each class has been integrated into the class prototypes
for FSRC, which effectually alleviates the problem of model performance
degradation due to data paucity.

  * •

A new joint learning method is designed for FSRC tasks, which allows the model
to perform effective classification training assisted by good representation
ability, thereby improving the generalization ability of the model on
recognizing long-tail relations.

  * •

Experiments are conducted to compare the proposed algorithm with its ablation
variants as well as with the state-of-the-art. Our comparative results show
that the two mechanisms we introduced both play an important role for the
proposed model to deliver significant performance gains over the state-of-the-
art baseline methods.

The remainder of the paper is structured as follows. In Section II, we review
the related work on relation extraction, few-shot learning and the triplet
loss adopted in this work. Section III presents the specific definition of the
FSRC task. In Section IV, we give the details of our proposed model. The
dataset and implementation details are described in Section V, and we further
analyze our model and compare it with state-of-the-art models in Section VI.
Conclusions and future work are summarized in Section VII.

##  II Related work

In this section, we briefly review the relevant background of relation
classification, few-shot learning and the triplet loss function.

###  II-A Relation classification

Relation classification (RC) is designed to select a proper relation from a
predefined relation set when two target entities in the given text have been
marked. Before neural networks were applied in the field of NLP, some
conventional methods had achieved pretty good results in RC, such as kernel
based methods [8, 9] and feature based methods [10]. With the development of
deep learning, several neural network-based methods, including convolutional
neural networks (CNNs) [11, 12] and the long short term memory (LSTM) [13,
14], and Transformer [15], have constantly refreshed the record on supervised
RC tasks. Since the supervised RC task often suffers from a lack of annotated
data sets, the idea of distant supervision relation extraction (DSRE) [2] was
proposed to alleviate this problem, which mainly uses the existing database to
automatically align the text. In order to solve the noise problem caused by
the strong assumption in DSRE, a piece-wise CNN (PCNN) model based on the
position of two entities was proposed in combination with an attention
mechanism [16]. Besides, a Transformer block based model was explored to
capture the structure and contextual information of the whole text to
distinguish the useful and the noisy information in sentences [17]. Both
reinforcement learning techniques [18] and the generative adversarial training
methods [19] were utilized to select high-quality sentences to reduce the
effect of noise. Although there has been plenty of research dedicated to the
RC task, the grand challenge of long-tail distribution datasets in RC remains
to be solved, regardless of supervised RC or DSRE.

###  II-B Few-shot relation classification

Few-shot learning (FSL) [20] has recently attracted increasing attention, as
it enables to generalize to new classes in classification tasks by training a
classifier with only a few instances. Knowledge transfer between associative
categories is a key method for FSL [21, 22] in early years, which is achieved
mainly through pre-training methods to transfer the latent knowledge of the
previously learned category to the target domain. Recently, meta-learning was
proposed to realize the idea of fast learning, where the simple neural
attentive learner (SNAIL) meta-learning model [23] uses the time convolutional
neural network and attention mechanism to quickly learn from previous
experience. Additionally, Munkhdalai and Yu [24] proposed a meta-network
(MetaNet) to learn meta-knowledge across tasks and transformed its inductive
bias through rapid parameterization to achieve rapid generalization.
Meanwhile, the metric based FSL has attracted a lot of interest due to its
simplicity and effectiveness, the basic idea of which is to learn a metric
space that maps similar samples close and dissimilar ones distant so that
classification can be easily performed. Based on this idea, the Siamese neural
network was proposed in [25] that employed an unique structure to learn a
similarity metric from the data, while Vinyals et al. [26] explored matching
networks with the idea of attention and external memories to map the data to
obviate the need for fine-tuning when adapted to new class types. Snell et al.
[27] defined the prototypical networks that usually classify the sample and
its nearest class prototype into one category, where the class prototype is
obtained by averaging all samples in each category. Moreover, a generalization
of the above three models is proposed in [28], where a graph neural network
architecture is utilized to process general information in FSL tasks.

Although most existing FS methods were developed in the CV field [29, 30, 31],
their success has inspired researchers to explore the application of FSL to
NLP. With respect to the few-shot relation classification, Han et al. [6]
organized the FewRel dataset and adapted part of the methods above on FSRC,
where the prototypical networks are pretty easy to implement and understand.
Afterwards, hybrid attention-based prototypical networks for noisy FSRC is
proposed in [32] and hierarchical attention prototypical networks for FS text
classification is proposed in [33]. However, one issue that has troubled most
approaches is that the performance of FSL will seriously degrade when the
amount of samples is small. To alleviate this problem, this work proposes an
adaptive label information mixture mechanism with the joint representation
learning inspired by the triplet loss to improve the generalization of FS
model.

###  II-C Triplet loss in face recognition

Representation learning [34], also known as feature learning, generally refers
to the model that automatically learns the input data to obtain the features
that are more representative. The large margin principle has played a key role
in the course of feature learning history, producing remarkable theoretical
and empirical results for classification and regression problems [35]. Its
desirable benefits include its better generalization properties and robustness
to input perturbations. A large body of research [36, 37, 38] has explored the
benefits of encouraging a large margin in the context of deep networks, which
was realized by defining the following triplet loss function [7]:

$\displaystyle L=\sum_{i}^{N}{\left[\lVert
f\left(x_{i}^{a}\right)-f\left(x_{i}^{p}\right)\rVert_{2}^{2}-\lVert
f\left(x_{i}^{a}\right)-f\left(x_{i}^{n}\right)\rVert_{2}^{2}+\eta\right]_{+}}$
(1)

According to Eq. (1), given an image $x_{a}^{i}$ of a specific person as
anchor, the triplet loss optimizes the embedding space by adding a margin
$\eta$ in the objective function such that data points $x_{p}^{i}$ with the
same identity (positive) are closer to each other than those with different
identities $x_{n}^{i}$ (negative), which allows us to perform end-to-end
representation learning between the input image and the desired embedding
space. However, generating all possible triplets will not contribute to the
training, but result in a slower convergence instead. Therefore, an essential
part of the triplet loss is the mining of triplets, and a variant of the
triplet loss [39] was utilized to implement deep metric learning in person re-
identification task afterwards. It outperformed most other methods by a large
margin for models trained from scratch as well as pretrained ones. Similarly,
we also have made series of modifications to triplet loss, and finally got the
effective combination of its application in FSRC, which we will introduce in
detail in Section IV-C2.

##  III Task Definition

Suppose that $D$ is the entire labeled data, which is usually divided into two
parts according to the relation category: $D_{train}$ and $D_{test}$. In other
words, the two datasets have different label spaces and they are disjoint with
each other. Generally, most of the current FSL algorithms employ the “episode”
training strategy [26], which has been proved to be practical. To this end,
$D_{test}$ is further split into two parts: $D_{test-support}$ and $D_{test-
query}$. To be specific, in each episode, $N$ classes are randomly sampled
from $D_{test}$ firstly, and then $K$ instances for each of $N$ classes are
sampled to constitute $D_{test-
support}=\left\\{\left(x_{ij}^{s},y_{i}^{s}\right);i=1,...,N,\
j=1,...,K\right\\}$. We usually call it $N-way$ $K-shot$ in FSL task. Besides,
we randomly sample $R$ instances from the remaining samples of those $N$
classes to construct $D_{test-
query}\left\\{\left(x_{k}^{q},y_{k}^{q}\right);k=1,...,R\right\\}$. Likewise,
we can also acquire $D_{train-support}$ and $D_{train-query}$ in a similar
way, but $N\\_for\\_train$ is usually larger than $N\\_for\\_test$, which is a
common practice in FSL. A data example of a 3-way 2-shot scenario of FSRC is
given in Table I, where $N=3$, $K=2$ and $R=1$.

As a result, FSRC can be defined as a task to predict the relation $y^{q}$ of
a query instance $x^{q}$ in the query set $Q$, given a relation set
$\mathcal{R}=\left\\{r_{i};i=1,...,N\right\\}$ and the support set $S$. As we
consider $N=5$ or 10, and $K=5$ or 10 in this work, the number $N$ of classes
and the number $K$ of instances are usually so small that the FS model has to
be trained from the few instances in the support set and then use the trained
model to predict the relation for any given query instance. In addition, each
instance in the dataset is composed of $T$ words, which includes the mentioned
entity pair $(h,t)$.

Figure 1:  The architecture of our proposed model for FSRC, where the input
sample, instance encoder, prototypical networks and our proposed adaptive
mixture mechanism are shown from left to right. The final category prototype
is a convex combination of the semantic feature representation of samples in
support set and label words, its coefficients are conditioned on the semantic
label embedding.

##  IV Method

In this section, we present the details of the proposed adaptive prototypical
networks with label words and joint representation learning (APN-LW-JRL) for
FSRC. As shown in Fig. 1, all the input samples, both in the support set and
in the query set, will be embedded to feed into the encoder to obtain their
feature vector, while the label words are only expressed through the embedding
layer. Then the class prototype can be attainable via inputting the
represented samples in each support set into the prototypical networks. After
that, we will incorporate the embedded label words into the class prototype by
our proposed adaptive mixture mechanism to make improvements. Lastly, we will
explain the specific joint representation learning method that we proposed, in
an effort to perform effective end-to-end learning between input samples and
output prediction results.

###  IV-A Instance encoder

The instance encoder mainly consists of two layers: embedding layer and
instance encoding layer. The former aims to vectorize the input text, while
the latter is meant to perform feature extraction on the vectorized text.

####  IV-A1 Embedding Layer

Given an instance $x=\left\\{w_{1},w_{2},...,w_{T}\right\\}$ with $T$ words
mentioning two entity $(h,t)$, each word is represented by a real-valued
vector $\mathbf{w}_{i}$ via the pretrained embedding matrix
$V_{w}\in\mathbb{R}^{d_{w}\times\left|V\right|}$, where $\left|V\right|$
denotes the size of corpus vocabulary $V$ and $d_{w}$ means the dimension of
word embedding. Furthermore, the positional features of each word in the
sentence, i.e., the order of each word appears in the sentence, is very
crucial for the extraction of text information. Especially in the task of RC,
the closer the words are to the entities, the more informative the words are.
For this reason, the position embeddings [1] are introduced in our embedding
layer, which we used to transform the relative distances between each word in
the sentence and the two entities into vectors generated by looking up a
randomly initialized position embedding matrix
$V_{p}\in\mathbb{R}^{d_{p}\times\left|P\right|}$.

Finally, an ultimate input embedding for each word is achieved by
concatenating word embedding and position embedding that can be denoted as
$\mathbf{e}_{\boldsymbol{i}}=\left[\mathbf{w}_{i};\mathbf{p}_{1i};\mathbf{p}_{2i}\right]$,
where $\mathbf{e}_{\boldsymbol{i}}\in\mathbb{R}^{d}$ and $d=d_{w}+d_{p}\times
2$.

####  IV-A2 Encoding Layer

In this work, CNN is adopted as our context encoder to obtain the hidden
embedding of each word since it is very popular in most NLP tasks. After a
convolution kernel with a window size $u$ acted on the input embedding
$\left\\{\mathbf{e}_{1},...,\mathbf{e}_{T}\right\\}$, the hidden annotations
will be as follows:

$\displaystyle\mathbf{h}_{i}=CNN\left(\mathbf{e}_{i-\frac{u-1}{2}},...,\mathbf{e}_{i+\frac{u-1}{2}}\right)$
(2)

Then to determine the most useful feature in each dimension of the feature
vectors, we perform a max pooling operation on these hidden annotations.

$\displaystyle\mathbf{x}=\max\left\\{\mathbf{h}_{1},...,\mathbf{h}_{T}\right\\}$
(3)

Finally, we define the above two layers as a comprehensive function in Eq. (4)
for simplicity, where $\phi$ is the networks parameters to be learned.

$\displaystyle\mathbf{x}=f_{\phi}\left(x\right)$ (4)

###  IV-B Prototypical networks

The prototypical networks are simpler and more efficient than the meta-
learning approaches in the FSL task, and they produce the state-of-the-art
results even without sophisticated extensions developed for matching [27]. It
is based on the idea that each class can be represented by means of its
examples in a representation space learned by a neural network, which is
expressed by Eq. (5). $p_{i}$ is defined as class prototype for relation
$r_{i}$ and $x_{ij}^{s}$ is the embedding of the $j$-th sentence of relation
$r_{i}$ in the support set, where $K$ sentences in total are included for each
class.

$\displaystyle
p_{i}=\frac{1}{K}\sum_{j=1}^{K}{f_{\phi}\left(x_{ij}^{s}\right)}$ (5)

After the prototypes for classes are calculated from supporting instances, we
can classify a query instance by comparing the distance between the query
instance and each prototype based on a certain distance metric. Actually,
given a distance function $D\left(\cdot\right)$, a distribution over classes
is produced by prototypical networks for a query point $x^{q}$ based on a
softmax function over distances to the prototypes in the embedding space.
$\left|\mathcal{R}\right|$ denotes the total categories in the relation set.

$\displaystyle
p_{\theta}\left(y=r_{i}\left|x^{q}\right.\right)=\frac{\exp\left(-D\left(f_{\phi}\left(x^{q}\right),p_{i}\right)\right)}{\sum\limits_{l=1}^{\left|\mathcal{R}\right|}{\exp\left(-D\left(f_{\phi}\left(x^{q}\right),p_{l}\right)\right)}}$
(6)

As indicated in [27], there are multiple choices for the distance metric,
among which the Euclidean distance is the most appropriate. Hence, we also
adopt the Euclidean distance in this work.

###  IV-C Adaptive prototypical networks

In addition to the attractive simplicity, another reason why metric-based FSL
approaches are so attractive is that they are able to learn a good embedding
space, where samples from the same class are clustered together while samples
from different classes are far away from each other. Afterwards, a new sample
from the unseen category can be recognized directly through the distance
metric within the learned embedding space. Upon that, it is very crucial to
learn a discriminative embedding space in metric-based FSL tasks. In this
section, we will interpret in detail how we perform adaptive technologies
based on the prototypical networks by means of adaptive label information
mixture mechanism and adaptive joint training for class prototype.

Figure 2:  The illustration of the proposed adaptive mixture mechanism.
Suppose there is a query sample belonging to category $i$. (a) Originally, the
prototype closest to the query sample $q$ is $p_{j}$. (b) Take the semantic
feature of label words into account. (c) The location distribution of the
class prototype has modified through the implementation of the mixture
mechanism. (d) After the location distribution is updated, the closest
prototype to the query is now the category $i$, correcting the classification.

####  IV-C1 Adaptive Label Information Mixture Mechanism

As prototypical networks classify a query by calculating the distance between
the mapping of each category, the sample distribution learned by the network
model will not be really satisfactory when the two categories are particularly
similar. Therefore, the classification performance may be affected with the
more complicated textual features.

Thus, to make the spatial mapping of similar categories very distinctive, we
hypothesize that semantic information of both samples and labels can be useful
to make full use of the sample resources for FSL. Moreover, it is desirable to
adaptively express the class prototypes, given different scenarios of
categories. As shown in Fig. 2, we augment prototypical networks to model the
new prototype representation as a convex combination of two pieces of
information. For each category $i$, the new prototype is computed as follows.

$\displaystyle p_{i}^{\prime}=\lambda_{i}\cdot
p_{i}+\left(1-\lambda_{i}\right)\cdot c_{i},$ (7)

where $\lambda_{i}$ is the adaptive mixture coefficient that depends on the
representation of category information to ensure that the calculated class
prototype is compatible and not redundant.

$\displaystyle\lambda_{i}=\frac{1}{1+\exp\left(-h\left(c_{i}\right)\right)}$
(8)

$\displaystyle c_{i}=g\left(w_{i}\right)$ (9)

The label embedding for each class is first obtained by pretrained embedding
matrix $V_{w}\in\mathbb{R}^{d_{w}\times\left|V\right|}$. Then we utilize an
adaptive mixing network $h\left(\cdot\right)$, such as a fully connected
network to infer the coefficient $\lambda_{i}$. This way, similar classes in
the feature embedding space can be better separated. In addition, we use label
description instead of label word information in the proposed adaptive mixture
mechanism, which will be further discussed in Section VI-C.

####  IV-C2 Adaptive joint learning for class prototype

The key issue of FSL is to learn to generalize and the performance of
prototypical network for FSRC largely depends on the spatial distribution of
sentence embeddings. To realize the full potential of metric based methods for
FS, we propose an adaptive joint learning method based on the margin principle
to learn a more discriminative metric space and improve the generalization
capacity of model as well. This is achieved by combining the objective
functions of representation learning and classification to get better feature
representations for each instance while improving the classification
performance. This way, the model is able to separate samples from different
categories as farther as possible in the metric space.

$\displaystyle\mathcal{L}_{representation}=\sum_{a=1}^{\left|S\right|+\left|Q\right|}{\left[m+D_{\max}^{a,p}-D_{\min}^{a,n}\right]_{+}}$
(10)

$\displaystyle\mathcal{L}_{Cross-
Entropy}=-\sum_{q=1}^{\left|Q\right|}{\log\left(p_{\theta}\left(y=r_{i}\left|x^{q}\right.\right)\right)}$
(11)

$\displaystyle\mathcal{L}_{Joint}=\mathcal{L}_{Cross-
Entropy}+\alpha*\mathcal{L}_{representation}$ (12)

Specifically, based on the attributes of the FSL tasks, we use the triple loss
objective function introduced in Section II-C as the objective function of
representation learning, which consists of triplets of the anchor, the
positive and the negative. Here, we use the Euclidean distance as our distance
metric, denoted as $D$. For each anchor in the triplet loss, the difference to
the vanilla method is that we select the farthest positive instance (denoted
as $D_{\max}^{a,p}$) and the nearest negative instance (denoted as
$D_{\min}^{a,n}$) to each sample, which are called hardest triplets.
Particularly, we enriched the components of anchors that include all samples
of the support set and query set in each episode. In Eq. (10),
$\left|S\right|+\left|Q\right|$ is the total triplets in each episode, and $m$
is a hyperparameter that controls the interval between categories. In Section
VI-C, we further analyze the situation in which the triplet is composed of an
anchor and its related class prototype. By combining the classification
objective function and the representation learning objective function as shown
in Eq. (12), our model is able to take into account both classification error
and representation quality at the same time during the training. In the loss
function (12), $\alpha$ is a hyperparameter controlling the weight of
representation learning in the overall objective function. The overall
framework of the proposed algorithm is summarized as Algorithm 1.

Algorithm 1 Adaptive prototypical networks with label words and joint learning
for an episode in few-shot relation classification

1:Support set
$S_{i}=\left\\{\left(\left.x_{ij}^{s},y_{i}^{s}\right)\right.\right\\}$, query
set $Q=\left\\{\left(x_{k}^{q},y_{k}^{q}\right)\right\\}$, class-words
$w_{i}$, $i=1,...N$, $j=1,...K$,
$\mathcal{R}=\left\\{r_{i};i=1,...,N\right\\}$

2:The joint learning objective function $\mathcal{L}_{Joint}$ in an episode.

3:for all samples $x_{ij}^{s}$ in class $i$ do

4: Obtain the support prototype for class $i$ by feeding the support instances
into the prototypical networks in Eq. (5);

5: Obtain the semantic vector for class $i$ by feeding its words into a word
embedding model in Eq. (9);

6: Compute the coefficient of the semantic vector in Eq. (8);

7: Obtain the class prototype for class $i$ in Eq. (7);

8: Calculate the probability that belongs to class $i$ according to the
distance metric:
$p_{\theta}\left(y=r_{i}\left|x^{q}\right.\right)=\frac{\exp\left(-D\left(f_{\phi}\left(x^{q}\right),p_{i}^{\prime}\right)\right)}{\sum\limits_{l=1}^{\left|R\right|}{\exp\left(-D\left(f_{\phi}\left(x^{q}\right),p_{l}^{\prime}\right)\right)}}$

9: Compute the representation loss by finding the farthest positive instance
and the nearest negative instance to each sample in the support set and query
set in Eq. (10);

10: Obtain the final objective function by combining the cross-entropy of the
classification objective function Eq. (12);

11:end for

##  V Experimental settings

We describe the experimental settings in this section, beginning with
introducing the dataset and learning configurations, followed by detailed
implementation details of the models.

###  V-A Dataset and learning configurations

In this work, we evaluate our model on the only FSRC dataset reported in the
literature, FewRel, which is first generated by distant supervision and then
filtered by crowdsourcing to remove noisy annotations. It consists of 70000
instances on 100 relations derived from Wikipedia, and each relation includes
700 instances. And both head and tail entities are marked in each sentence.
Note, however, that only 80 relations are available, of which 48 are used for
the training set, 12 for the verification, and 20 for test in the following
comparative studies. In our experiments, we investigate four few-shot learning
configurations, namely 5 way 1 shot, 5 way 5 shot, 10 way 1 shot, and 10 way 5
shot, which are the same for the proposed algorithm and the compared
baselines. All results are averaged over ten independent runs.

###  V-B Implementation details

TABLE II: Hyperparameters of the models built in our experiments. Component | Parameter | Value
---|---|---
Embedding | Word embedding dimension $d_{w}$ | 50
Position embedding dimension $d_{p}$ | 5
Encoder | Hidden layer dimension $d_{h}$ | 230
Convolutional Window Size $u$ | 3
Max length $T$ | 40
Joint loss | Margin $m$ | 0.5
Alpha $\alpha$ | 1
Optimization | Initial Learning Rate | 0.1
Weight Decay | 10-5
Dropout rate | 0.2

All hyperparameters of each part of our model are listed in Table II. We tune
the rest hyperparameters of all models by grid search using the validation
set, and all models are trained on the training set. Finally, the models
achieving the best validation performance are saved to be tested on the test
set. It has been found in [24] that feeding more classes to the models may
achieve better performances than using the same configurations at both
training and testing stages. Accordingly, we set $N=20$ to construct the
support set in each training episode. Actually, the training episode is built
by first randomly selecting a subset of relations from the training set, then
sampling a subset of instances within each selected relation to build the
support set, and the remainder is sampled to build the query set. For fair
comparisons, we use the same word embeddings pre-trained by Glove [40]
consisting of 6B tokens and 400K vocabularies, and the dimension of word
embeddings is 50. In addition, the position embedding dimension of a word is
add up to 10, the maximum length of each instance is 40, and the same encoder
is used for both support and query instances. All experiments are based on the
$N-wayK-shot$ setting and we employ the mini-batch stochastic gradient descent
(SGD) to solve the optimization problem.

##  VI Results and analysis

In this section, we will demonstrate the effectiveness of the proposed APN-LW-
JRL on the FSRC task, followed by ablation studies. Finally, the visualization
of sentence embeddings, the extension of support set and case study are
respectively presented to show the validity of the proposed model.

###  VI-A Compared algorithms

To verify the effectiveness of APN-LW-JRL, we compare it with the following
most state-of-the-art algorithms for FSRC:

Meta Network [24]: A novel meta-learning method that combines slow weights and
fast weights for prediction.

  * •

GNN [28]: A graph neural network that encodes each instance in support set and
query set as a node in the graph for FSL.

  * •

SNAIL [23]: A meta-learning model that uses temporal convolutional neural
networks and attention mechanisms to quickly learn from past experience.

  * •

ProNet [27]: A model based on metric learning, which assumes that each class
can be represented by a prototype.

  * •

Pro-HATT [32]: A hybrid attention-based prototypical network consists of
instance-level and feature-level attention schemes.

###  VI-B Comparative results

TABLE III: Accuracies ($\%$) of different models on the divided FewRel test set under four different settings. Here, APN stands for adaptive prototypical networks, LW for label words, and JRL for joint representation learning. Model | 5 Way 1 Shot | 5 Way 5 Shot | 10 Way 1 Shot | 10 Way 5 Shot
---|---|---|---|---
Meta Network | $57.89\pm 0.63$ | $71.02\pm 0.45$ | $42.01\pm 0.12$ | $53.87\pm 0.32$
GNN | $67.30\pm 0.91$ | $79.47\pm 0.61$ | $52.84\pm 0.58$ | $69.63\pm 0.21$
SNAIL | $66.28\pm 0.24$ | $78.07\pm 0.12$ | $53.72\pm 0.10$ | $62.88\pm 0.33$
ProNet | $70.63\pm 0.55$ | $85.10\pm 0.22$ | $57.52\pm 0.91$ | $74.74\pm 0.11$
Pro-HATT | $71.76\pm 0.63$ | $86.01\pm 0.33$ | $59.22\pm 0.21$ | $75.21\pm 0.32$
APN-LW | $72.57\pm 0.44$ | $86.29\pm 0.15$ | $59.44\pm 0.35$ | $76.32\pm 0.05$
APN-LW-JRL | $\mathbf{73.45\pm 0.83}$ | $\mathbf{87.27\pm 0.55}$ | $\mathbf{61.02\pm 0.61}$ | $\mathbf{77.69\pm 0.22}$

The comparative results are presented Table III. From these results, we can
make the following observations:

  * •

APN-LW-JRL outperforms ProNet under the four different FSL settings, which is
a simple but powerful baseline for few-shot learning and is also the basis of
our model. Comparing ProNet and APN-LW, APN-LW and APN-LW-JRL, we can clearly
see the effectiveness of introducing label words and joint training of
classification and representation.

  * •

Strikingly, APN-LW-JRL also achieves better results compared with the other
prototypical networks-based models, Pro-HATT, verifying the feasibility of
considering prototypical networks in an adaptive way, even better than
integrating various attention mechanisms. On the one hand, the adaptive label
information mixture mechanism proposed in this work can leverage the
information advantages of two aspects and adjust its focus accordingly. On the
other hand, benefiting from adaptive joint training for class prototype, our
model allows to perform end-to-end learning between the input instances and
the desired embedding space.

  * •

APN-LW-JRL has shown significantly better results than Meta Network, GNN and
SNAIL, which are the state-of-the-art learning models. This indicates that
APN-LW-JRL is effective and the two adaptation mechanisms we introduced both
make contributions to improve the performance.

###  VI-C Effects of adaptive prototypical networks

TABLE IV: Accuracies ($\%$) of all models for ablation study on the divided FewRel test set under four different settings. Model | 5 Way 1 Shot | 5 Way 5 Shot | 10 Way 1 Shot | 10 Way 5 Shot
---|---|---|---|---
APN-LD | $71.78\pm 0.31$ | $85.82\pm 0.20$ | $59.20\pm 0.11$ | $75.70\pm 0.41$
APN-LW | $72.57\pm 0.44$ | $86.29\pm 0.15$ | $59.44\pm 0.35$ | $76.32\pm 0.05$
APN-LD-JRL | $73.18\pm 0.22$ | $86.97\pm 0.31$ | $60.67\pm 0.52$ | $77.09\pm 0.16$
ProNet-PJRL | $71.63\pm 0.35$ | $86.20\pm 0.72$ | $58.92\pm 0.15$ | $76.23\pm 0.66$
APN-LW-PJRL | $72.56\pm 0.11$ | $86.55\pm 0.56$ | $59.80\pm 0.22$ | $76.99\pm 0.61$
ProNet-JRL | $72.98\pm 0.23$ | $86.62\pm 0.45$ | $60.25\pm 0.12$ | $76.43\pm 0.35$
APN-LW-JRL | $\mathbf{73.45\pm 0.83}$ | $\mathbf{87.27\pm 0.55}$ | $\mathbf{61.02\pm 0.61}$ | $\mathbf{77.69\pm 0.22}$
Figure 3:  Visualization of sentence embeddings of a 5-way-20-shot scenario in
the divided FewRel test set, where one point represents one instance and
different colors correspond to different categories.

In this section, ablation studies were conducted to evaluate the contributions
of the individual model components. Variants of the proposed algorithm, APN
and ProNet are designed to verify the respective function of the adaptive
label information mixture mechanism and adaptive joint representation learning
for class prototype.

  * •

APN-LD: The proposed adaptive label information mixture mechanism based on
label description.

  * •

APN-LD-JRL: The proposed adaptive label information mixture mechanism based on
label description with adaptive joint representation learning based on the
sample triplets.

  * •

ProNet-JRL: ProNet [27] model with the proposed adaptive joint representation
learning based on the sample triplets.

  * •

ProNet-PJRL: ProNet [27] model with the proposed adaptive joint representation
learning based on the prototype triplets.

  * •

APN-LW: The proposed adaptive label information mixture mechanism based on
label words.

  * •

APN-LW-PJRL: The proposed adaptive label information mixture mechanism based
on label words with adaptive joint representation learning based on the
prototype triplets.

  * •

APN-LW-JRL: The proposed adaptive label information mixture mechanism based on
label words with adaptive joint representation learning based on the sample
triplets.

Table IV shows the performance of our model and its ablations on the divided
FewRel test set. By comparing the three models of ProNet (in Table III), APN-
LD and APN-LW, we can find that the adaptive label information mixture
mechanism exhibits a positive influence on the expression of class prototypes.
Here, LD denotes label description and its representation is obtained by the
same encoder as the instance. Comparing APN-LD and APN-LW, we find that LD,
which is much longer than LW, is not as good as LW. This is contrary to the
intuitive belief that the longer the text, the richer information it contains.
We take a closer look at the dataset and find that this might be attributed to
the fact that the descriptions of some categories are too metaphysical. It may
cause deviation or redundancy when the description is used to represent the
label information. For example, the LW “residence” is more idiographic than
the LD “the place where the person is or has been”, which helps to get a
better class prototype. At the same time, the result of comparing APN-LD-JRL
and APN-LW-JRL can also be used as convincing evidence in support of this
argument.

In addition, we also compare ProNet and ProNet-JRL, APN-LW and APN-LW-JRL,
respectively, from which we can conclude that the adaptive joint
representation learning method we proposed demonstrates an excellent end-to-
end deep metric learning capability. PJRL here means that for each sample as
an anchor, the farthest class prototype with the same label is chosen as
positive, while the nearest class prototype with a different label is chosen
as negative to form the triplets. Clearly, the generalization performance of
selecting the triples with the class prototype as the target is not as strong
as the sample-targeting, because the selection of samples to form the triples
is more extensive, which can be concluded by comparing with ProNet-PJRL and
ProNet-JRL, APN-LW-PJRL and APN-LW-JRL.

Furthermore, we visualize an episode set of sentences from the divided FewRel
test set to gain more insight into the model performance. It can be seen from
Fig. 3 that as adaptive mixture mechanism and adaptive joint representation
learning play an increasing role, APN-LW-JRL is able to learn more
discriminative sentence embeddings, making it more capable of distinguishing
confusing data than those of the previous ablation models. We attribute this
capability to the rich feature expression of the adaptive mixture mechanism
and the moderate spatial embedding learning of adaptive joint representation
learning, which increases the distance between different classes and reduces
the distance within the same class.

###  VI-D Extension of support set

Figure 4:  Comparison of performance of Proto, Pro-HATT and APN-LW-JRL for different data extensions of the support set on the divided FewRel test set. On the left, the value of the way is fixed to 10, and the accuracy changes with the shot. On the right, the value of the shot is fixed to 5, and the accuracy changes with the way. Each small vertical line segment on the curve represents an error interval of multiple experiments.  TABLE V: Accuracies ($\%$) of Proto, PHATT and HAPN in different data extensions of the support set on the divided FewRel test set. | 10-way K-Shot Accuracy ($\%$)
---|---
K | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
ProNet | 74.92 | 76.02 | 76.79 | 77.36 | 77.84 | 78.29 | 78.61 | 78.95 | 79.16 | 79.41 | 79.57
Pro-HATT | 75.83 | 77.02 | 77.81 | 78.51 | 79.01 | 79.39 | 79.83 | 80.06 | 80.34 | 80.52 | 80.73
APN-LW-JRL | 77.16 | 78.27 | 78.98 | 79.54 | 80.03 | 80.46 | 80.70 | 80.98 | 81.24 | 81.43 | 81.61
| N-way 5-Shot Accuracy ($\%$)
N | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
ProNet | 85.58 | 83.12 | 80.82 | 78.84 | 76.96 | 75.27 | 73.78 | 72.28 | 70.87 | 69.53 | 68.31
Pro-HATT | 86.31 | 83.86 | 81.71 | 79.72 | 77.94 | 76.28 | 74.79 | 73.22 | 71.95 | 70.71 | 69.50
APN-LW-JRL | 87.66 | 85.37 | 83.33 | 81.40 | 79.77 | 78.13 | 76.62 | 75.29 | 73.95 | 72.75 | 71.54

It is recognized that more support instances can provide more useful
information to the prototype vector, but more noise may be added in as well.
In this section, to study how the number of categories and samples in the
support set will affect the performance of different models, we define an
extension of the support set as the additive value of accuracy. First, $K$ is
changed from 5 to 15, when $N$ to 10. Then, the range of $N$ is also 5-15 when
$K$ is fixed to 5. As shown in Fig. 4 and Table V, given the same extension
setting, the proposed model shows much better performance than other
benchmarks. It also verifies that the way we increase the data utilization is
beneficial to improve the robustness and generalization capability of our
model.

###  VI-E Case studies

TABLE VI: Some specific results of relation classification examples from FewRel dataset. The head entity and the tail entity are marked as blue and red respectively in each instance. Label | Sentence | ProNet | APN-LW | APN-LW-JRL
---|---|---|---|---
| ”P1001”:
---
Applies to jurisdiction
| Macelod was a territorial electoral district for
---
the Legislative Assembly of Northwest Territories,
Canada.
| Location of formation
---
(False)
| Applies to jurisdiction
---
(True)
| Applies to jurisdiction
---
(True)
| ”P463”:
---
Member of
| South Africa is part of the IBSA Dialogue Forum,
---
alongside Brazil and India.
| Part of
---
(False)
| Member of
---
(True)
| Member of
---
(True)
| ”P937”:
---
Work location
| She lives in Montreal and is the common - law partner
---
of novelist Rawi Hage.
| Residence
---
(False)
| Work location
---
(True)
| Work location
---
(True)
| ”P355”:
---
Subsidiary
| Hotel Indigo competes with Starwood ’s W Hotels as
---
well as Andaz Hotels, Aloft Hotels and Le Meridien
Hotels.
| Has part
---
(False)
| Subsidiary
---
(True)
| Subsidiary
---
(True)
| ”P1435”:
---
Heritage designation
| Hampton Hill, John Thompson House, Twin Trees Farm,
---
and Willow Mill Complex are listed on the National
Register of Historic Places.
| Instance of
---
(False)
| Applies to jurisdiction
---
(False)
| Heritage designation
---
(True)

In order to better understand why the proposed model outperforms the compared
ones, we selected a few examples from the divided FewRel test set and analyze
their classification results. Table VI shows five instances on which ProNet
has failed while our model has correctly predicted. Take the second query
instance in Table VI as an example, ProNet predicts this incorrectly into
“Part of”, while our model classifies accurately. This instance is quite
challenging since the expressions of these two relations are very similar.
From these instances, we can conclude that it is of great importance to update
both the way of class prototype generation and the learning target of the
original prototypical networks, as done in our model.

##  VII Conclusion and Future Work

Metric learning based FSL task aims to learn a set of projection functions
that take support and query samples from the target problem, which is heavily
dependent on the quality of the embedding space. Therefore, to maximize the
efficiency of existing information resources and achieve a better class
prototype, we improve the prototypical networks in an adaptive manner, which
consists of a label information mixture mechanism and a joint representation
learning method for FSRC task. It can appropriately weigh the importance of
support samples and label information to make adaptive adjustments and learn a
more discriminative prototype representation. Comparative studies have been
conducted on FewRel under different FS settings, from which we can conclude
that our proposed APN-LW-JRL is successful in improving the classification
performance of few-shot RC models.

In this work, label information of the data is made use of to improve the
performance of the proposed APN-LW-JRL and the proposed algorithm is tested on
the FewRel data set only. In the future, we will extend the model to zero-shot
learning and validate its performance on additional text datasets. In
addition, we are going to investigate the use of few shot learning for joint
relation extraction of named entity recognition (NER) and relation
classification (RC), and its application to medical and other real-world
problems.

## References

  * [1] D. Zeng, K. Liu, S. Lai, G. Zhou, and J. Zhao, “Relation classification via convolutional deep neural network,” in _Proceedings of COLING 2014, the 25th International Conference on Computational Linguistics: Technical Papers_ , 2014, pp. 2335–2344.
  * [2] M. Mintz, S. Bills, R. Snow, and D. Jurafsky, “Distant supervision for relation extraction without labeled data,” in _Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP_ , 2009, pp. 1003–1011.
  * [3] S. Carey and E. Bartlett, “Acquiring a single new word,” _Papers and Reports on Child Language Development_ , vol. 15, pp. 17–29, 1978.
  * [4] S. J. Pan and Q. Yang, “A survey on transfer learning,” _IEEE Transactions on Knowledge and Data Engineering_ , vol. 22, no. 10, pp. 1345–1359, 2009.
  * [5] C. Finn, P. Abbeel, and S. Levine, “Model-agnostic meta-learning for fast adaptation of deep networks,” _arXiv preprint arXiv:1703.03400_ , 2017.
  * [6] X. Han, H. Zhu, P. Yu, Z. Wang, Y. Yao, Z. Liu, and M. Sun, “Fewrel: A large-scale supervised few-shot relation classification dataset with state-of-the-art evaluation,” _arXiv preprint arXiv:1810.10147_ , 2018.
  * [7] F. Schroff, D. Kalenichenko, and J. Philbin, “Facenet: A unified embedding for face recognition and clustering,” in _Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition_ , 2015, pp. 815–823.
  * [8] R. Bunescu and R. Mooney, “A shortest path dependency kernel for relation extraction,” in _Proceedings of Human Language Technology Conference and Conference on Empirical Methods in Natural Language Processing_ , 2005, pp. 724–731.
  * [9] D. Zelenko, C. Aone, and A. Richardella, “Kernel methods for relation extraction,” _Journal of Machine Learning Research_ , vol. 3, no. Feb, pp. 1083–1106, 2003.
  * [10] N. Kambhatla, “Combining lexical, syntactic, and semantic features with maximum entropy models for extracting relations,” in _Proceedings of the ACL 2004 on Interactive Poster and Demonstration Sessions_ , 2004, pp. 22–es.
  * [11] P. Qin, W. Xu, and J. Guo, “An empirical convolutional neural network approach for semantic relation classification,” _Neurocomputing_ , vol. 190, pp. 1–9, 2016.
  * [12] L. Wang, Z. Cao, G. De Melo, and Z. Liu, “Relation classification via multi-level attention cnns,” in _Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , 2016, pp. 1298–1307.
  * [13] Z. Geng, G. Chen, Y. Han, G. Lu, and F. Li, “Semantic relation extraction using sequential and tree-structured lstm with attention,” _Information Sciences_ , vol. 509, pp. 183–192, 2020.
  * [14] P. Zhou, W. Shi, J. Tian, Z. Qi, B. Li, H. Hao, and B. Xu, “Attention-based bidirectional long short-term memory networks for relation classification,” in _Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)_ , 2016, pp. 207–212.
  * [15] L. B. Soares, N. FitzGerald, J. Ling, and T. Kwiatkowski, “Matching the blanks: Distributional similarity for relation learning,” _arXiv preprint arXiv:1906.03158_ , 2019.
  * [16] Y. Lin, S. Shen, Z. Liu, H. Luan, and M. Sun, “Neural relation extraction with selective attention over instances,” in _Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , 2016, pp. 2124–2133.
  * [17] Y. Xiao, Y. Jina, R. Cheng, and K. Hao, “Hybrid attention-based transformer block model for distant supervision relation extraction,” _arXiv preprint arXiv:2003.11518_ , 2020.
  * [18] J. Feng, M. Huang, L. Zhao, Y. Yang, and X. Zhu, “Reinforcement learning for relation classification from noisy data,” _arXiv preprint arXiv:1808.08013_ , 2018.
  * [19] P. Qin, W. Xu, and W. Y. Wang, “Dsgan: Generative adversarial training for distant supervision relation extraction,” _arXiv preprint arXiv:1805.09929_ , 2018.
  * [20] Y. Wang, Q. Yao, J. T. Kwok, and L. M. Ni, “Generalizing from a few examples: A survey on few-shot learning,” _ACM Computing Surveys (CSUR)_ , vol. 53, no. 3, pp. 1–34, 2020.
  * [21] R. Caruana, “Learning many related tasks at the same time with backpropagation,” in _Advances in Neural Information Processing Systems_ , 1995, pp. 657–664.
  * [22] Y. Bengio, “Deep learning of representations for unsupervised and transfer learning,” in _Proceedings of ICML Workshop on Unsupervised and Transfer Learning_ , 2012, pp. 17–36.
  * [23] N. Mishra, M. Rohaninejad, X. Chen, and P. Abbeel, “A simple neural attentive meta-learner,” _arXiv preprint arXiv:1707.03141_ , 2017.
  * [24] T. Munkhdalai and H. Yu, “Meta networks,” _Proceedings of Machine Learning Research_ , vol. 70, p. 2554, 2017.
  * [25] G. Koch, R. Zemel, and R. Salakhutdinov, “Siamese neural networks for one-shot image recognition,” in _ICML Deep Learning Workshop_ , vol. 2. Lille, 2015.
  * [26] O. Vinyals, C. Blundell, T. Lillicrap, D. Wierstra _et al._ , “Matching networks for one shot learning,” _Advances in Neural Information Processing Systems_ , vol. 29, pp. 3630–3638, 2016.
  * [27] J. Snell, K. Swersky, and R. Zemel, “Prototypical networks for few-shot learning,” _Advances in Neural Information Processing Systems_ , vol. 30, pp. 4077–4087, 2017.
  * [28] V. Garcia and J. Bruna, “Few-shot learning with graph neural networks,” _arXiv preprint arXiv:1711.04043_ , 2017.
  * [29] J. Bai, A. Yuan, Z. Xiao, H. Zhou, D. Wang, H. Jiang, and L. Jiao, “Class incremental learning with few-shots based on linear programming for hyperspectral image classification,” _IEEE Transactions on Cybernetics_ , 2020.
  * [30] J. Lu, S. Jin, J. Liang, and C. Zhang, “Robust few-shot learning for user-provided data,” _IEEE Transactions on Neural Networks and Learning Systems_ , 2020.
  * [31] N. Lai, M. Kan, C. Han, X. Song, and S. Shan, “Learning to learn adaptive classifier-predictor for few-shot learning,” _IEEE Transactions on Neural Networks and Learning Systems_ , 2020.
  * [32] T. Gao, X. Han, Z. Liu, and M. Sun, “Hybrid attention-based prototypical networks for noisy few-shot relation classification,” in _Proceedings of the AAAI Conference on Artificial Intelligence_ , vol. 33, 2019, pp. 6407–6414.
  * [33] S. Sun, Q. Sun, K. Zhou, and T. Lv, “Hierarchical attention prototypical networks for few-shot text classification,” in _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , 2019, pp. 476–485.
  * [34] Y. Bengio, A. Courville, and P. Vincent, “Representation learning: A review and new perspectives,” _IEEE Transactions on Pattern Analysis and Machine Intelligence_ , vol. 35, no. 8, pp. 1798–1828, 2013.
  * [35] G. Elsayed, D. Krishnan, H. Mobahi, K. Regan, and S. Bengio, “Large margin deep networks for classification,” _Advances in Neural Information Processing Systems_ , vol. 31, pp. 842–852, 2018.
  * [36] J. Sokolić, R. Giryes, G. Sapiro, and M. R. Rodrigues, “Robust large margin deep neural networks,” _IEEE Transactions on Signal Processing_ , vol. 65, no. 16, pp. 4265–4280, 2017.
  * [37] W. Liu, Y. Wen, Z. Yu, and M. Yang, “Large-margin softmax loss for convolutional neural networks.” in _ICML_ , vol. 2, no. 3, 2016, p. 7.
  * [38] Y. Wang, X.-M. Wu, Q. Li, J. Gu, W. Xiang, L. Zhang, and V. O. Li, “Large margin few-shot learning,” _arXiv preprint arXiv:1807.02872_ , 2018.
  * [39] A. Hermans, L. Beyer, and B. Leibe, “In defense of the triplet loss for person re-identification,” _arXiv preprint arXiv:1703.07737_ , 2017.
  * [40] J. Pennington, R. Socher, and C. D. Manning, “Glove: Global vectors for word representation,” in _Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , 2014, pp. 1532–1543.


# Finite Sample Performance of a Conduct Parameter Test in Homogenous Goods
Markets

Yuri Matsumura Department of Economics, Rice University. Email:
<EMAIL_ADDRESS>Suguru Otani Department of Economics, Rice University.
Email<EMAIL_ADDRESS>
Declarations of interest: none

###### Abstract

We assess the finite sample performance of the conduct parameter test in
homogeneous goods markets. Statistical power rises with an increase in the
number of markets, a larger conduct parameter, and a stronger demand rotation
instrument. However, even with a moderate number of markets and five firms,
regardless of instrument strength and the utilization of optimal instruments,
rejecting the null hypothesis of perfect competition remains challenging. Our
findings indicate that empirical results that fail to reject perfect
competition are a consequence of the limited number of markets rather than
methodological deficiencies.

Keywords: Conduct parameters, Homogenous goods market, Monte Carlo simulation,
Statistical power analysis
JEL Codes: C5, C12, L1

##  1 Introduction

Measuring competitiveness is important in the empirical industrial
organization literature. A conduct parameter is considered to be a useful
measure of competitiveness. However, the parameter cannot be directly measured
from data because data generally lack information about marginal costs.
Therefore, researchers endeavor to learn conduct parameters.

Researchers estimate and test structural models to understand firm conduct in
both homogeneous and differentiated good markets (Nevo 1998, Magnolfi and
Sullivan 2022, Duarte et al. 2023). We focus on homogenous good markets. The
conduct parameters for the linear model are identified by Bresnahan (1982),
and Matsumura and Otani (2023b) resolve conflicts between Bresnahan (1982) and
Perloff and Shen (2012) vis-a-vis identification problems. Estimation accuracy
may be improved by adding equilibrium existence conditions in the log-linear
model (Matsumura and Otani 2023a). Conduct parameter testing is undertaken by
Genesove and Mullin (1998), who compare estimates from the sugar industry with
direct measures of market power.111Genesove and Mullin (1998) made mistakes on
how to get predicted interaction terms of rotation demand instruments and
endogenous quantity in the first stage regression. See Section A.3, Matsumura
and Otani (2023b). When market power is around 0.1 and the number of markets
is less than 100, perfect competition cannot be rejected. Clay and Troesken
(2003) investigate the robustness of specifications using 38 whiskey markets
and find that estimation is sensitive to model specification. Steen and
Salvanes (1999) study 48 markets in the French salmon industry and Shaffer
(1993) studies 25 markets in the Canadian banking industry. They also cannot
reject the null hypothesis that markets are perfectly competitive. Their
results raise doubts about the methodology in itself (Shaffer and Spierdijk
2017).

Recent literature on conduct parameter estimation and test in homogenous goods
markets like an electricity generation industry follows Genesove and Mullin
(1998) and proceeds with a comparison of estimated conduct parameters with
directly measured ones through price-cost markups recovered from observed
prices and marginal costs data. Wolfram (1999) studies the British electricity
industry using 25,639 samples and finds that the directly measured conduct
parameter is about 0.05 and the estimated conduct parameter is 0.01. So, the
author cannot reject the null hypothesis of perfect competition. Kim and
Knittel (2006) study California electricity markets using 21,104 samples and
find that Bresnahan’s technique overstates marginal costs on average and is
likely to reject the null hypothesis of perfect competition. Puller (2007)
uses 163 to 573 samples and cannot reject the null hypothesis of Cournot
competition for the same industry. The robustness of the data and methodology
has been extensively tested in previous studies focusing on market power in
the California electricity market (for example, Borenstein et al. (2002),
Wolak (2003), and Orea and Steinbuks (2018)).

While popular, there is a lack of formal Monte Carlo simulations for a conduct
parameter test. The lack prevents us from understanding the above comparison
properly. Accordingly, we investigate the finite sample performance of the
conduct parameter test in homogeneous goods markets. We analyze statistical
power by varying the number of markets, firms, and strength of demand rotation
instruments under the null hypothesis of perfect competition.

Our findings indicate that statistical power increases with more markets, a
larger conduct parameter, and stronger demand rotation instruments. However,
even with a moderate number of markets (e.g., 1000) and five firms, we cannot
achieve an 80% rejection frequency ($1-\beta=0.8$, where $\beta$ represents
the probability of a Type II error), irrespective of instrument strength and
the use of optimal instruments. While optimal instruments enhance rejection
probability in large samples, they do not alter the core findings. This
highlights the challenge of testing perfect competition, as recognized by
Genesove and Mullin (1998), Steen and Salvanes (1999), and Shaffer (1993),
primarily stemming from the limited number of markets rather than
methodological flaws.

Our results and code provide a valuable reference for applied researchers
examining assumptions about firm conduct in homogeneous goods markets, i.e.,
whether it is perfect competition, Cournot competition, or perfect collusion.

##  2 Model

Consider data with $T$ markets with homogeneous products. Assume that there
are $N$ firms in each market. Let $t=1,\ldots,T$ be the index for markets.
Then, we obtain a supply equation:

$\displaystyle P_{t}=-\theta\frac{\partial P_{t}(Q_{t})}{\partial
Q_{t}}Q_{t}+MC_{t}(Q_{t}),$ (1)

where $Q_{t}$ is the aggregate quantity, $P_{t}(Q_{t})$ is the demand
function, $MC_{t}(Q_{t})$ is the marginal cost function, and $\theta\in[0,1]$
is the conduct parameter. The equation nests perfect competition ($\theta=0$),
Cournot competition ($\theta=1/N$), and perfect collusion ($\theta=1$) (See
Bresnahan (1982)).

Consider an econometric model integrating the above. Assume that the demand
and marginal cost functions are written as:

$\displaystyle P_{t}=f(Q_{t},Y_{t},\varepsilon^{d}_{t},\alpha),$ (2)
$\displaystyle MC_{t}=g(Q_{t},W_{t},\varepsilon^{c}_{t},\gamma),$ (3)

where $Y_{t}$ and $W_{t}$ are vectors of exogenous variables,
$\varepsilon^{d}_{t}$ and $\varepsilon^{c}_{t}$ are error terms, and $\alpha$
and $\gamma$ are vectors of parameters. Additionally, we have demand- and
supply-side instruments, $Z^{d}_{t}$ and $Z^{c}_{t}$, and assume that the
error terms satisfy the mean independence conditions,
$E[\varepsilon^{d}_{t}\mid Y_{t},Z^{d}_{t}]=E[\varepsilon^{c}_{t}\mid
W_{t},Z^{c}_{t}]=0$.

###  2.1 Linear demand and cost

Assume that linear demand and marginal cost functions are specified as:

$\displaystyle P_{t}$
$\displaystyle=\alpha_{0}-(\alpha_{1}+\alpha_{2}Z^{R}_{t})Q_{t}+\alpha_{3}Y_{t}+\varepsilon^{d}_{t},$
(4) $\displaystyle MC_{t}$
$\displaystyle=\gamma_{0}+\gamma_{1}Q_{t}+\gamma_{2}W_{t}+\gamma_{3}R_{t}+\varepsilon^{c}_{t},$
(5)

where $W_{t}$ and $R_{t}$ are exogenous cost shifters and $Z^{R}_{t}$ is
Bresnahan’s demand rotation instrument. The supply equation is written as:

$\displaystyle P_{t}$
$\displaystyle=\gamma_{0}+\theta(\alpha_{1}+\alpha_{2}Z^{R}_{t})Q_{t}+\gamma_{1}Q_{t}+\gamma_{2}W_{t}+\gamma_{3}R_{t}+\varepsilon^{c}_{t}.$
(6)

By substituting (4) with (6) and solving it for $P_{t}$, we obtain the
aggregate quantity $Q_{t}$ based on the parameters and exogenous variables as
follows:

$\displaystyle
Q_{t}=\frac{\alpha_{0}+\alpha_{3}Y_{t}-\gamma_{0}-\gamma_{2}W_{t}-\gamma_{3}R_{t}+\varepsilon^{d}_{t}-\varepsilon^{c}_{t}}{(1+\theta)(\alpha_{1}+\alpha_{2}Z^{R}_{t})+\gamma_{1}}.$
(7)

##  3 Simulation results

###  3.1 Simulation and estimation procedure

We set true parameters and distributions as shown in Table 1. We vary the true
value of $\theta$ from 0.05 (20-firm symmetric Cournot) to 1 (perfect
collusion) and the strength of demand rotation instrument, $\alpha_{2}$, from
0.1 (weak) to 20.0 (extremely strong) which is unrealistically larger than the
price coefficient level, $\alpha_{1}=1.0$. For simulation, we generate 100
datasets. We separately estimate the demand and supply equations via two-stage
least squares (2SLS) estimation. The instrumental variables for demand
estimation are $Z^{d}_{t}=(1,Z^{R}_{t},Y_{t},H_{t},K_{t})$ and for supply
estimation are $Z^{c}_{t}=(1,Z^{R}_{t},W_{t},R_{t},Y_{t})$ for a benchmark
model. To achieve theoretical efficiency bounds, we add optimal instruments of
Chamberlain (1987), used in demand estimation (Reynaert and Verboven 2014).
Optimal instruments lead to asymptotically efficient estimators, as their
asymptotic variance cannot be reduced via additional orthogonality conditions.
See Appendix A.2 for construction details. The null hypothesis is that markets
are under perfect competition, that is, $\theta=0$. We compute the rejection
frequency as the power by using t-statistics at a significance level of 0.05
over 100 datasets.

Table 1: True parameters and distributions

$\alpha_{0}$ | $10.0$
---|---
$\alpha_{1}$ | $1.0$
$\alpha_{2}$ | $\\{0.1,0.5,1.0,5.0,20.0\\}$
$\alpha_{3}$ | $1.0$
$\gamma_{0}$ | $1.0$
$\gamma_{1}$ | $1.0$
$\gamma_{2}$ | $1.0$
$\gamma_{3}$ | $1.0$
$\theta$ | $\\{0.05,0.1,0.2,0.33,0.5,1.0\\}$
(a)

Demand shifter |  |
---|---|---
$Y_{t}$ | $N(0,1)$ |
Demand rotation instrument |  |
$Z^{R}_{t}$ | $N(10,1)$ |
Cost shifter |  |
$W_{t}$ | $N(3,1)$ |
$R_{t}$ | $N(0,1)$ |
$H_{t}$ | $W_{t}+N(0,1)$ |
$K_{t}$ | $R_{t}+N(0,1)$ |
Error |  |
$\varepsilon^{d}_{t}$ | $N(0,\sigma)$ |
$\varepsilon^{c}_{t}$ | $N(0,\sigma)$ |
(b)

Note: $\sigma=1.0$. $N:$ Normal distribution. $U:$ Uniform distribution.

Figure 1 displays the finite sample performance results for the conduct
parameter $\theta$.222Simulation details and additional results for all other
parameters are available in the online appendix. Rejection frequency increases
under the following conditions: a large sample size (number of markets), a
larger $\theta$ (fewer firms), and a larger $\alpha_{2}$ (stronger demand
rotation instrument). Panel (f) indicates that with 20 symmetric firms
($\theta=0.05$) and a sufficiently large number of markets, we achieve an
approximately 70% power to reject the null hypothesis of markets operating
under perfect competition. However, we cannot reject the null hypothesis with
an acceptable sample size and power when markets follow 20-firm symmetric
Cournot competition.

A remarkable finding is that even with a moderate number of markets (e.g.,
1000 in Panel (c)) and five firms, the rejection frequency cannot achieve 80%
(i.e., $1-\beta=0.8$, where $\beta$ is the probability of making a Type II
error), regardless of instrument strength. This implies that Genesove and
Mullin (1998), using 97 markets, Shaffer (1993), using 25 markets, and Steen
and Salvanes (1999), using 48 markets, fail in rejecting perfect competition
due to the small sample problem.

Figure 2 shows the efficiency gain of optimal instruments relative to the
aforementioned benchmark model. We find that if the number of markets exceeds
1,000, optimal instruments increase the rejection probability. However, the
gain does not change our benchmark results.

Why is it statistically challenging to differentiate between perfect and
Cournot competition? In differential product markets, as demonstrated by Berry
and Haile (2014), the variation in instrumental variables can aid in
discerning firm behavior. Various factors such as changes in the number of
products, prices in other markets, and alterations in product characteristics,
can be utilized without requiring a specific functional form. In contrast,
homogeneous product markets exhibit limited variation only on demand rotation
instruments. Therefore, even when the number of firms is substantial, firm
conduct tests may lack the necessary power to differentiate between perfect
and Cournot competition.

(a)

(b)

(c)

(d)

(e)

(f)

Figure 1: Statistical power of conduct parameter $\theta$

Note: Dotted lines are 80% and 100% rejection frequencies out of 100
simulation data.

(a)

(b)

(c)

(d)

(e)

(f)

Figure 2: Relative efficiency gain of optimal instruments

##  4 Conclusion

We perform a statistical power analysis for conduct parameter estimation.
Power rises with an increase in the number of markets, a larger conduct
parameter, and a stronger demand rotation instrument. Nevertheless, rejecting
the null hypothesis of markets operating under perfect competition remains
challenging, even with a moderate number of markets (e.g., 1000) and five
firms, regardless of instrument strength and the use of optimal instruments.
This reaffirms that the difficulty in testing perfect competition, as observed
by Genesove and Mullin (1998), Steen and Salvanes (1999), and Shaffer (1993),
is primarily attributed to the limited number of markets, rather than
methodological shortcomings.

#### Acknowledgments

We thank Jeremy Fox, Isabelle Perrigne, and Yuya Shimizu for their valuable
advice. This research did not receive any specific grant from funding agencies
in the public, commercial, or not-for-profit sectors.

## References

  * (1)
  * Berry and Haile (2014) Berry, Steven T and Philip A Haile, “Identification in differentiated products markets using market level data,” Econometrica, 2014, 82 (5), 1749–1797.
  * Borenstein et al. (2002) Borenstein, Severin, James B Bushnell, and Frank A Wolak, “Measuring market inefficiencies in California’s restructured wholesale electricity market,” American Economic Review, 2002, 92 (5), 1376–1405.
  * Bresnahan (1982) Bresnahan, Timothy F, “The oligopoly solution concept is identified,” Economics Letters, 1982, 10 (1-2), 87–92.
  * Chamberlain (1987) Chamberlain, Gary, “Asymptotic efficiency in estimation with conditional moment restrictions,” Journal of econometrics, 1987, 34 (3), 305–334.
  * Clay and Troesken (2003) Clay, Karen and Werner Troesken, “Further tests of static oligopoly models: Whiskey, 1882–1898,” The Journal of Industrial Economics, 2003, 51 (2), 151–166.
  * Duarte et al. (2023) Duarte, Marco, Lorenzo Magnolfi, Mikkel Sølvsten, and Christopher Sullivan, “Testing firm conduct,” arXiv preprint arXiv:2301.06720, 2023\.
  * Genesove and Mullin (1998) Genesove, David and Wallace P Mullin, “Testing static oligopoly models: conduct and cost in the sugar industry, 1890-1914,” The RAND Journal of Economics, 1998, pp. 355–377.
  * Hansen (2022) Hansen, Bruce, Econometrics, Princeton University Press, 2022.
  * Kim and Knittel (2006) Kim, Dae-Wook and Christopher R Knittel, “Biases in static oligopoly models? Evidence from the California electricity market,” The Journal of Industrial Economics, 2006, 54 (4), 451–470.
  * Magnolfi and Sullivan (2022) Magnolfi, Lorenzo and Christopher Sullivan, “A comparison of testing and estimation of firm conduct,” Economics Letters, 2022, 212, 110316\.
  * Matsumura and Otani (2023a) Matsumura, Yuri and Suguru Otani, “Conduct Parameter Estimation in Homogeneous Goods Markets with Equilibrium Existence and Uniqueness Conditions: The Case of Log-linear Specification,” Working Paper, 2023\.
  * Matsumura and Otani (2023b) and  , “Resolving the conflict on conduct parameter estimation in homogeneous goods markets between Bresnahan (1982) and Perloff and Shen (2012),” Economics Letters, 2023, p. 111193.
  * Nevo (1998) Nevo, Aviv, “Identification of the Oligopoly Solution Concept in a Differentiated-Products Industry,” Economics Letters, June 1998, 59 (3), 391–395.
  * Orea and Steinbuks (2018) Orea, Luis and Jevgenijs Steinbuks, “Estimating market power in homogenous product markets using a composed error model: application to the California electricity market,” Economic Inquiry, 2018, 56 (2), 1296–1321.
  * Perloff and Shen (2012) Perloff, Jeffrey M and Edward Z Shen, “Collinearity in linear structural models of market power,” Review of Industrial Organization, 2012, 40 (2), 131–138.
  * Puller (2007) Puller, Steven L, “Pricing and firm conduct in California’s deregulated electricity market,” The Review of Economics and Statistics, 2007, 89 (1), 75–87.
  * Reynaert and Verboven (2014) Reynaert, Mathias and Frank Verboven, “Improving the performance of random coefficients demand models: The role of optimal instruments,” Journal of Econometrics, 2014, 179 (1), 83–98.
  * Shaffer (1993) Shaffer, Sherrill, “A test of competition in Canadian banking,” Journal of Money, Credit and Banking, 1993, 25 (1), 49–61.
  * Shaffer and Spierdijk (2017) and Laura Spierdijk, “Market Power: Competition among Measures,” Handbook of Competition in Banking and Finance, 2017, pp. 11–26.
  * Steen and Salvanes (1999) Steen, Frode and Kjell G Salvanes, “Testing for market power using a dynamic oligopoly model,” International Journal of Industrial Organization, 1999, 17 (2), 147–177.
  * Wolak (2003) Wolak, Frank A, “Measuring unilateral market power in wholesale electricity markets: The California market, 1998–2000,” American Economic Review, 2003, 93 (2), 425–430.
  * Wolfram (1999) Wolfram, Catherine D, “Measuring duopoly power in the British electricity spot market,” American Economic Review, 1999, 89 (4), 805–826.

##  Appendix A Online appendix

###  A.1 Details for our simulation settings

To generate the simulation data, for each model, we first generate the
exogenous variables $Y_{t},Z^{R}_{t},W_{t},R_{t},H_{t}$, and $K_{t}$ and the
error terms $\varepsilon_{t}^{c}$ and $\varepsilon_{t}^{d}$ based on the data
generation process in Table 1. We compute the equilibrium quantity $Q_{t}$ for
the linear model by (7). We then compute the equilibrium price $P_{t}$ by
substituting $Q_{t}$ and other variables into the demand function (4).

We estimate the equations using the ivreg package in R. An important feature
of the model is that we have an interaction term of the endogenous variable
$Q_{t}$ and the instrumental variable $Z^{R}_{t}$. The ivreg package
automatically detects that the endogenous variables are $Q_{t}$ and the
interaction term $Z^{R}_{t}Q_{t}$, running the first stage regression for each
endogenous variable with the same instruments. To confirm this, we manually
write R code to implement the 2SLS model. When the first stage includes only
the regression of $Q_{t}$, estimation results from our code differ from the
results from ivreg. However, when we modify the code to regress
$Z^{R}_{t}Q_{t}$ on the instrument variables and estimate the second stage by
using the predicted values of $Q_{t}$ and $Z^{R}_{t}Q_{t}$, the result from
our code and the result from ivreg coincide.

###  A.2 Optimal instruments

We begin by introducing optimal instruments for a simultaneous equation model.
Subsequently, we move to supply-side estimation, as the simultaneous equation
model does not yield any additional efficiency advantage when the error terms
in the demand and supply equations are uncorrelated, as in our scenario.

We define demand and supply residuals as follows.

$\displaystyle\varepsilon^{d}_{t}(\xi)$
$\displaystyle=P_{t}-\alpha_{0}+(\alpha_{1}+\alpha_{2}Z^{R}_{t})Q_{t}-\alpha_{3}Y_{t},$
$\displaystyle\varepsilon^{c}_{t}(\xi)$
$\displaystyle=P_{t}-\gamma_{0}-\theta(\alpha_{1}+\alpha_{2}Z^{R}_{t})Q_{t}-\gamma_{1}Q_{t}-\gamma_{2}W_{t}-\gamma_{3}R_{t},$

where
$\xi=\left(\alpha_{0},\alpha_{1},\alpha_{2},\alpha_{3},\gamma_{0},\gamma_{1},\gamma_{2},\gamma_{3},\theta\right)$
is the $9\times 1$ parameter vector. Let $Z_{t}=(Z_{t}^{d},Z_{t}^{s})$ and
$\varepsilon_{t}(\xi)=(\varepsilon_{t}^{d}(\xi),\varepsilon_{t}^{s}(\xi))^{\prime}$.
We make the assumption that
$\Omega=E[\varepsilon_{t}\varepsilon_{t}^{\prime}|Z_{t}]$ is a constant
$2\times 2$ matrix, defining the covariance structure of the demand and supply
residuals. The optimal instrument matrix of Chamberlain (1987) is the $9\times
2$ matrix $g_{t}(Z_{t})=D_{t}(Z_{t})^{\prime}\Omega^{-1}$ where the $2\times
9$ matrix
$D_{t}(Z_{t})=E\left[\frac{\partial\varepsilon_{t}}{\partial\xi}|Z_{t}\right]$
is the conditional expectation of the derivative of the conditional moment
restrictions with respect to parameters $\xi$.

The conditional expectation $D_{t}(Z_{t})$ is difficult to compute, so most
applications have considered approximations. As in Reynaert and Verboven
(2014), we consider two types of approximation. The first approximation for
$D_{t}(Z_{t})$ takes a second-order polynomial of $Z_{t}$ for the demand side
instruments (first row of $D_{t}(Z_{t})$), i.e. cost shifters $W_{t}$ and
$R_{t}$, and their squares and interactions, and $W_{t}$ and $R_{t}$ for the
supply side instruments (second row of $D_{t}(Z_{t})$). The second
approximation for $D_{t}(Z_{t})$ implements the conditional expectation
written as

$\displaystyle D_{t}(Z_{t})$
$\displaystyle=E\left[\frac{\partial\varepsilon_{t}}{\partial\xi}|Z_{t}\right]$
$\displaystyle=\begin{pmatrix}&E\left[\frac{\partial\varepsilon_{t}^{d}(\xi)}{\partial\alpha^{\prime}}\mid
Z_{t}\right]&E\left[\frac{\partial\varepsilon_{t}^{d}(\xi)}{\partial\gamma^{\prime}}\mid
Z_{t}\right]&E\left[\frac{\partial\varepsilon_{t}^{d}(\xi)}{\partial\theta}\mid
Z_{t}\right]\\\
&E\left[\frac{\partial\varepsilon_{t}^{c}(\xi)}{\partial\alpha^{\prime}}\mid
Z_{t}\right]&E\left[\frac{\partial\varepsilon_{t}^{c}(\xi)}{\partial\gamma^{\prime}}\mid
Z_{t}\right]&E\left[\frac{\partial\varepsilon_{t}^{c}(\xi)}{\partial\theta}\mid
Z_{t}\right]\end{pmatrix}$
$\displaystyle=\begin{pmatrix}-1&\overline{Q}_{t}&Z^{R}\overline{Q}_{t}&-Y_{t}&0&0&0&0&0\\\
0&-\theta\overline{Q}_{t}&-\theta
Z^{R}_{t}\overline{Q}_{t}&0&-1&-\overline{Q}_{t}&-W_{t}&-R_{t}&-(\alpha_{1}+\alpha_{2}Z^{R}_{t})\overline{Q}_{t}\end{pmatrix},$

where $\overline{Q}_{t}\equiv E[Q_{t}\mid Z_{t}]$. Following the literature,
we replace $\overline{Q}_{t}$ with the fitted values of regressions of $Q_{t}$
on the second order polynomials of $(Y_{t},Z_{t}^{R},W_{t},R_{t},H_{t},K_{t})$
and the interactions.

When only the supply side is estimated given fixed demand parameters as in our
main results, the earlier optimal instrument matrix is modified into the
$5\times 1$ matrix $g_{t}(Z_{t})=D_{t}(Z_{t})^{\prime}$ where

$\displaystyle D_{t}(Z_{t})$
$\displaystyle=\begin{pmatrix}&E\left[\frac{\partial\varepsilon_{t}^{c}(\xi)}{\partial\gamma^{\prime}}\mid
Z_{t}\right]&E\left[\frac{\partial\varepsilon_{t}^{c}(\xi)}{\partial\theta}\mid
Z_{t}\right]\end{pmatrix}$
$\displaystyle=\begin{pmatrix}-1&-\overline{Q}_{t}&-W_{t}&-R_{t}&-(\alpha_{1}+\alpha_{2}Z^{R}_{t})\overline{Q}_{t}\end{pmatrix}.$

This suggests augmenting the benchmark instruments with $\overline{Q}_{t}$ and
$(\alpha_{1}+\alpha_{2}Z^{R}{t})\overline{Q}_{t}$. To prevent redundancy, we
add $\overline{Q}_{t}$ to the benchmark model. We verify that including
$(\alpha_{1}+\alpha_{2}Z^{R}{t})\overline{Q}_{t}$ in addition to
$\overline{Q}_{t}$ does not enhance statistical power.

Figure 3 reports the relative efficiency gain of the first approximation
approach. The efficiency gain is ignorable. Figure 2 in the main text reports
the relative efficiency gain of the optimal instruments in the second
approach. The efficiency gain is significant when the number of markets is
more than 1,000. However, this does not change our benchmark results.

(a)

(b)

(c)

(d)

(e)

(f)

Figure 3: Relative efficiency gain of the first approximation approach

###  A.3 Additional results

Estimation results of all parameters except conduct parameter $\theta$ are
shown on the author’s github. Totally, we confirm that estimation is accurate
with small bias and root-mean-squared error when increasing sample size, as in
Matsumura and Otani (2023b). Interested readers can modify the current data-
generating process.

###  A.4 Statistical power on $\theta$

Following chapters 5, 7, and 9 of Hansen (2022), we consider null hypothesis
$H_{0}:\theta=0$, i.e., markets are under perfect competition, and alternative
hypothesis $H_{1}:\theta\neq 0$. Let $T(\theta)$ be the t-statistics of
$\theta$, $\hat{\theta}$ be the point estimator. To simplify the argument, we
assume that the variance of the estimator to $\theta$, $V(\theta)$ is known.
Then the standard error of $\theta$ is writen as
$SE(\theta)=\sqrt{T^{-1}V(\theta)}$. Then, at a significance level of 0.05,
the power $\pi(\theta)$ is

$\displaystyle\pi(\theta)$ $\displaystyle=\Pr(T(\theta)>1.96|\theta\neq 0)$
$\displaystyle=\Pr\left(\frac{\hat{\theta}}{SE(\theta)}>1.96|\theta\neq
0\right)$
$\displaystyle=1-\Pr\left(\frac{\hat{\theta}}{SE(\theta)}<1.96|\theta\neq
0\right)$
$\displaystyle=1-\Pr\left(\frac{\sqrt{T}\hat{\theta}}{\sqrt{V(\theta)}}<1.96|\theta\neq
0\right)$ $\displaystyle\approx
1-\Phi\left(1.96-\frac{\sqrt{T}\hat{\theta}}{\sqrt{V(\theta)}}\right),$

for large $T$ where $\Phi(\cdot)$ is the cumulative distribution function of
the normal distribution. This typical formula illustrates that the term
$\sqrt{T}\hat{\theta}$ determines the power under $\theta\in[0,1]$. For
example, if $\theta=0.1$, the number of markets, $T$, must increase by 100
times compared to the case of $\theta=1.0$ for getting the same power. This is
consistent with our findings in Figure 1. Note that this applies to all
regression coefficients.