# Nx vs. Python performance for sentence-transformer encoding

**URL:** <https://forum.elixirforum.com/t/nx-vs-python-performance-for-sentence-transformer-encoding/56502>\
**Category:** Questions\
**Tags:** benchmark, nx\
**Created:** [June 14, 2023, 3:53pm UTC](https://forum.elixirforum.com/t/nx-vs-python-performance-for-sentence-transformer-encoding/56502 "2023-06-14T15:53:14Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![josevalim](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/32/1787_2.png) [@josevalim](https://forum.elixirforum.com/u/josevalim)\
**Post date:** [June 25, 2023, 5:40pm UTC](https://forum.elixirforum.com/t/nx-vs-python-performance-for-sentence-transformer-encoding/56502/19 "2023-06-25T17:40:30Z")

</div>

> I’ve been thinking about the following: couldn’t we also allow a dynamic sequence length and just in time compile when we first get an input with a specific sequence length? Further requests should then be compiled. As the sequence length is finite, this would mean that one could either pre-compile every sequence length or “warmup” the serving.

We can do that for sure but it means you may compile the program several times. But it is something I will consider while exploring these ideas. 🙂

---

_[View the full topic](https://forum.elixirforum.com/t/nx-vs-python-performance-for-sentence-transformer-encoding/56502)._
