# Forward-only library

**URL:** <https://dev-discuss.pytorch.org/t/forward-only-library/3301>\
**Category:** hardware-backends\
**Created:** [February 3, 2026, 2:13pm UTC](https://dev-discuss.pytorch.org/t/forward-only-library/3301 "2026-02-03T14:13:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spiegelball](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@spiegelball](https://dev-discuss.pytorch.org/u/spiegelball)\
**Post date:** [February 3, 2026, 2:13pm UTC](https://dev-discuss.pytorch.org/t/forward-only-library/3301/1 "2026-02-03T14:13:39Z")

</div>

I am looking into compiling libtorch into a “forward-only“ version, e.g. dropping all the CUDA backward kernels. This would result in lower binary sizes for inference. Did anybody try something like this before?

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [February 27, 2026, 3:49pm UTC](https://dev-discuss.pytorch.org/t/forward-only-library/3301/2 "2026-02-27T15:49:57Z")

</div>

Hey!

I’m afraid this is not something that exists nor will be easy to do.

The libtorch binary itself is very much monolithic and not built to do selective build from the ground up.

Executorch on the other hand is built for that from the ground up and has very good selective build if you can Export your model. The binary size will be 1000x smaller as well !

Cheers,

Alban

---

<div class="post-metadata">

**Author:** ![spiegelball](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@spiegelball](https://dev-discuss.pytorch.org/u/spiegelball)\
**Post date:** [June 1, 2026, 9:17am UTC](https://dev-discuss.pytorch.org/t/forward-only-library/3301/3 "2026-06-01T09:17:28Z")

</div>

Ok, great, thanks for the info. Will look more into ExecuTorch.
