{
  "id": 369524,
  "title": "8th place solution",
  "content": "<h2>Overview</h2>\n<p>Our team ensembled 26 models in the following table. (including knowledge distilled and pseudo labeled ones) Ridge regression was used to integrate the prediction results of each model. Post-processing was applied to adjust the output values of the final ensemble's predictions. For the single model, the following techniques contributed to score improvement.</p>\n<ul>\n<li>Knowledge distillation and Pseudo labeling</li>\n<li>Preprocessing - replacing “\\n\\n” with [PARAGRAPH]</li>\n<li>AWP</li>\n<li>Change the max len for each epoch</li>\n</ul>\n<table>\n<thead>\n<tr>\n<th>&nbsp; &nbsp; &nbsp;</th>\n<th>Model</th>\n<th>CV / LB</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>Deberta v3 base</td>\n<td>0.448</td>\n<td>512 Max length , Pseudo labels inferred from the tensorflow Deberta v3 base (LLRD technique) , and those plus competition data trained on the deberta v3 base (freezing+meanpooling)</td>\n</tr>\n<tr>\n<td>2</td>\n<td>Deberta v3 large</td>\n<td>0.448</td>\n<td>Same as above , deberta v3 large trained on meanpooling + freezing</td>\n</tr>\n<tr>\n<td>3</td>\n<td>Deberta v3 small</td>\n<td>0.447</td>\n<td>Knowledge distilled model</td>\n</tr>\n<tr>\n<td>4</td>\n<td>Deberta v2 xlarge</td>\n<td>0.448 / 0.44</td>\n<td>LSTM + mean pooling +freezing (Same pseudo label from tensorflow)</td>\n</tr>\n<tr>\n<td>5</td>\n<td>Deberta v3 large</td>\n<td>0.4495 / 0.43</td>\n<td>Max len = 470, trained with decreasing max len - 768/512/470/470</td>\n</tr>\n<tr>\n<td>6</td>\n<td>Deberta v3 base</td>\n<td>0.4515 / 0.43</td>\n<td>Max len =470, Mean pooling, AWP, val_steps = 250, reinit layers</td>\n</tr>\n<tr>\n<td>7</td>\n<td>Deberta xlarge</td>\n<td>0.4534 / 0.43</td>\n<td>CLS token, val steps =20</td>\n</tr>\n<tr>\n<td>8</td>\n<td>deberta v3 large</td>\n<td>0.4495 / 0.43</td>\n<td>CLS Token, AWP, val steps = 250, max len 768</td>\n</tr>\n<tr>\n<td>9</td>\n<td>Electra large</td>\n<td>0.4545</td>\n<td>Meanpool, LSTM</td>\n</tr>\n<tr>\n<td>10</td>\n<td>deepset/deberta-v3-bbase-squad2</td>\n<td>0.4522</td>\n<td></td>\n</tr>\n<tr>\n<td>11</td>\n<td>Luke Large</td>\n<td>0.4551</td>\n<td>Max len 512, Mean pooling, bidirectional-LSTM</td>\n</tr>\n<tr>\n<td>12</td>\n<td>Deberta v3 large</td>\n<td>0.4467</td>\n<td></td>\n</tr>\n<tr>\n<td>13</td>\n<td>Deberta v3 base</td>\n<td>0.4471</td>\n<td>AutoModelForTokenClassification, last 4 layer concatenate, mean pooling,max_len=768</td>\n</tr>\n<tr>\n<td>14</td>\n<td>Deberta v3 large</td>\n<td>0.4469</td>\n<td>PL Model, 2 seed averaged, CLS Token</td>\n</tr>\n<tr>\n<td>16</td>\n<td>Cocolm large</td>\n<td>0.4568</td>\n<td>No [PARAGRAPH], CLS Token, AWP</td>\n</tr>\n<tr>\n<td>17</td>\n<td>GPT2 Medium</td>\n<td>0.4648</td>\n<td>max_len=1024, Mean pooling, SWA</td>\n</tr>\n<tr>\n<td>18</td>\n<td>Longformer Large</td>\n<td>0.4592</td>\n<td>max_len=1536, Mean pooling</td>\n</tr>\n<tr>\n<td>19</td>\n<td>Bart Large Squad</td>\n<td>0.4649</td>\n<td>max_len=1024, Mean pooling</td>\n</tr>\n<tr>\n<td>20</td>\n<td>Distill Bart CNN</td>\n<td>0.4607</td>\n<td>max_len=1024, Mean pooling</td>\n</tr>\n<tr>\n<td>21</td>\n<td>OPT-350M</td>\n<td>0.4639</td>\n<td>max_len=1536, Mean pooling</td>\n</tr>\n<tr>\n<td>22</td>\n<td>Bart Base</td>\n<td>0.4788</td>\n<td>max_len=1024, Mean pooling, SWA</td>\n</tr>\n<tr>\n<td>23</td>\n<td>T5 Large</td>\n<td>0.4717</td>\n<td>max_len=1024, Mean pooling</td>\n</tr>\n<tr>\n<td>24</td>\n<td>Deberta v3 base</td>\n<td>0.4490</td>\n<td>max_len=512</td>\n</tr>\n<tr>\n<td>25</td>\n<td>Deberta v3 base</td>\n<td>0.4484</td>\n<td>max_len =384</td>\n</tr>\n<tr>\n<td>26</td>\n<td>Deberta v3 large</td>\n<td>0.4498</td>\n<td>max_len=1429, Mean pooling, Pseudo Labeling</td>\n</tr>\n</tbody>\n</table>\n<h2>What worked ?</h2>\n<ul>\n<li><p><strong>Preprocessing:</strong> - replacing “\\n\\n” with [PARAGRAPH]  There are about 17.5K instances of \\n\\n in the dataset. Deberta v3 large tokenizer simply ignores these. So we decided to create one additional special token by replacing \\n\\n with [PARAGRAPH]. Also resized embeddings to take care of this one extra token. Just this change moved deberta v3 large from 0.44 to 0.43.</p></li>\n<li><p><strong>Knowledge Distillation:</strong> We had one deberta v3 x small model with knowledge distillation. <br>\nWe decided to distill knowledge i.e. (get OOF data)  from an ensemble of 9 models and utilize these to train the model. This is only utilizing current competition data not previous feedback data.</p></li>\n<li><p><strong>Pseudo labels (PL)</strong>  <br>\nThis was challenging to determine if pseudo labels are working or not. We tried generating labels with a few different models to determine if it’s working. Eventually we created two seed deberta v3 large models which seemed more stable than trying to determine with single deberta v3 large. Some of the models in our ensemble were with PL. <br><br>\nWe also did pseudo labeling inferred from the tensorflow Deberta v3 base model , which is trained with layer wise learning rate decay (LLRD) technique and used those PL inferred data into some of our models , which helps in improving the cv as well as LB.</p></li>\n<li><p><strong>Model Architecture:</strong><br>\nJust CLS token, Mean pooling, Mean pooling + CLS token, MaskAddedAttentionHead, MaskAddedAttentionHead + CLS token(AutoModel and AutoModelForTokenClassification) , LSTM</p></li>\n<li><p><strong>Training strategies:</strong><br>\nAWP worked, different max len per epoch, validation steps 20-250 were utilized for different models. Some of the models were trained using end of epoch validation as well. <br>\nCV was calculated with 5 folds models.</p></li>\n<li><p><strong>Diversity in ensemble:</strong> <br>\nFolds - By Abhishek - <a href=\"https://www.kaggle.com/code/abhishek/multi-label-stratified-folds\" target=\"_blank\">https://www.kaggle.com/code/abhishek/multi-label-stratified-folds</a>  <br><br>\nWe had ensemble of total 27 models (runtime ~7 hrs)  - 7 Deberta v3 large models, 5 Deberta v3 base, Deberta v2 xlarge, Deberta xlarge, Deberta v3 small, Luke Large, Electra, Cocolm, Deberta v3 base squad, GPT2 medium, Longformer Large, Bart Large Squad, Distill Bart CNN, OPT 350M, Bart base, T5 large</p></li>\n<li><p><strong>Ridge Stacking</strong><br>\nWe used Ridge for stacking our models, there were 2 deberta large (two seed models) which we combined so that generated only 1 ridge coefficient and it helped in ensemble. </p></li>\n<li><p><strong>Post processing</strong><br>\nWe used “Nelder-mead” <a href=\"https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html\" target=\"_blank\">https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html</a>  for post processing - divided the predictions into 20 bins and multiplied the resulting array with predictions. <br>\nThis post processing is based on commonlit's 2nd place solution method.<br>\n<a href=\"https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328\" target=\"_blank\">https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328</a></p></li>\n</ul>\n<p>Our final ensemble is here - <a href=\"https://www.kaggle.com/code/aman1391/fb3-8th-place-solution-ensemble-27-models?scriptVersionId=112097448\" target=\"_blank\">https://www.kaggle.com/code/aman1391/fb3-8th-place-solution-ensemble-27-models?scriptVersionId=112097448</a></p>\n<h2>Ideas that didn’t work</h2>\n<ul>\n<li><p><strong>Mask Language modeling:</strong> - Tried many different ways for MLM to work, unsuccessful attempts. Tried to match similarity between FB3 data and previous feedback data for MLM which also didn’t work. </p></li>\n<li><p><strong>Other models:</strong> - Various other models from HuggingFace didn’t work. A few did work however it wouldn’t work with our ensemble so they were unutilized.</p></li>\n<li><p><strong>Different loss functions:</strong> - Focal Loss, Ordinal regression from public kernel, Asymmetric loss - Asymmetric loss did work with a few ensembles but it wasn’t part of our best submission. </p></li>\n<li><p><strong>Ensemble with weights:</strong> - In the last 2 days, we tried ensemble with weight tuning but Ridge did give us better results. This needed more tuning or work for us to feel confident in selecting a submission. </p></li>\n<li><p>Many different model architectures, hyperparameters, token dropout, 4 fold model, dividing folds by number of tokens. </p></li>\n</ul>\n<h2>Other</h2>\n<ul>\n<li><p><strong>Compute:</strong>  A100s, 4090 (3090 and Colab Pro+ prior to 4090) </p></li>\n<li><p>Please see this post for a single model (average 2 seeds) gold solution - <a href=\"https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/369368\" target=\"_blank\">https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/369368</a> and corresponding <a href=\"https://github.com/rashmibanthia/feedback3\" target=\"_blank\">training code</a> </p></li>\n</ul>\n<h2>Important Citations</h2>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/yasufuminakama/fb3-deberta-v3-base-baseline-train\" target=\"_blank\">https://www.kaggle.com/code/yasufuminakama/fb3-deberta-v3-base-baseline-train</a><br>\n<a href=\"https://www.kaggle.com/yasufuminakama\" target=\"_blank\">@yasufuminakama</a>. Almost all of our scripts are based on this </li>\n<li><a href=\"https://www.kaggle.com/code/vslaykovsky/lb-0-43-ensemble-of-top-solutions\" target=\"_blank\">https://www.kaggle.com/code/vslaykovsky/lb-0-43-ensemble-of-top-solutions</a><br>\n<a href=\"https://www.kaggle.com/vslaykovsky\" target=\"_blank\">@vslaykovsky</a> This notebook made our ensemble easier   </li>\n<li><a href=\"https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/366525#2038773\" target=\"_blank\">https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/366525#2038773</a><br>\nKelvin  <a href=\"https://www.kaggle.com/xyzdivergence\" target=\"_blank\">@xyzdivergence</a> - for sharing ideas that worked -  different max len in ensemble</li>\n<li><a href=\"https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328\" target=\"_blank\">https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328</a><br>\nPost processing is based on commonlit's 2nd place solution method</li>\n<li><a href=\"https://www.kaggle.com/code/electro/deberta-layerwiselr-lastlayerreinit-tensorflow\" target=\"_blank\">https://www.kaggle.com/code/electro/deberta-layerwiselr-lastlayerreinit-tensorflow</a><br>\n<a href=\"https://www.kaggle.com/electro\" target=\"_blank\">@electro</a> We retrained above model on our folds and created pseudo labels</li>\n</ul>\n<h2>Thanks and Acknowledgements</h2>\n<p>Thanks to our hosts for hosting the competition and to teammates. Thanks also to the Kaggler's for sharing their helpful notebooks and discussions.</p>\n<p>Thank you and Congratulations  to my team mates - <a href=\"https://www.kaggle.com/aman1391\" target=\"_blank\">@aman1391</a>, <a href=\"https://www.kaggle.com/kanbehmw\" target=\"_blank\">@kanbehmw</a>, <a href=\"https://www.kaggle.com/fightingmuscle\" target=\"_blank\">@fightingmuscle</a></p>\n<p><strong>Team Members</strong><br>\n<a href=\"https://www.kaggle.com/rashmibanthia\" target=\"_blank\">@rashmibanthia</a><br>\n<a href=\"https://www.kaggle.com/aman1391\" target=\"_blank\">@aman1391</a><br>\n<a href=\"https://www.kaggle.com/kanbehmw\" target=\"_blank\">@kanbehmw</a><br>\n<a href=\"https://www.kaggle.com/fightingmuscle\" target=\"_blank\">@fightingmuscle</a></p>",
  "comments": [
    {
      "id": 2050764,
      "author_name": "Romuska Palo Ur Laputa",
      "author_url": "",
      "post_date": "2022-12-01T01:25:59.257000",
      "content": "<p><a href=\"https://www.kaggle.com/rashmibanthia\" target=\"_blank\">@rashmibanthia</a> <br>\nThank you for your solution! and congratulation for being competition master!!!<br>\nI'm so glad to work with you!!!!</p>",
      "votes": 3,
      "replies": [
        {
          "id": 2051286,
          "author_name": "RB",
          "author_url": "",
          "post_date": "2022-12-01T10:17:00.957000",
          "content": "<p>Likewise, It was pleasure working with you and Congratulations to you as well 🎉🎉</p>",
          "votes": 3,
          "replies": []
        }
      ]
    },
    {
      "id": 2054678,
      "author_name": "Marília Prata",
      "author_url": "",
      "post_date": "2022-12-04T10:39:46.287000",
      "content": "<p>Thank you for sharing your valuable solution RB.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2051853,
      "author_name": "AshAsh",
      "author_url": "",
      "post_date": "2022-12-01T16:50:32.610000",
      "content": "<p><a href=\"https://www.kaggle.com/rashmibanthia\" target=\"_blank\">@rashmibanthia</a> Thanks for the solution!</p>\n<blockquote>\n  <p>So we decided to create one additional special token by replacing \\n\\n with [PARAGRAPH]. Also resized embeddings to take care of this one extra token.</p>\n</blockquote>\n<p>Would you mind sharing a code snippet on how to resize deberta embeddings to take care of this token exactly? Would like to try this but it's not obvious to me how to implement resizing</p>",
      "votes": 2,
      "replies": [
        {
          "id": 2051900,
          "author_name": "RB",
          "author_url": "",
          "post_date": "2022-12-01T17:39:38.197000",
          "content": "<p>Code for adding special token: </p>\n<pre><code>CFG.tokenizer = AutoTokenizer.from_pretrained(model)\nCFG.tokenizer.add_special_tokens({: []})\n</code></pre>\n<p>Then, within model class, you need <code>self.model.resize_token_embeddings(len(CFG.tokenizer))</code> (see below code) </p>\n<pre><code> (nn.Module):\n     ():\n        ().__init__()\n\n        self.model_config = AutoConfig.from_pretrained(model_name)\n\n        self.model_config.update(\n            {\n                : ,\n                : ,\n                : ,\n                : CFG.num_labels,\n            }\n        )\n\n        self.model = AutoModel.from_pretrained(model_name, config=self.model_config)\n        self.model.resize_token_embeddings((CFG.tokenizer))\n\n        self.output = nn.Linear(self.model_config.hidden_size, CFG.num_labels)\n\n\n     ():\n        transformer_out = self.model(input_ids=ids, attention_mask=mask)\n        sequence_output = transformer_out.last_hidden_state[:, , :]\n\n        logits = self.output(sequence_output)\n\n         logits \n</code></pre>",
          "votes": 5,
          "replies": []
        }
      ]
    }
  ],
  "comment_count": 5,
  "messages": [
    {
      "id": 2049824,
      "postDate": "2022-11-30T11:12:38.553Z",
      "content": "<h2>Overview</h2>\n<p>Our team ensembled 26 models in the following table. (including knowledge distilled and pseudo labeled ones) Ridge regression was used to integrate the prediction results of each model. Post-processing was applied to adjust the output values of the final ensemble's predictions. For the single model, the following techniques contributed to score improvement.</p>\n<ul>\n<li>Knowledge distillation and Pseudo labeling</li>\n<li>Preprocessing - replacing “\\n\\n” with [PARAGRAPH]</li>\n<li>AWP</li>\n<li>Change the max len for each epoch</li>\n</ul>\n<table>\n<thead>\n<tr>\n<th>&nbsp; &nbsp; &nbsp;</th>\n<th>Model</th>\n<th>CV / LB</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>Deberta v3 base</td>\n<td>0.448</td>\n<td>512 Max length , Pseudo labels inferred from the tensorflow Deberta v3 base (LLRD technique) , and those plus competition data trained on the deberta v3 base (freezing+meanpooling)</td>\n</tr>\n<tr>\n<td>2</td>\n<td>Deberta v3 large</td>\n<td>0.448</td>\n<td>Same as above , deberta v3 large trained on meanpooling + freezing</td>\n</tr>\n<tr>\n<td>3</td>\n<td>Deberta v3 small</td>\n<td>0.447</td>\n<td>Knowledge distilled model</td>\n</tr>\n<tr>\n<td>4</td>\n<td>Deberta v2 xlarge</td>\n<td>0.448 / 0.44</td>\n<td>LSTM + mean pooling +freezing (Same pseudo label from tensorflow)</td>\n</tr>\n<tr>\n<td>5</td>\n<td>Deberta v3 large</td>\n<td>0.4495 / 0.43</td>\n<td>Max len = 470, trained with decreasing max len - 768/512/470/470</td>\n</tr>\n<tr>\n<td>6</td>\n<td>Deberta v3 base</td>\n<td>0.4515 / 0.43</td>\n<td>Max len =470, Mean pooling, AWP, val_steps = 250, reinit layers</td>\n</tr>\n<tr>\n<td>7</td>\n<td>Deberta xlarge</td>\n<td>0.4534 / 0.43</td>\n<td>CLS token, val steps =20</td>\n</tr>\n<tr>\n<td>8</td>\n<td>deberta v3 large</td>\n<td>0.4495 / 0.43</td>\n<td>CLS Token, AWP, val steps = 250, max len 768</td>\n</tr>\n<tr>\n<td>9</td>\n<td>Electra large</td>\n<td>0.4545</td>\n<td>Meanpool, LSTM</td>\n</tr>\n<tr>\n<td>10</td>\n<td>deepset/deberta-v3-bbase-squad2</td>\n<td>0.4522</td>\n<td></td>\n</tr>\n<tr>\n<td>11</td>\n<td>Luke Large</td>\n<td>0.4551</td>\n<td>Max len 512, Mean pooling, bidirectional-LSTM</td>\n</tr>\n<tr>\n<td>12</td>\n<td>Deberta v3 large</td>\n<td>0.4467</td>\n<td></td>\n</tr>\n<tr>\n<td>13</td>\n<td>Deberta v3 base</td>\n<td>0.4471</td>\n<td>AutoModelForTokenClassification, last 4 layer concatenate, mean pooling,max_len=768</td>\n</tr>\n<tr>\n<td>14</td>\n<td>Deberta v3 large</td>\n<td>0.4469</td>\n<td>PL Model, 2 seed averaged, CLS Token</td>\n</tr>\n<tr>\n<td>16</td>\n<td>Cocolm large</td>\n<td>0.4568</td>\n<td>No [PARAGRAPH], CLS Token, AWP</td>\n</tr>\n<tr>\n<td>17</td>\n<td>GPT2 Medium</td>\n<td>0.4648</td>\n<td>max_len=1024, Mean pooling, SWA</td>\n</tr>\n<tr>\n<td>18</td>\n<td>Longformer Large</td>\n<td>0.4592</td>\n<td>max_len=1536, Mean pooling</td>\n</tr>\n<tr>\n<td>19</td>\n<td>Bart Large Squad</td>\n<td>0.4649</td>\n<td>max_len=1024, Mean pooling</td>\n</tr>\n<tr>\n<td>20</td>\n<td>Distill Bart CNN</td>\n<td>0.4607</td>\n<td>max_len=1024, Mean pooling</td>\n</tr>\n<tr>\n<td>21</td>\n<td>OPT-350M</td>\n<td>0.4639</td>\n<td>max_len=1536, Mean pooling</td>\n</tr>\n<tr>\n<td>22</td>\n<td>Bart Base</td>\n<td>0.4788</td>\n<td>max_len=1024, Mean pooling, SWA</td>\n</tr>\n<tr>\n<td>23</td>\n<td>T5 Large</td>\n<td>0.4717</td>\n<td>max_len=1024, Mean pooling</td>\n</tr>\n<tr>\n<td>24</td>\n<td>Deberta v3 base</td>\n<td>0.4490</td>\n<td>max_len=512</td>\n</tr>\n<tr>\n<td>25</td>\n<td>Deberta v3 base</td>\n<td>0.4484</td>\n<td>max_len =384</td>\n</tr>\n<tr>\n<td>26</td>\n<td>Deberta v3 large</td>\n<td>0.4498</td>\n<td>max_len=1429, Mean pooling, Pseudo Labeling</td>\n</tr>\n</tbody>\n</table>\n<h2>What worked ?</h2>\n<ul>\n<li><p><strong>Preprocessing:</strong> - replacing “\\n\\n” with [PARAGRAPH]  There are about 17.5K instances of \\n\\n in the dataset. Deberta v3 large tokenizer simply ignores these. So we decided to create one additional special token by replacing \\n\\n with [PARAGRAPH]. Also resized embeddings to take care of this one extra token. Just this change moved deberta v3 large from 0.44 to 0.43.</p></li>\n<li><p><strong>Knowledge Distillation:</strong> We had one deberta v3 x small model with knowledge distillation. <br>\nWe decided to distill knowledge i.e. (get OOF data)  from an ensemble of 9 models and utilize these to train the model. This is only utilizing current competition data not previous feedback data.</p></li>\n<li><p><strong>Pseudo labels (PL)</strong>  <br>\nThis was challenging to determine if pseudo labels are working or not. We tried generating labels with a few different models to determine if it’s working. Eventually we created two seed deberta v3 large models which seemed more stable than trying to determine with single deberta v3 large. Some of the models in our ensemble were with PL. <br><br>\nWe also did pseudo labeling inferred from the tensorflow Deberta v3 base model , which is trained with layer wise learning rate decay (LLRD) technique and used those PL inferred data into some of our models , which helps in improving the cv as well as LB.</p></li>\n<li><p><strong>Model Architecture:</strong><br>\nJust CLS token, Mean pooling, Mean pooling + CLS token, MaskAddedAttentionHead, MaskAddedAttentionHead + CLS token(AutoModel and AutoModelForTokenClassification) , LSTM</p></li>\n<li><p><strong>Training strategies:</strong><br>\nAWP worked, different max len per epoch, validation steps 20-250 were utilized for different models. Some of the models were trained using end of epoch validation as well. <br>\nCV was calculated with 5 folds models.</p></li>\n<li><p><strong>Diversity in ensemble:</strong> <br>\nFolds - By Abhishek - <a href=\"https://www.kaggle.com/code/abhishek/multi-label-stratified-folds\" target=\"_blank\">https://www.kaggle.com/code/abhishek/multi-label-stratified-folds</a>  <br><br>\nWe had ensemble of total 27 models (runtime ~7 hrs)  - 7 Deberta v3 large models, 5 Deberta v3 base, Deberta v2 xlarge, Deberta xlarge, Deberta v3 small, Luke Large, Electra, Cocolm, Deberta v3 base squad, GPT2 medium, Longformer Large, Bart Large Squad, Distill Bart CNN, OPT 350M, Bart base, T5 large</p></li>\n<li><p><strong>Ridge Stacking</strong><br>\nWe used Ridge for stacking our models, there were 2 deberta large (two seed models) which we combined so that generated only 1 ridge coefficient and it helped in ensemble. </p></li>\n<li><p><strong>Post processing</strong><br>\nWe used “Nelder-mead” <a href=\"https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html\" target=\"_blank\">https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html</a>  for post processing - divided the predictions into 20 bins and multiplied the resulting array with predictions. <br>\nThis post processing is based on commonlit's 2nd place solution method.<br>\n<a href=\"https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328\" target=\"_blank\">https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328</a></p></li>\n</ul>\n<p>Our final ensemble is here - <a href=\"https://www.kaggle.com/code/aman1391/fb3-8th-place-solution-ensemble-27-models?scriptVersionId=112097448\" target=\"_blank\">https://www.kaggle.com/code/aman1391/fb3-8th-place-solution-ensemble-27-models?scriptVersionId=112097448</a></p>\n<h2>Ideas that didn’t work</h2>\n<ul>\n<li><p><strong>Mask Language modeling:</strong> - Tried many different ways for MLM to work, unsuccessful attempts. Tried to match similarity between FB3 data and previous feedback data for MLM which also didn’t work. </p></li>\n<li><p><strong>Other models:</strong> - Various other models from HuggingFace didn’t work. A few did work however it wouldn’t work with our ensemble so they were unutilized.</p></li>\n<li><p><strong>Different loss functions:</strong> - Focal Loss, Ordinal regression from public kernel, Asymmetric loss - Asymmetric loss did work with a few ensembles but it wasn’t part of our best submission. </p></li>\n<li><p><strong>Ensemble with weights:</strong> - In the last 2 days, we tried ensemble with weight tuning but Ridge did give us better results. This needed more tuning or work for us to feel confident in selecting a submission. </p></li>\n<li><p>Many different model architectures, hyperparameters, token dropout, 4 fold model, dividing folds by number of tokens. </p></li>\n</ul>\n<h2>Other</h2>\n<ul>\n<li><p><strong>Compute:</strong>  A100s, 4090 (3090 and Colab Pro+ prior to 4090) </p></li>\n<li><p>Please see this post for a single model (average 2 seeds) gold solution - <a href=\"https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/369368\" target=\"_blank\">https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/369368</a> and corresponding <a href=\"https://github.com/rashmibanthia/feedback3\" target=\"_blank\">training code</a> </p></li>\n</ul>\n<h2>Important Citations</h2>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/yasufuminakama/fb3-deberta-v3-base-baseline-train\" target=\"_blank\">https://www.kaggle.com/code/yasufuminakama/fb3-deberta-v3-base-baseline-train</a><br>\n<a href=\"https://www.kaggle.com/yasufuminakama\" target=\"_blank\">@yasufuminakama</a>. Almost all of our scripts are based on this </li>\n<li><a href=\"https://www.kaggle.com/code/vslaykovsky/lb-0-43-ensemble-of-top-solutions\" target=\"_blank\">https://www.kaggle.com/code/vslaykovsky/lb-0-43-ensemble-of-top-solutions</a><br>\n<a href=\"https://www.kaggle.com/vslaykovsky\" target=\"_blank\">@vslaykovsky</a> This notebook made our ensemble easier   </li>\n<li><a href=\"https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/366525#2038773\" target=\"_blank\">https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/366525#2038773</a><br>\nKelvin  <a href=\"https://www.kaggle.com/xyzdivergence\" target=\"_blank\">@xyzdivergence</a> - for sharing ideas that worked -  different max len in ensemble</li>\n<li><a href=\"https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328\" target=\"_blank\">https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328</a><br>\nPost processing is based on commonlit's 2nd place solution method</li>\n<li><a href=\"https://www.kaggle.com/code/electro/deberta-layerwiselr-lastlayerreinit-tensorflow\" target=\"_blank\">https://www.kaggle.com/code/electro/deberta-layerwiselr-lastlayerreinit-tensorflow</a><br>\n<a href=\"https://www.kaggle.com/electro\" target=\"_blank\">@electro</a> We retrained above model on our folds and created pseudo labels</li>\n</ul>\n<h2>Thanks and Acknowledgements</h2>\n<p>Thanks to our hosts for hosting the competition and to teammates. Thanks also to the Kaggler's for sharing their helpful notebooks and discussions.</p>\n<p>Thank you and Congratulations  to my team mates - <a href=\"https://www.kaggle.com/aman1391\" target=\"_blank\">@aman1391</a>, <a href=\"https://www.kaggle.com/kanbehmw\" target=\"_blank\">@kanbehmw</a>, <a href=\"https://www.kaggle.com/fightingmuscle\" target=\"_blank\">@fightingmuscle</a></p>\n<p><strong>Team Members</strong><br>\n<a href=\"https://www.kaggle.com/rashmibanthia\" target=\"_blank\">@rashmibanthia</a><br>\n<a href=\"https://www.kaggle.com/aman1391\" target=\"_blank\">@aman1391</a><br>\n<a href=\"https://www.kaggle.com/kanbehmw\" target=\"_blank\">@kanbehmw</a><br>\n<a href=\"https://www.kaggle.com/fightingmuscle\" target=\"_blank\">@fightingmuscle</a></p>",
      "rawMarkdown": "## Overview\n\nOur team ensembled 26 models in the following table. (including knowledge distilled and pseudo labeled ones) Ridge regression was used to integrate the prediction results of each model. Post-processing was applied to adjust the output values of the final ensemble's predictions. For the single model, the following techniques contributed to score improvement.\n\n- Knowledge distillation and Pseudo labeling\n- Preprocessing - replacing “\\n\\n” with [PARAGRAPH]\n- AWP\n- Change the max len for each epoch\n\n\n| &nbsp; &nbsp; &nbsp; | Model                           | CV / LB            | Description                                                                                                                                                                          |\n| --- | ------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| 1  | Deberta v3 base                 | 0.448| 512 Max length , Pseudo labels inferred from the tensorflow Deberta v3 base (LLRD technique) , and those plus competition data trained on the deberta v3 base (freezing+meanpooling) |\n| 2  | Deberta v3 large                | 0.448              | Same as above , deberta v3 large trained on meanpooling + freezing                                                                                                                   |\n| 3  | Deberta v3 small                | 0.447              | Knowledge distilled model                                                                                                                                                            |\n| 4  | Deberta v2 xlarge               | 0.448 / 0.44| LSTM + mean pooling +freezing (Same pseudo label from tensorflow)                                                                                                                    |\n| 5  | Deberta v3 large                | 0.4495 / 0.43      | Max len = 470, trained with decreasing max len - 768/512/470/470                                                                                                                     |\n| 6  | Deberta v3 base                 | 0.4515 / 0.43      | Max len =470, Mean pooling, AWP, val\\_steps = 250, reinit layers                                                                                                                     |\n| 7  | Deberta xlarge                  | 0.4534 / 0.43      | CLS token, val steps =20                                                                                                                                                             |\n| 8  | deberta v3 large                | 0.4495 / 0.43      | CLS Token, AWP, val steps = 250, max len 768                                                                                                                                         |\n| 9  | Electra large                   | 0.4545             | Meanpool, LSTM                                                                                                                                                                       |\n| 10 | deepset/deberta-v3-bbase-squad2 | 0.4522             |                                                                                                                                                                                      |\n| 11 | Luke Large                      | 0.4551             | Max len 512, Mean pooling, bidirectional-LSTM                                                                                                                                        |\n| 12 | Deberta v3 large                | 0.4467             |                                                                                                                                                                                      |\n| 13 | Deberta v3 base                 | 0.4471             | AutoModelForTokenClassification, last 4 layer concatenate, mean pooling,max\\_len=768                                                                                                 |\n| 14 | Deberta v3 large                | 0.4469             | PL Model, 2 seed averaged, CLS Token                                                                                                                                                 |\n| 16 | Cocolm large                    | 0.4568             | No \\[PARAGRAPH\\], CLS Token, AWP                                                                                                                                                     |\n| 17 | GPT2 Medium                     | 0.4648             | max\\_len=1024, Mean pooling, SWA                                                                                                                                                     |\n| 18 | Longformer Large                | 0.4592             | max\\_len=1536, Mean pooling                                                                                                                                                          |\n| 19 | Bart Large Squad                | 0.4649             | max\\_len=1024, Mean pooling                                                                                                                                                          |\n| 20 | Distill Bart CNN                | 0.4607             | max\\_len=1024, Mean pooling                                                                                                                                                          |\n| 21 | OPT-350M                        | 0.4639             | max\\_len=1536, Mean pooling                                                                                                                                                          |\n| 22 | Bart Base                       | 0.4788             | max\\_len=1024, Mean pooling, SWA                                                                                                                                                     |\n| 23 | T5 Large                        | 0.4717             | max\\_len=1024, Mean pooling                                                                                                                                                          |\n| 24 | Deberta v3 base                 | 0.4490             | max\\_len=512                                                                                                                                                                         |\n| 25 | Deberta v3 base                 | 0.4484             | max\\_len =384                                                                                                                                                                        |\n| 26 | Deberta v3 large                | 0.4498             | max\\_len=1429, Mean pooling, Pseudo Labeling                                                                                                                                         |\n\n\n\n## What worked ? \n\n- **Preprocessing:** - replacing “\\n\\n” with [PARAGRAPH]  There are about 17.5K instances of \\n\\n in the dataset. Deberta v3 large tokenizer simply ignores these. So we decided to create one additional special token by replacing \\n\\n with [PARAGRAPH]. Also resized embeddings to take care of this one extra token. Just this change moved deberta v3 large from 0.44 to 0.43.\n\n- **Knowledge Distillation:** We had one deberta v3 x small model with knowledge distillation. \nWe decided to distill knowledge i.e. (get OOF data)  from an ensemble of 9 models and utilize these to train the model. This is only utilizing current competition data not previous feedback data.\n\n- **Pseudo labels (PL)**  \nThis was challenging to determine if pseudo labels are working or not. We tried generating labels with a few different models to determine if it’s working. Eventually we created two seed deberta v3 large models which seemed more stable than trying to determine with single deberta v3 large. Some of the models in our ensemble were with PL. <br/>\nWe also did pseudo labeling inferred from the tensorflow Deberta v3 base model , which is trained with layer wise learning rate decay (LLRD) technique and used those PL inferred data into some of our models , which helps in improving the cv as well as LB.\n\n- **Model Architecture:**\nJust CLS token, Mean pooling, Mean pooling + CLS token, MaskAddedAttentionHead, MaskAddedAttentionHead + CLS token(AutoModel and AutoModelForTokenClassification) , LSTM\n\n- **Training strategies:**\nAWP worked, different max len per epoch, validation steps 20-250 were utilized for different models. Some of the models were trained using end of epoch validation as well. \nCV was calculated with 5 folds models.\n\n- **Diversity in ensemble:** \nFolds - By Abhishek - https://www.kaggle.com/code/abhishek/multi-label-stratified-folds  <br/>\nWe had ensemble of total 27 models (runtime ~7 hrs)  - 7 Deberta v3 large models, 5 Deberta v3 base, Deberta v2 xlarge, Deberta xlarge, Deberta v3 small, Luke Large, Electra, Cocolm, Deberta v3 base squad, GPT2 medium, Longformer Large, Bart Large Squad, Distill Bart CNN, OPT 350M, Bart base, T5 large\n\n- **Ridge Stacking**\nWe used Ridge for stacking our models, there were 2 deberta large (two seed models) which we combined so that generated only 1 ridge coefficient and it helped in ensemble. \n\n\n- **Post processing**\nWe used “Nelder-mead” https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html  for post processing - divided the predictions into 20 bins and multiplied the resulting array with predictions. \nThis post processing is based on commonlit's 2nd place solution method.\nhttps://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328\n\nOur final ensemble is here - https://www.kaggle.com/code/aman1391/fb3-8th-place-solution-ensemble-27-models?scriptVersionId=112097448\n\n## Ideas that didn’t work\n- **Mask Language modeling:** - Tried many different ways for MLM to work, unsuccessful attempts. Tried to match similarity between FB3 data and previous feedback data for MLM which also didn’t work. \n\n- **Other models:** - Various other models from HuggingFace didn’t work. A few did work however it wouldn’t work with our ensemble so they were unutilized.\n\n- **Different loss functions:** - Focal Loss, Ordinal regression from public kernel, Asymmetric loss - Asymmetric loss did work with a few ensembles but it wasn’t part of our best submission. \n\n- **Ensemble with weights:** - In the last 2 days, we tried ensemble with weight tuning but Ridge did give us better results. This needed more tuning or work for us to feel confident in selecting a submission. \n\n- Many different model architectures, hyperparameters, token dropout, 4 fold model, dividing folds by number of tokens. \n\n## Other\n- **Compute:**  A100s, 4090 (3090 and Colab Pro+ prior to 4090) \n\n- Please see this post for a single model (average 2 seeds) gold solution - https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/369368 and corresponding [training code](https://github.com/rashmibanthia/feedback3) \n\n\n## Important Citations\n- [https://www.kaggle.com/code/yasufuminakama/fb3-deberta-v3-base-baseline-train](https://www.kaggle.com/code/yasufuminakama/fb3-deberta-v3-base-baseline-train)\n@yasufuminakama. Almost all of our scripts are based on this \n- [https://www.kaggle.com/code/vslaykovsky/lb-0-43-ensemble-of-top-solutions](https://www.kaggle.com/code/vslaykovsky/lb-0-43-ensemble-of-top-solutions)\n@vslaykovsky This notebook made our ensemble easier   \n- [https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/366525#2038773](https://www.kaggle.com/competitions/feedback-prize-english-language-learning/discussion/366525#2038773)\nKelvin  @xyzdivergence - for sharing ideas that worked -  different max len in ensemble\n- [https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328](https://www.kaggle.com/competitions/commonlitreadabilityprize/discussion/258328)\nPost processing is based on commonlit's 2nd place solution method\n- [https://www.kaggle.com/code/electro/deberta-layerwiselr-lastlayerreinit-tensorflow](https://www.kaggle.com/code/electro/deberta-layerwiselr-lastlayerreinit-tensorflow)\n@electro We retrained above model on our folds and created pseudo labels\n\n## Thanks and Acknowledgements\n\nThanks to our hosts for hosting the competition and to teammates. Thanks also to the Kaggler's for sharing their helpful notebooks and discussions.\n\nThank you and Congratulations  to my team mates - @aman1391, @kanbehmw, @fightingmuscle\n\n**Team Members**\n@rashmibanthia\n@aman1391\n@kanbehmw\n@fightingmuscle\n\n ",
      "votes": 35
    },
    {
      "id": 2050764,
      "postDate": "2022-12-01T01:25:59.257Z",
      "content": "<p><a href=\"https://www.kaggle.com/rashmibanthia\" target=\"_blank\">@rashmibanthia</a> <br>\nThank you for your solution! and congratulation for being competition master!!!<br>\nI'm so glad to work with you!!!!</p>",
      "rawMarkdown": "@rashmibanthia \nThank you for your solution! and congratulation for being competition master!!!\nI'm so glad to work with you!!!!",
      "votes": 3,
      "replies": [
        {
          "id": 2051286,
          "postDate": "2022-12-01T10:17:00.957Z",
          "content": "<p>Likewise, It was pleasure working with you and Congratulations to you as well 🎉🎉</p>",
          "rawMarkdown": "Likewise, It was pleasure working with you and Congratulations to you as well 🎉🎉",
          "votes": 3
        }
      ]
    },
    {
      "id": 2054678,
      "postDate": "2022-12-04T10:39:46.287Z",
      "content": "<p>Thank you for sharing your valuable solution RB.</p>",
      "rawMarkdown": "Thank you for sharing your valuable solution RB.",
      "votes": 1
    },
    {
      "id": 2051853,
      "postDate": "2022-12-01T16:50:32.610Z",
      "content": "<p><a href=\"https://www.kaggle.com/rashmibanthia\" target=\"_blank\">@rashmibanthia</a> Thanks for the solution!</p>\n<blockquote>\n  <p>So we decided to create one additional special token by replacing \\n\\n with [PARAGRAPH]. Also resized embeddings to take care of this one extra token.</p>\n</blockquote>\n<p>Would you mind sharing a code snippet on how to resize deberta embeddings to take care of this token exactly? Would like to try this but it's not obvious to me how to implement resizing</p>",
      "rawMarkdown": "@rashmibanthia Thanks for the solution!\n\n> So we decided to create one additional special token by replacing \\n\\n with [PARAGRAPH]. Also resized embeddings to take care of this one extra token.\n\nWould you mind sharing a code snippet on how to resize deberta embeddings to take care of this token exactly? Would like to try this but it's not obvious to me how to implement resizing",
      "votes": 2,
      "replies": [
        {
          "id": 2051900,
          "postDate": "2022-12-01T17:39:38.197Z",
          "content": "<p>Code for adding special token: </p>\n<pre><code>CFG.tokenizer = AutoTokenizer.from_pretrained(model)\nCFG.tokenizer.add_special_tokens({: []})\n</code></pre>\n<p>Then, within model class, you need <code>self.model.resize_token_embeddings(len(CFG.tokenizer))</code> (see below code) </p>\n<pre><code> (nn.Module):\n     ():\n        ().__init__()\n\n        self.model_config = AutoConfig.from_pretrained(model_name)\n\n        self.model_config.update(\n            {\n                : ,\n                : ,\n                : ,\n                : CFG.num_labels,\n            }\n        )\n\n        self.model = AutoModel.from_pretrained(model_name, config=self.model_config)\n        self.model.resize_token_embeddings((CFG.tokenizer))\n\n        self.output = nn.Linear(self.model_config.hidden_size, CFG.num_labels)\n\n\n     ():\n        transformer_out = self.model(input_ids=ids, attention_mask=mask)\n        sequence_output = transformer_out.last_hidden_state[:, , :]\n\n        logits = self.output(sequence_output)\n\n         logits \n</code></pre>",
          "rawMarkdown": "Code for adding special token: \n\n```python\nCFG.tokenizer = AutoTokenizer.from_pretrained(model)\nCFG.tokenizer.add_special_tokens({'additional_special_tokens': ['[PARAGRAPH]']})\n\n```\n\nThen, within model class, you need `self.model.resize_token_embeddings(len(CFG.tokenizer))` (see below code) \n\n\n```python\n\nclass FeedBackModel(nn.Module):\n    def __init__(self, model_name):\n        super().__init__()\n\n        self.model_config = AutoConfig.from_pretrained(model_name)\n\n        self.model_config.update(\n            {\n                \"output_hidden_states\": True,\n                \"hidden_dropout_prob\": 0.0,\n                \"add_pooling_layer\": False,\n                \"num_labels\": CFG.num_labels,\n            }\n        )\n\n        self.model = AutoModel.from_pretrained(model_name, config=self.model_config)\n        self.model.resize_token_embeddings(len(CFG.tokenizer))\n\n        self.output = nn.Linear(self.model_config.hidden_size, CFG.num_labels)\n\n\n    def forward(self, ids, mask, targets=None):\n        transformer_out = self.model(input_ids=ids, attention_mask=mask)\n        sequence_output = transformer_out.last_hidden_state[:, 0, :]\n\n        logits = self.output(sequence_output)\n        \n        return logits \n\n```\n",
          "votes": 5
        }
      ]
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T19:59:17Z",
  "competition_id": 38321,
  "competition_slug": "feedback-prize-english-language-learning",
  "team_id": 9090428,
  "solution_url": "/competitions/feedback-prize-english-language-learning/writeups/finally-we-did-it-8th-place-solution"
}