Active learning in spacy 3 #11201
-
Hi all! There are some other discussions dissuading people from trying to run Language.update() manually and instead run For context, I'd like to use a tool like Label Studio (no help needed on that end, just for reference) to label documents then send off to a model that we've already trained given some documents, on textcat and named entity recognition, for updating given a single new document and then use the resulting updated Language object for determining best next documents to label. I also understand that update != same results as just training from scratch, which we definitely intend to do after a big batch of docs. We've been able to make an Example doc easily enough, and run nlp.update() on it, which does spit out losses. And running the same doc through (along with the resultant losses) multiple times does seem to further update the losses, but try as we might we can't get any behavior to change for our trained NER+textcat model. No change to any predicted entities, nor change to textcat prediction confidence. Surely I'm doing something wrong, but looking at the documentation and other discussions here, I can't figure out how to update a custom spacy 3 model one doc at a time. Some code:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Active learning and incremental training are different things. "Active learning" means you make some annotations, update the model, and make some more annotations. Exactly how you update the model is not critical. "Incremental training" is one term for updating a model with a small number number of examples rather than completely retraining. "Online learning" is a closely related concept. These are both hard to do with neural networks due to the catastrophic forgetting problem. So it's entirely possible to do active learning without incremental updates. For CPU models with small/moderate amounts of data, training should be fast enough that it's no big deal to retrain models repeatedly in an annotation loop. |
Beta Was this translation helpful? Give feedback.
-
Active learning is about choosing which unlabelled data to label (manually) next. Then adding the new labels you train from scratch or fine-tune the existing model to get a new set of unlabelled data to look at. The problem is that neural networks may be inappropriately confident so you might miss some data points that should have been manually labelled. But hopefully your active learning framework is also able to detect outlier data points and route them to your manual process. You should also double-check your existing labels. Something like doubtlab which is maintained by an Explosion employee. Or cleanlab from some MIT researchers. |
Beta Was this translation helpful? Give feedback.
Active learning and incremental training are different things.
"Active learning" means you make some annotations, update the model, and make some more annotations. Exactly how you update the model is not critical.
"Incremental training" is one term for updating a model with a small number number of examples rather than completely retraining. "Online learning" is a closely related concept. These are both hard to do with neural networks due to the catastrophic forgetting problem.
…