{
  "id": 327197,
  "title": "Hint for a simple but stronger pairwise model baseline",
  "url": "/competitions/AI4Code/discussion/327197",
  "author_name": "",
  "post_date": "2022-05-26T05:44:20.610657800Z",
  "votes": 94,
  "comment_count": 3,
  "views": 0,
  "content": "<p>This is my first time participating in an NLP competition using BERT. I participate in this competition just to learn how to use BERT and how to do pretraining task.<br>\nI want to share a few hints about how to improve the pairwise models. My current pairwise model (0.839 LB) is from a single pairwise model using cosine similarity. It achieves 0.832 at the first epoch but did not improve much later. The CV-LB score correlates very well (0.005~0.007) difference.</p>\n<p>As is shown from my local experiments, a pairwise model using the concatenation of markdown+code performs much better than a model using only cosine similarity. However, the inference time of a pairwise model using concatenation is too long. For the moment, using cosine similarity seems to be a better choice. The embeddings we get can also be used for other purposes.</p>\n<p>The followings are hints to improve a pairwise model using cosine similarity,</p>\n<p><strong>1, Pretraining</strong><br>\npretraining improves my score of distilbert model by around 0.01.<br>\n<strong>2, Sampling strategy</strong><br>\nI made a <a href=\"https://www.kaggle.com/competitions/AI4Code/discussion/326911\" target=\"_blank\">topic </a> for it. Currently, I have no idea how to beat the 0.95 threshold strategy. <br>\n<strong>3, Better embedding for cells</strong><br>\nAs is shown by many articles, [CLS] is not suitable for sentence similarity tasks. A typical better way is using mean pooling.<br>\n<strong>4, Better ranking strategy.</strong><br>\nMy current way to get the rank of cells is using an empirical function created from nowhere by myself. There is obviously a better way to it.<br>\n<strong>5, Global context information</strong><br>\nFor a pairwise model, we lack the information from global context. I believe this will be the key point that decides the final winner. <br>\n<strong>6, Post-processing</strong><br>\nThis part is tricky. I have no experience in NLP before so I have no idea atm.</p>\n<p>I will make notebooks for the improvements I made when I find it is suitable to publish them.<br>\nps: please upvote the notebooks if you find them helpful :D</p>",
  "messages": [
    {
      "id": "1801753",
      "postDate": "05/26/2022 05:44:20",
      "content": "<p>This is my first time participating in an NLP competition using BERT. I participate in this competition just to learn how to use BERT and how to do pretraining task.<br>\nI want to share a few hints about how to improve the pairwise models. My current pairwise model (0.839 LB) is from a single pairwise model using cosine similarity. It achieves 0.832 at the first epoch but did not improve much later. The CV-LB score correlates very well (0.005~0.007) difference.</p>\n<p>As is shown from my local experiments, a pairwise model using the concatenation of markdown+code performs much better than a model using only cosine similarity. However, the inference time of a pairwise model using concatenation is too long. For the moment, using cosine similarity seems to be a better choice. The embeddings we get can also be used for other purposes.</p>\n<p>The followings are hints to improve a pairwise model using cosine similarity,</p>\n<p><strong>1, Pretraining</strong><br>\npretraining improves my score of distilbert model by around 0.01.<br>\n<strong>2, Sampling strategy</strong><br>\nI made a <a href=\"https://www.kaggle.com/competitions/AI4Code/discussion/326911\" target=\"_blank\">topic </a> for it. Currently, I have no idea how to beat the 0.95 threshold strategy. <br>\n<strong>3, Better embedding for cells</strong><br>\nAs is shown by many articles, [CLS] is not suitable for sentence similarity tasks. A typical better way is using mean pooling.<br>\n<strong>4, Better ranking strategy.</strong><br>\nMy current way to get the rank of cells is using an empirical function created from nowhere by myself. There is obviously a better way to it.<br>\n<strong>5, Global context information</strong><br>\nFor a pairwise model, we lack the information from global context. I believe this will be the key point that decides the final winner. <br>\n<strong>6, Post-processing</strong><br>\nThis part is tricky. I have no experience in NLP before so I have no idea atm.</p>\n<p>I will make notebooks for the improvements I made when I find it is suitable to publish them.<br>\nps: please upvote the notebooks if you find them helpful :D</p>",
      "rawMarkdown": "This is my first time participating in an NLP competition using BERT. I participate in this competition just to learn how to use BERT and how to do pretraining task.\nI want to share a few hints about how to improve the pairwise models. My current pairwise model (0.839 LB) is from a single pairwise model using cosine similarity. It achieves 0.832 at the first epoch but did not improve much later. The CV-LB score correlates very well (0.005~0.007) difference.\n\nAs is shown from my local experiments, a pairwise model using the concatenation of markdown+code performs much better than a model using only cosine similarity. However, the inference time of a pairwise model using concatenation is too long. For the moment, using cosine similarity seems to be a better choice. The embeddings we get can also be used for other purposes.\n\nThe followings are hints to improve a pairwise model using cosine similarity,\n\n**1, Pretraining**\npretraining improves my score of distilbert model by around 0.01.\n**2, Sampling strategy**\nI made a [topic ](https://www.kaggle.com/competitions/AI4Code/discussion/326911) for it. Currently, I have no idea how to beat the 0.95 threshold strategy. \n**3, Better embedding for cells**\nAs is shown by many articles, [CLS] is not suitable for sentence similarity tasks. A typical better way is using mean pooling.\n**4, Better ranking strategy.**\nMy current way to get the rank of cells is using an empirical function created from nowhere by myself. There is obviously a better way to it.\n**5, Global context information**\nFor a pairwise model, we lack the information from global context. I believe this will be the key point that decides the final winner. \n**6, Post-processing**\nThis part is tricky. I have no experience in NLP before so I have no idea atm.\n\nI will make notebooks for the improvements I made when I find it is suitable to publish them.\nps: please upvote the notebooks if you find them helpful :D",
      "votes": null
    },
    {
      "id": "1802462",
      "postDate": "05/26/2022 18:39:41",
      "content": "<p>Thank you for shearing your tips.</p>",
      "rawMarkdown": "Thank you for shearing your tips.",
      "votes": null
    },
    {
      "id": "1804792",
      "postDate": "05/29/2022 13:13:08",
      "content": "<p>Thanks ,for sharing the tips. This will help to make the learning curve smooth.</p>",
      "rawMarkdown": "Thanks ,for sharing the tips. This will help to make the learning curve smooth.",
      "votes": null
    },
    {
      "id": "1834608",
      "postDate": "06/27/2022 04:43:09",
      "content": "<p>\"Using only cosine similarity\" - does this mean getting single sentence (CLS?) embeddings for each cell and then just applying a cos sim without any training and using those sim scores somehow to create the final rank or was there training involved in that using some cos-sim-loss or something ? <br>\nI was unable to find the pure cos sim notebook, if it was published can you share the link! ? Thanks!</p>",
      "rawMarkdown": "\"Using only cosine similarity\" - does this mean getting single sentence (CLS?) embeddings for each cell and then just applying a cos sim without any training and using those sim scores somehow to create the final rank or was there training involved in that using some cos-sim-loss or something ? \nI was unable to find the pure cos sim notebook, if it was published can you share the link! ? Thanks!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1802462,
      "author_name": "locbaop",
      "author_url": "",
      "post_date": "05/26/2022 18:39:41",
      "content": "<p>Thank you for shearing your tips.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1804792,
      "author_name": "mahendrasinghrajpoot",
      "author_url": "",
      "post_date": "05/29/2022 13:13:08",
      "content": "<p>Thanks ,for sharing the tips. This will help to make the learning curve smooth.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1834608,
      "author_name": "thedoors0",
      "author_url": "",
      "post_date": "06/27/2022 04:43:09",
      "content": "<p>\"Using only cosine similarity\" - does this mean getting single sentence (CLS?) embeddings for each cell and then just applying a cos sim without any training and using those sim scores somehow to create the final rank or was there training involved in that using some cos-sim-loss or something ? <br>\nI was unable to find the pure cos sim notebook, if it was published can you share the link! ? Thanks!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1801753": "This is my first time participating in an NLP competition using BERT. I participate in this competition just to learn how to use BERT and how to do pretraining task.\nI want to share a few hints about how to improve the pairwise models. My current pairwise model (0.839 LB) is from a single pairwise model using cosine similarity. It achieves 0.832 at the first epoch but did not improve much later. The CV-LB score correlates very well (0.005~0.007) difference.\n\nAs is shown from my local experiments, a pairwise model using the concatenation of markdown+code performs much better than a model using only cosine similarity. However, the inference time of a pairwise model using concatenation is too long. For the moment, using cosine similarity seems to be a better choice. The embeddings we get can also be used for other purposes.\n\nThe followings are hints to improve a pairwise model using cosine similarity,\n\n**1, Pretraining**\npretraining improves my score of distilbert model by around 0.01.\n**2, Sampling strategy**\nI made a [topic ](https://www.kaggle.com/competitions/AI4Code/discussion/326911) for it. Currently, I have no idea how to beat the 0.95 threshold strategy. \n**3, Better embedding for cells**\nAs is shown by many articles, [CLS] is not suitable for sentence similarity tasks. A typical better way is using mean pooling.\n**4, Better ranking strategy.**\nMy current way to get the rank of cells is using an empirical function created from nowhere by myself. There is obviously a better way to it.\n**5, Global context information**\nFor a pairwise model, we lack the information from global context. I believe this will be the key point that decides the final winner. \n**6, Post-processing**\nThis part is tricky. I have no experience in NLP before so I have no idea atm.\n\nI will make notebooks for the improvements I made when I find it is suitable to publish them.\nps: please upvote the notebooks if you find them helpful :D",
    "1802462": "Thank you for shearing your tips.",
    "1804792": "Thanks ,for sharing the tips. This will help to make the learning curve smooth.",
    "1834608": "\"Using only cosine similarity\" - does this mean getting single sentence (CLS?) embeddings for each cell and then just applying a cos sim without any training and using those sim scores somehow to create the final rank or was there training involved in that using some cos-sim-loss or something ? \nI was unable to find the pure cos sim notebook, if it was published can you share the link! ? Thanks!"
  },
  "source": "meta"
}