<!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>Gauravarora@HASOC-Dravidian-CodeMix- FIRE2020: Pre-training ULMFiT on Synthetically Generated Code-Mixed Data for Hate Speech Detection</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>GauravArora</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jio Haptik Technologies Limited</string-name>
        </contrib>
      </contrib-group>
      <abstract>
        <p>This paper describes the system submitted to Dravidian-Codemix-HASOC2020: Hate Speech and Ofensive Content Identification in Dravidian languages (Tamil-English and Malayalam-English). The task aims to identify ofensive language in code-mixed dataset of comments/posts in Dravidian languages collected from social media. We participated in both Sub-task A, which aims to identify ofensive content in mixed-script (mixture of Native and Roman script) and Sub-task B, which aims to identify ofensive content in Roman script, for Dravidian languages. In order to address these tasks, we proposed pretraining ULMFiT on synthetically generated code-mixed data, generated by modelling code-mixed data generation as a Markov process using Markov chains. Our model achieved 0.88 weighted F1-score for code-mixed Tamil-English language in Sub-task B and got 2nd rank on the leader-board. Additionally, our model achieved 0.91 weighted F1-score (4th Rank) for mixed-script Malayalam-English in Sub-task A and 0.74 weighted F1-score (5th Rank) for code-mixed Malayalam-English language in Sub-task B.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Hate speech</kwd>
        <kwd>ofensive language</kwd>
        <kwd>ULMFiT</kwd>
        <kwd>markov chains</kwd>
        <kwd>code-mix data</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        languages collected from social media. Each comment/post is annotated with
ofensive/notofensive label at the comment/post level. The data set has been collected from YouTube
comments and tweets. It has 2 sub-tasks. Sub-task A is a message-level label classification
task in which given a YouTube comment in Code-mixed (Mixture of Native and Roman Script)
Malayalam, systems have to classify it into ofensive or not-ofensive. Sub-task B is also a
message-level label classification task in which given a tweet or YouTube comment in Tanglish
or Manglish (Tamil and Malayalam written using Roman Script), systems have to classify it into
ofensive or not-ofensive [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>
        In this competition, we participated in both sub-task A and sub-task B. We pre-trained
ULMFiT [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] on synthetically generated code-mixed data and used transfer learning to train
the model on downstream task of hate-speech classification. We propose a Markov model
to synthetically generate code-mixed data from Wikipedia articles in native form and their
translated and transliterated versions. We use this synthetically generated code-mixed data for
Malayalam and Tamil to pre-train ULMFiT from scratch. With this approach, we achieve 2nd
Rank on the leader-board for code-mixed Tamil-English language in Sub-task B, 4th Rank on
the leader-board for code-mixed Malayalam in mixed-script in Sub-task A and 5th Rank on the
leader-board for code-mixed Malayalam-English language in Sub-task B. We’ve open-sourced
our code for dataset preparation, language model pre-training and classification model training
on GitHub1,2.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <p>
        Lot of researchers and practitioners from industry and academia have been attracted towards
the problem of automatic identification of hateful and ofensive speech. Authors in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] discuss
the complexity of the concept of hate speech and its unquestionable potential for societal impact,
particularly in online communities and digital media platforms. There have been previous
attempts at developing models for hate speech detection in English, Hindi and Germa6n],[
Italian 7[] but not much work has been done for Dravidian code-mix languages. Having said
that, attempts are being made to accelerate progress in NLP in Dravidian languages, like in this
competition or in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
      </p>
      <p>There have been attempts at synthetically generating code-mixed data based on linguistic
theory [10]. But in this paper, we use a novel technique to generate synthetic code-mixed data
and pre-train ULMFiT model for Dravidian languages.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Methodology</title>
      <p>In this section we discuss data preparation for pre-training ULMFiT language model, get insights
into the Dravidian code-mix HASOC classification train, dev and test sets and discuss modeling
details.</p>
      <sec id="sec-3-1">
        <title>1https://github.com/goru001/nlp-for-tanglish 2https://github.com/goru001/nlp-for-manglish</title>
        <sec id="sec-3-1-1">
          <title>3.1. Dataset</title>
          <p>Data preparation for pre-training ULMFiT language model. Firstly, we obtain parallel
sets of Wikipedia articles in native, transliterated and translated form. This gives us one to one
mapping between sentences in native, transliterated and translated form. This allows us to model
code-mixed data generation process as a Markov Process with 3 statneast; i v e , t r a n s l a t e d
and t r a n s l i t e r a t e d with p 1 , p 2 , p 3 , q 1 , q 2 , q 3 , r 1 , r 2 , r 3 as state transition probabilities
as shown in Figure1. We sample from this Markov process from timeT = 0 to time T = N , where</p>
          <p>={native, transliterated, transliterated, native, translated, .......} depending upon
the values of state transition probabilities. Usi ng


ℎ sentence at =  from  
’s  ℎ state. Example of state transition probabilities used for
, we form code-mixed data by picking
synthetically generating Malayalam code-mixed data are shown in T1a.ble</p>
          <p>Dravidian code-mix HASOC classification dataset.</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>Table2 shows statistics of the dataset used in this competition for Sub-task A and Sub-task B. Dataset statistics are largely consistent across train, dev and test sets and contain unbalanced classes, varied length sentences. Malayalam and Tamil training datasets for sub-task B contain a few mixed script sentences.</title>
        <p>Sub-task A
Sub-task B
Malayalam mixed-script
Malayalam
Test
400
64.5%
1
8
186</p>
        <sec id="sec-3-2-1">
          <title>3.2. Modeling Details</title>
          <p>
            3.2.1. Model Architecture
Weight-dropped AWD-LSTM variant1[
            <xref ref-type="bibr" rid="ref1">1</xref>
            ] of the long short-term memory network 1[
            <xref ref-type="bibr" rid="ref2">2</xref>
            ] and
[13] was used for the language modeling task. Its embedding size was 400, number of hidden
activations per layer was 1152 and the number of layers was 3. Two linear blocks with batch
normalization and dropout were added as custom head for the classifier with rectified linear
unit activations for the intermediate layer and a softmax activation at the last lay4e]r.T[able3
shows dropout applied to AWD-LSTM model. We useDropout Multiplicity as a parameter in
our experiments to proportionately change the magnitude of all dropouts.
3.2.2. Pipeline
Tokenization. We create subword vocabulary by training a SentencePi3etcoekenization model
on the dataset prepared, using unigram segmentation algorith1m4][. Since we’re using subword
          </p>
        </sec>
      </sec>
      <sec id="sec-3-3">
        <title>3https://github.com/google/sentencepiece</title>
        <p>tokenization, our models can handle diferent spellings in transliteration or spelling errors in
test set. Table4 shows vocabulary size of the models trained for each one of the sub-tasks.</p>
        <p>ULMFiT Language model pre-training. Our model is based on the Fasta4iimplementation
of ULMFiT. Table5 shows perplexity of the trained models on validation set. Pre-trained models
along with datasets can be downloaded and used for several other downstream classification
tasks from the GitHub repository.</p>
        <p>Preprocessing of Dravidian code-mix HASOC dataset. Basic preprocessing was done
by lower-casing, removing @username mentions etc. Exact reproduction details are available
in the GitHub repository.</p>
        <p>Classifier training. Classifier was trained by first fine-tuning the pre-trained ULMFiT
language model and then training the classifier.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Experiment and Results</title>
      <sec id="sec-4-1">
        <title>4.1. Experiment setting</title>
        <p>We did basic pre-processing detailed in the previous section. For each one of the sub-tasks, we
split the training data into standard train-validation splits in the ratio of 80:20, in case explicit
validation set was not given. Using this split, we perform experiments to identify the best
set of hyperparameters, shown in Tabl6e. Gradual unfreezing epochs and learning rates are
accessible from notebooks in GitHub repository. Backpropagation through time (BPTT) was set
to 70. For language model fine-tuning, dropout multiplicity was set to 0.3, batch size was set to
64, the model was trained for 1 epoch with learning rate 1e-2 with only last layer unfreezed and
5 epochs with learning rate 1e-3 after unfreezing all layers.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Results</title>
        <p>In this competition, teams were ranked by the weighted F1 score of their classification system.
Tables7, 8 and 9 show Top-5 ranked teams in the competition with their weighted Precision,
weighted Recall and weighted F1-score for each one of the sub-tasks. Diference between top</p>
        <p>Task
Sub-Task A
Sub-Task B</p>
        <p>Malayalam
Mixed Script
Malayalam</p>
        <p>Tamil</p>
        <p>Dropout
Multiplicity</p>
        <p>Batch
Size</p>
        <p>Epochs</p>
        <p>Model
Unfreezed</p>
        <p>Learning Rate
0.5
ranked team’s weighted F1-score and our weighted F1-score is less than 0.04 in all the sub-tasks.
Perplexity of ULMFiT language model after fine-tuning was 57.53 for mixed-script Malayalam
in sub-task A, 71.02 for code-mixed Tamil and 89.12 for code-mixed Malayalam in Latin script
in sub-task B.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusion</title>
      <p>In this paper, we presented a Markov model to facilitate synthetic generation of code-mixed
data and used it to pre-train ULMFiT language model on Dravidian languages. Using transfer
learning with the pre-trained ULMFiT model on downstream task of hate speech detection, we
achieved Rank 2 for Tamil in Sub-task B, Rank 4 for Malayalam in Sub-task A and Rank 5 for
Malayalam in Sub-task B. In future research, we will consider improving synthetically generating
code-mixed data by allowing code-mixing within a single sentence and using Transformer based
models.
[10] A. Pratapa, G. Bhat, M. Choudhury, S. Sitaram, S. Dandapat, K. Bali, Language modeling
for code-mixing: The role of linguistic theory based synthetic data, 2018, pp. 1543–1553.
doi:10.18653/v1/P18- 1143.
[11] S. Merity, N. S. Keskar, R. Socher, Regularizing and optimizing LSTM language models,</p>
      <p>CoRR abs/1708.02182 (2017). URL: http://arxiv.org/abs/1708.0218.2arXiv:1708.02182.
[12] S. Hochreiter, J. Schmidhuber, Long short-term memory, Neural Comput. 9 (1997)
1735–1780. URL: https://doi.org/10.1162/neco.1997.9.8.1735. doi:10.1162/neco.1997.9.8.
1735.
[13] F. A. Gers, J. A. Schmidhuber, F. A. Cummins, Learning to forget: Continual
prediction with lstm, Neural Comput. 12 (2000) 2451–2471. URLh:ttps://doi.org/10.1162/
089976600300015015. doi:10.1162/089976600300015015.
[14] T. Kudo, J. Richardson, Sentencepiece: A simple and language independent subword
tokenizer and detokenizer for neural text processing, CoRR abs/1808.06226 (2018). URL:
http://arxiv.org/abs/1808.0622.6arXiv:1808.06226.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>R.</given-names>
            <surname>Kumar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. K.</given-names>
            <surname>Ojha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Malmasi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zampieri</surname>
          </string-name>
          ,
          <article-title>Benchmarking aggression identification in social media</article-title>
          ,
          <source>in: Proceedings of the First Workshop on Trolling, Aggression and Cyberbullying (TRAC-2018)</source>
          ,
          <article-title>Association for Computational Linguistics</article-title>
          , Santa Fe, New Mexico, USA,
          <year>2018</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>11</lpage>
          . URL: https://www.aclweb.org/anthology/W18-440.
          <fpage>1</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>B. R.</given-names>
            <surname>Chakravarthi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. A.</given-names>
            <surname>Kumar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. P.</given-names>
            <surname>McCrae</surname>
          </string-name>
          , P. B,
          <string-name>
            <surname>S. KP</surname>
          </string-name>
          , T. Mandl,
          <article-title>Overview of the track on HASOC - Ofensive Language Identification - DravidianCodemix, in: Working Notes of the Forum for Information Retrieval Evaluation (FIRE 2020)</article-title>
          . CEUR Workshop Proceedings. In: CEUR-WS. org, Hyderabad, India,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>B. R.</given-names>
            <surname>Chakravarthi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. A.</given-names>
            <surname>Kumar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. P.</given-names>
            <surname>McCrae</surname>
          </string-name>
          , P. B,
          <string-name>
            <surname>S. KP</surname>
          </string-name>
          , T. Mandl,
          <article-title>Overview of the track on HASOC - Ofensive Language Identification - DravidianCodemix, in: Proceedings of the 12th Forum for Information Retrieval Evaluation</article-title>
          ,
          <source>FIRE '20</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J.</given-names>
            <surname>Howard</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ruder</surname>
          </string-name>
          ,
          <article-title>Fine-tuned language models for text classification</article-title>
          , CoRR abs/
          <year>1801</year>
          .06146 (
          <year>2018</year>
          ). URL: http://arxiv.org/abs/
          <year>1801</year>
          .0614.6arXiv:
          <year>1801</year>
          .06146.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>P.</given-names>
            <surname>Fortuna</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Nunes</surname>
          </string-name>
          ,
          <article-title>A survey on automatic detection of hate speech in text, ACM Computing Surveys (CSUR) 51 (</article-title>
          <year>2018</year>
          )
          <fpage>1</fpage>
          -
          <lpage>30</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>T.</given-names>
            <surname>Mandl</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Modha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Majumder</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Patel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Dave</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Mandlia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Patel</surname>
          </string-name>
          ,
          <article-title>Overview of the hasoc track at fire 2019: Hate speech and ofensive content identification in indo-european languages</article-title>
          ,
          <source>in: Proceedings of the 11th Forum for Information Retrieval Evaluation</source>
          , FIRE '19,
          <string-name>
            <surname>Association</surname>
          </string-name>
          for Computing Machinery, New York, NY, USA,
          <year>2019</year>
          , p.
          <fpage>14</fpage>
          -
          <lpage>17</lpage>
          . URL: https://doi.org/10.1145/3368567.3368584. doi:
          <volume>10</volume>
          .1145/3368567.3368584.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>M.</given-names>
            <surname>Corazza</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Menini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Cabrio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Tonelli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Villata</surname>
          </string-name>
          ,
          <article-title>A multilingual evaluation for online hate speech detection</article-title>
          ,
          <source>ACM Trans. Internet Technol</source>
          .
          <volume>20</volume>
          (
          <year>2020</year>
          ). URLh:ttps://doi.org/10. 1145/3377323. doi:
          <volume>10</volume>
          .1145/3377323.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>B. R.</given-names>
            <surname>Chakravarthi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Priyadharshini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Muralidaran</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Suryawanshi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Jose</surname>
          </string-name>
          , E. Sherly,
          <string-name>
            <given-names>J. P.</given-names>
            <surname>McCrae</surname>
          </string-name>
          ,
          <article-title>Overview of the track on Sentiment Analysis for Dravidian Languages in Code-Mixed Text, in: Working Notes of the Forum for Information Retrieval Evaluation (FIRE 2020)</article-title>
          . CEUR Workshop Proceedings. In: CEUR-WS. org, Hyderabad, India,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>B. R.</given-names>
            <surname>Chakravarthi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Priyadharshini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Muralidaran</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Suryawanshi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Jose</surname>
          </string-name>
          , E. Sherly,
          <string-name>
            <given-names>J. P.</given-names>
            <surname>McCrae</surname>
          </string-name>
          ,
          <article-title>Overview of the track on Sentiment Analysis for Dravidian Languages in Code-Mixed Text</article-title>
          ,
          <source>in: Proceedings of the 12th Forum for Information Retrieval Evaluation</source>
          ,
          <source>FIRE '20</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>