Changing the window size of a NER model

Can the window size be changed easily? E.g. if I want to use the 8 preceding and 8 following tokens as context to determine if a span is some entity.

I assume I'd have to write my own train recipe exploiting some input from spacy train?

Did this one fly under the radar? :thinking:


Sorry, yes it did! I've experimented a bit with the window size, which is basically the depth of the CNN. It's tricky to get benefits without also making the layers wider, which in turn makes things slower and prone to overfitting. So you end up having to tweak a number of other parameters. The best solution is to use the spacy pretrain command to do language model pretraining, to avoid the overfitting. You can find a worked example along with the weights required here:

In general it will be much easier to experiment with these things in Prodigy v2, when we switch over to spaCy v3. We did a lot of work over December and January to update Thinc machine learning library underneath spaCy and Prodigy, so that it will be easier to bring your own model. We're looking forward to updating the stack to use it.

1 Like