<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Fine-grained Intent Classification in the Legal Domain</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Ankan Mullick</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Abhilash Nandy</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Manav Nitin Kapadnis</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sohan Patnaik</string-name>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>R Raghav</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>. Initial filtering: 2 annotators filter out sentences that convey an intent matching the category of the document at hand</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>. Intent Phrase annotation 2 other annotators then extract a span from each sentence, so as to exclude any details do not contribute to the intent (such as name of the person, date of incident</institution>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Department of Industrial and Systems Engineering, Indian Institute of Technology Kharagpur</institution>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>Department of Mechanical Engineering, Indian Institute of Technology Kharagpur</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>A law practitioner has to go through a lot of long legal case proceedings. To understand the motivation behind the actions of diferent parties/individuals in a legal case, it is essential that the parts of the document that express an intent corresponding to the case be clearly understood. In this paper, we introduce a dataset of 93 legal documents, belonging to the case categories of either Murder, Land Dispute, Robbery, or Corruption, where phrases expressing intent same as the category of the document are annotated. Also, we annotate fine-grained intents for each such phrase to enable a deeper understanding of the case for a reader. Finally, we analyze the performance of several transformer-based models in automating the process of extracting intent phrases (both at a coarse and a fine-grained level), and classifying a document into one of the possible 4 categories, and observe that, our dataset is challenging, especially in the case of fine-grained intent classification.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Legal</kwd>
        <kwd>Fine-grained</kwd>
        <kwd>Intent Classification</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1http://www.commonlii.org/resources/221.html</title>
      <p>Category
Corruption
Land Dispute
Murder
Robbery</p>
      <p>No. of
documents
17
25
30
21</p>
      <p>
        etc.), and only include the words expressing cor- Tesla P100 GPUs with 16 GB RAM to perform all the
responding intent. The resulting spans are the experiments.
intent phrases. Inter-annotator agreement
(Cohen  ) is 0.79. 3.1. Document Classification
3. Sub-intent annotation: 1 annotator who is
aware of legal terminology, is asked to go through Recent advancements show that, Transformer [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] based
the intent phrases of several documents from all pre-trained language models like BERT [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], RoBERTa [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ],
the 4 intent categories in order to come up with ALBERT [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], and DeBERTa [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], have proven to be very
possible set of sub-intents for each intent cate- successful in learning robust context-based
representagory, that covers almost all aspects of that cate- tions of lexicons and applying these to achieve state of
gory. After coming up with the sets of sub-intents, the art performance on a variety of downstream tasks
4 annotators are then shown some samples on such as document classification in our case.
how to annotate sub-intent for a given phrase.
      </p>
      <p>Then, the intent phrases are divided amongst Model Name Accuracy
these annotators, and the sub-intent of each
intent phrase is annotated thereafter.</p>
      <p>Table 1 shows the statistics of our dataset, describing
the number of documents, average length of documents
and intent phrases, and average sentiment score for each
of the 4 intent categories. The documents on
Corruption and Land Dispute are roughly longer than those on Table 2
Murder and Robbery. Table 1 also shows average senti- Results of Transformer Models
ment scores across annotated intent phrases (calculated
using sentifish 2 Python Package) for each of the four We then implemented diferent models mentioned in
categories. The sentiment scores of the categories fol- Table 2, for learning contextual representations of the
low the following order - Land Dispute &gt; Corruption &gt; documents whose outputs were then fed to a softmax
Robbery &gt; Murder, which follows common intuition. layer to get the final predicted class of the document.</p>
      <p>
        Fig. 1 shows the top 200 most frequent words (exclud- Along with this, we also implemented a variant of
LEGALing stopwords) occurring in the intent phrases for each of BERT [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and LEGAL-RoBERTa 3 which were pre-trained
the four categories, with the font size of the word being on large scale datasets of legal domain-specific corpora
proportional to its frequency. In each wordcloud, we can which in turn led to much better scores than their
counobserve that each category has words that match the cor- terparts pre-trained on general corpora.
responding intent (E.g. ’bribe’ in Corruption, ’property’ Recent improvements to the state-of-the-art in
contexin Land Dispute etc.) tual language models such as in the case of DeBERTa
perform significantly better than BERT. The same is observed
3. Experiment and Results from Table 2 which shows that the Accuracy and Macro
F1-score for DeBERTa came to be the highest among the
other models, whereas LEGAL-BERT was at par with
DeBERTa in terms of Accuracy score. Further, since
DeBERTa is trained previously using the disentangled
attention mechanism along with an enhanced mask decoder.
      </p>
      <p>
        This section is organized to describe the use of
transformers [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] for document classification, which will be
followed by the explanation for the use of JointBERT
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] for intent as well as slot classification. We use two
      </p>
    </sec>
    <sec id="sec-2">
      <title>2https://pypi.org/project/sentifish/</title>
    </sec>
    <sec id="sec-3">
      <title>3https://huggingface.co/saibo/legal-roberta-base</title>
      <sec id="sec-3-1">
        <title>BERT</title>
      </sec>
      <sec id="sec-3-2">
        <title>RoBERTa</title>
      </sec>
      <sec id="sec-3-3">
        <title>ALBERT</title>
      </sec>
      <sec id="sec-3-4">
        <title>DeBERTa</title>
      </sec>
      <sec id="sec-3-5">
        <title>LEGAL-BERT</title>
        <p>LEGAL-RoBERTa
The training method is same as that of BERT. Owing
to the novel attention mechanism used in DeBERTa, it
outperforms the other models in terms of both Accuracy
and Macro F1-score.</p>
        <p>LEGAL-BERT on the other hand is pre-trained and
further fine-tuned on legal-domain specific corpora, which
in turn lead to its state-of-the-art performance on
various legal domain specific tasks. In our case,
leveraging LEGAL-BERT outperforms other models since the
contextual representation is more inclined towards legal
matters.</p>
        <p>
          All of the transformer models were implemented
using sliding window attention [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ], since the document
length for all the documents is greater than the
transformer maximum token size. They were trained with a
sliding window ratio of 20% over three epochs with
learning rate and batch size set at 2e-5 and 32 respectively.
The documents in the dataset are randomly split into
train, validation and test sets in the ratio of 6:2:2. Note
that, when classifying fine-grained intents, we only
consider those sub-intents that have atleast 50 corresponding
phrases.
        </p>
        <p>
          We report the Accuracy score and Macro average score
for each of the model so as to get an intuition on how
the state of art transformer-based architectures perform
on document classification in the legal domain.
3.2. JointBERT
We implemented BERT for joint intent classification and
slot filling [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] on our dataset. We also replaced the BERT
backbone with other transformer-based models such as
DistilBERT and ALBERT. Slot Filling is a sequence
labelling task, where BIO Tags are for the classes of
‘Corruption’, Land Dispute’, ‘Robbery’ and ‘Murder’, and then
the intent classification task for those classes. The dataset
is prepared in the following manner - Since there is a
majority of ‘O’ Tags for the slot filling task, only
sentences containing an intent phrase, the one before that,
and the one after that are used for training to mitigate
class imbalance. Each token has an intent BIO tag and
each sentence with an intent phrase has a target intent.
We randomly selected 20% sample for testing, 20% for
validation. Rest 60% samples were used for training.
        </p>
        <p>The models were trained over 10 epochs with a batch
size of 16, at a learning rate of 2e-5. At each epoch
checkpoint, the model was saved and the model with the
highest validation accuracy was picked to evaluate on the
test set. As can be seen from Table 3, BERT proved to be
the best model with an Intent Accuracy as well as Intent
Macro F1-score of 0.9.</p>
        <p>Table 4 gives the evaluation metric scores for each
intent separately and the analysis provides evidence that
the transformer-based models perform poorly on
Corruption intent due to the number of ocuments in that</p>
      </sec>
      <sec id="sec-3-6">
        <title>BERT</title>
      </sec>
      <sec id="sec-3-7">
        <title>DistilBERT</title>
      </sec>
      <sec id="sec-3-8">
        <title>ALBERT</title>
        <p>0.90
0.90
0.88
category being the lowest, whereas they perform
significantly better on other intents.</p>
        <p>Score for fine-grained intent classification for the best
performing model among the three models, i.e.,
JointBERT with a BERT Backbone. The labels are presented
in the form of  _ , where  is an intent (e.g. Robbery),
and  is a fine-grained intent/sub-intent (e.g. action). We
observe that, even though the number of training
samples per fine-grained class is quite low, performance on
the test set is quite good - The F1-Score for all classes
is above 0.4, and except for two classes, it is above the
halfway mark of 0.5.</p>
        <p>Note that we have not reported the slot classification
results for the fine-grained intents. This is because the
number of labels becomes almost twice in this case as
compared to intent classification (due to the presence
of both B and I tags corresponding to each fine-grained
intent, and an O class additionally, as we consider BIO
tags for annotation). Hence, the number of samples per
class is insuficient to learn a good slot classifier.
4. Discussion
We observe that, although transformer-based models are
performing well in the case of document classification</p>
        <p>Table 6 provides the classification accuracy and Intent and coarse-grained intent classification, there is a need
Macro F1-score on fine grained Intent Classification task. for better performance in the fine-grained intent
classifiAs the intent becomes more specific, the scores drop sig- cation case. Hence, we argue that our dataset could be a
nificantly, showing that the models are unable to capture crucial starting point for research on fine-grained intent
the in-depth context of the intent phrases. However, mo- classification in the legal domain.
dle with the BERT backbone still performs the best. This
can be attributed to the fact, that BERT has the high- 5. Conclusion
est number of parameters ( 110 million) as compared to
ALBERT ( 31 million), and DistilBERT ( 50 million).</p>
        <sec id="sec-3-8-1">
          <title>Model Name</title>
        </sec>
      </sec>
      <sec id="sec-3-9">
        <title>BERT</title>
      </sec>
      <sec id="sec-3-10">
        <title>DistilBERT</title>
      </sec>
      <sec id="sec-3-11">
        <title>ALBERT</title>
        <sec id="sec-3-11-1">
          <title>Intent</title>
        </sec>
        <sec id="sec-3-11-2">
          <title>Accuracy 0.53</title>
          <p>0.46
0.48</p>
        </sec>
        <sec id="sec-3-11-3">
          <title>Intent</title>
        </sec>
        <sec id="sec-3-11-4">
          <title>Macro</title>
        </sec>
        <sec id="sec-3-11-5">
          <title>F1-score 0.50</title>
          <p>0.40
0.47
This paper presents a new dataset for coarse and
finegrained annotation, as well as, shows a proof-of-concept
as to how document as well as intent classification can be
automated with reasonably good results. We use diferent
transformer-based models for document classification,
and observe that DeBERTa performs the best. We try
transformer-based models such as BERT, ALBERT and
DistilBERT as the backbones of a joint intent and slot
classification neural network, and observe that, BERT
performs the best among all the three, both in coarse
as well as fine-grained intent classification. However,
our dataset is challenging, as there is a lot of scope of
improvement in the results, especially in fine-grained
intent classification. Hence, our dataset could serve as a
crucial benchmark for fine-grained intent classification
in the legal domain.</p>
        </sec>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Vaswani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Shazeer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Parmar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Uszkoreit</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Jones</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. N.</given-names>
            <surname>Gomez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Kaiser</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Polosukhin</surname>
          </string-name>
          , Attention is all you need,
          <year>2017</year>
          .
          <article-title>a r X i v : 1 7 0 6 . 0 3 7 6 2</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Q.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Zhuo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Bert for joint intent classification and slot filling</article-title>
          ,
          <year>2019</year>
          .
          <article-title>a r X i v : 1 9 0 2 . 1 0 9 0 9</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>Devlin</surname>
          </string-name>
          , M.-
          <string-name>
            <given-names>W.</given-names>
            <surname>Chang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Toutanova</surname>
          </string-name>
          , Bert:
          <article-title>Pre-training of deep bidirectional transformers for language understanding</article-title>
          ,
          <year>2019</year>
          .
          <article-title>a r X i v : 1 8 1 0 . 0 4 8 0 5</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Goyal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Du</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Joshi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Levy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lewis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Zettlemoyer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Stoyanov</surname>
          </string-name>
          ,
          <article-title>Roberta: A robustly optimized bert pretraining approach</article-title>
          ,
          <year>2019</year>
          .
          <article-title>a r X i v : 1 9 0 7 . 1 1 6 9 2</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Lan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Goodman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Gimpel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Sharma</surname>
          </string-name>
          , R. Soricut,
          <string-name>
            <surname>Albert:</surname>
          </string-name>
          <article-title>A lite bert for selfsupervised learning of language representations</article-title>
          ,
          <year>2020</year>
          .
          <article-title>a r X i v : 1 9 0 9 . 1 1 9 4 2</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>P.</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Gao</surname>
          </string-name>
          , W. Chen, Deberta:
          <article-title>Decodingenhanced bert with disentangled attention</article-title>
          ,
          <year>2021</year>
          .
          <article-title>a r X i v : 2 0 0 6 . 0 3 6 5 4</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>I.</given-names>
            <surname>Chalkidis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Fergadiotis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Malakasiotis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Aletras</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Androutsopoulos</surname>
          </string-name>
          ,
          <article-title>Legal-bert: The muppets straight out of law school</article-title>
          ,
          <year>2020</year>
          .
          <article-title>a r X i v : 2 0 1 0 . 0 2 5 5 9</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M. A.</given-names>
            <surname>Masood</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. A.</given-names>
            <surname>Abbasi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N. Wee</given-names>
            <surname>Keong</surname>
          </string-name>
          ,
          <article-title>Contextaware sliding window for sentiment classification</article-title>
          ,
          <source>IEEE Access 8</source>
          (
          <year>2020</year>
          )
          <fpage>4870</fpage>
          -
          <lpage>4884</lpage>
          .
          <source>doi:1 0 . 1 1 0</source>
          <string-name>
            <given-names>9</given-names>
            <surname>/ A C C E S S</surname>
          </string-name>
          .
          <volume>2 0 1 9 . 2 9 6 3 5 8 6 .</volume>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>