<p>The answer to the similar question of yours can be found in the paper <a href="https://stackoverflow.com/questions/58636587/how-to-use-bert-for-long-text-classification/63413589#63413589">here</a>.</p>
<p>Why do you think the chunks of the same document will have different labels if you're talking about classiffcation of texts as news or clickbaits? You can chunk the text and follow the idea of truncation approach proposed in How to <a href="https://stackoverflow.com/questions/58636587/how-to-use-bert-for-long-text-classification/63413589#63413589">Fine-Tune BERT for Text Classification?</a>. The authors show that head+tail truncating delivers high accuracy. I used it several times thanks to the <a href="https://github.com/xuyige/BERT4doc-Classification" rel="nofollow noreferrer">Github</a> page and documentation and got good results.</p>
<p>You can choose the truncation method with a flag <strong>--trunc_medium</strong> with the options:</p>
<ol>
<li>-2 means head-only (keep the first 512 tokens),</li>
<li>-1 means tail-only (keep the last 512 tokens),</li>
<li>0 means head-half + tail-half (e.g.: head256+tail256),</li>
<li>other natural number k means head-k + tail-rest (e.g.: head-k + tail-(512-k)).</li>
</ol>
<p>Then you may pool the results for the chunks creating the Pooled embeddings for the long texts you have.</p>
<p>Here I will also continue discussion about the state-of-the-art approaches for the classification of long texts with BERT reffering to Big BIRD (see the <a href="https://arxiv.org/pdf/2007.14062.pdf" rel="nofollow noreferrer">article</a>). The researchers from Google build on the idea of <a href="https://arxiv.org/pdf/2004.05150.pdf" rel="nofollow noreferrer">Longformers</a> and <a href="https://arxiv.org/abs/2004.08483" rel="nofollow noreferrer">Extended Transformers Construction</a>. Basically they propose combine the idea of Longformers and Randomized Attention that reduces quadratic dependency on the sequence length to linear. You can try even 10000-wording texts. The approach is interesting however, it requires architecture with more layers.</p>
<p>Plese check also the stackoverflow <a href="https://stackoverflow.com/questions/58636587/how-to-use-bert-for-long-text-classification/63413589#63413589">question</a>.</p>
how to use bert for long sentences?
<p>I am trying to classify given text into news, clickbait or others. The texts which I have for training are long.<a href="https://i.stack.imgur.com/R5N6l.png" rel="nofollow noreferrer">distribution of lengths is shown here.</a>
Now, the question is should I trim the text at the middle and make it 512 tokens long? But, I have even documents with circa 10,000 words so won't I loose the gist by truncation? Or, should I split my text into sub texts of 512 length. If so, then the sub text of one text may be similar to subtext of another text but the labels will be different. Doesn't it become noisy data? Or, should I just use bidirectional LSTM's here and pad to max_len?</p>