Yes, breaking up long documents into smaller chunks can definitely be beneficial when using sequence-to-sequence models:
-
It reduces the overall sequence length which helps mitigate issues like vanishing gradients and poor long-range dependency learning during training.
-
Smaller chunks allow the model to focus on local contexts and dependencies within each chunk. This can help the model learn better representations.
-
Segmenting documents into logical sections/sub-sections allows you to process different chunks independently and potentially in parallel to utilize GPU/TPU resources better.
-
At test time, breaking up inputs reduces memory usage and latency since the model does not have to process overly long sequences in one go.
-
The model outputs for each chunk can be aggregated later to produce the final output for a long document.
The ideal chunk size would depend on your model architecture, task, and dataset characteristics. But as a rule of thumb for sequence-to-sequence models today, chunk sizes from 256 to 512 tokens tend to work well in many cases.
You can experiment with different chunk sizes and chunking strategies like by paragraphs, sections, semantic content etc. to find the optimal balance between context modeling and computational efficiency for your problem. The chunks should not be too small to lose important context.