# Will using transformers improve textcat\_multilabel score/accuracy?

**URL:** <https://support.prodi.gy/t/will-using-transformers-improve-textcat-multilabel-score-accuracy/6199>\
**Category:** Uncategorized\
**Tags:** solved, transformers, textcat\
**Created:** [December 21, 2022, 7:23pm UTC](https://support.prodi.gy/t/will-using-transformers-improve-textcat-multilabel-score-accuracy/6199 "2022-12-21T19:23:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joebuckle](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@joebuckle](https://support.prodi.gy/u/joebuckle)\
**Post date:** [December 21, 2022, 7:23pm UTC](https://support.prodi.gy/t/will-using-transformers-improve-textcat-multilabel-score-accuracy/6199/1 "2022-12-21T19:23:40Z")

</div>

We are currently training on a CPU and we are getting 70% on the textcat score. Is there a guarantee that using transformers will improve our results a lot? We don't want to spend a lot on a GPU if the improvement is not that significant.

Thanks.

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [December 21, 2022, 8:25pm UTC](https://support.prodi.gy/t/will-using-transformers-improve-textcat-multilabel-score-accuracy/6199/2 "2022-12-21T20:25:33Z")

</div>

hi @joebuckle!

> [@joebuckle](#):
>
> Is there a guarantee that using transformers will improve our results a lot? We don't want to spend a lot on a GPU if the improvement is not that significant.

There aren't guarantees transformers will always lead to better performance for GPU. I would say on average, yes, we would expect them to do better but at what cost?

The only likely guarantee is that productionalizing your model will be harder (e.g., longer time to score, more memory). Vincent mentioned this previously:

> [@Should I be using --base-model when training my model?](https://support.prodi.gy/t/should-i-be-using-base-model-when-training-my-model/5626/2):
>
> Could you share the exact commands that you tried running? That might help me reproduce the error that you're seeing. Also, just to confirm, are you running recent versions of Prodigy/spaCy/Python? In general, you can switch the base model, which is the starting point for the training procedure, and this could result in better/worse-performing models. In particular, the en\_core\_web\_trf typically yields good accuracy, but it does come at the cost of speed. This pipeline contains a transformer mo…

The spaCy team has done some benchmarks using transformers in spaCy based on [speed](https://spacy.io/usage/facts-figures#benchmarks-speed) and it's clear transformers slow end-to-end processing speed.

But there are other steps when using GPU/transformers. Here's a [great FAQ of using GPUs](https://github.com/explosion/spaCy/discussions/11436) in spaCy and the setup of CUDA drivers, etc.. You can also view many [spaCy issues mentioning GPU's](https://github.com/explosion/spaCy/discussions?discussions_q=gpu) that include problems like out-of-memory issues.

Another problem with using transformers is properly accounting for sub-word tokenization. If you have experience it may not be a huge problem and there's [Prodigy docs](https://prodi.gy/docs/named-entity-recognition/#transformers-tokenizers) on how to handle this. However, you likely already have limited time and it's one additional factor that could add more complexity to your process.

Now with that being said, if you have a lot of experience, there's definitely a lot of potential to increase accuracy with transformers. For example, two of our teammates have been doing testing on optimizing speed for transformers and wrote a great blog on recent testing with Apple GPUs:

> **[Fast transformer inference with Metal Performance Shaders · Explosion](https://explosion.ai/blog/metal-performance-shaders/)**
>
> We are happy to introduce support for Metal Performance Shaders in Thinc PyTorch layers. This makes it possible to run spaCy transformer-based pipelines on GPU on Apple Silicon Macs and improves inference speed up to 4.7 times.

But if you're just starting out, I think it could be more cost without guaranteed performance gains.

In summary, I go back to Matt's [ML Hierarchy of Needs](https://youtu.be/jpWqz85F_4Y):

 ![image](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/1/1e5a36cde31a7aec24926011bf82ca23ad1c6627.jpeg)

That is, sometimes how to frame your problem (e.g., your annotation schemes for entities) is much more important than optimizing your architecture and/or hyperparameters.

Personally, I prefer to start with a good way to frame the problem and get the model to production as it's never a trivial task. But after getting a good production workflow and evaluating the model over some time, you could then want to create a champion vs. challenger setup where you can test transformers as challenger models run. At that point, it may be a better time to evaluate transformers.

---

<div class="post-metadata">

**Author:** ![joebuckle](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@joebuckle](https://support.prodi.gy/u/joebuckle)\
**Post date:** [January 3, 2023, 1:43am UTC](https://support.prodi.gy/t/will-using-transformers-improve-textcat-multilabel-score-accuracy/6199/3 "2023-01-03T01:43:32Z")

</div>

Thank you! 🙂
