# Custom loss and model implementatiom

**URL:** <https://discuss.ray.io/t/custom-loss-and-model-implementatiom/14975>\
**Category:** Configure Algorithm, Training, Evaluation, Scaling\
**Created:** [June 15, 2024, 5:29am UTC](https://discuss.ray.io/t/custom-loss-and-model-implementatiom/14975 "2024-06-15T05:29:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smallsuper](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@smallsuper](https://discuss.ray.io/u/smallsuper)\
**Post date:** [June 15, 2024, 5:29am UTC](https://discuss.ray.io/t/custom-loss-and-model-implementatiom/14975/1 "2024-06-15T05:29:22Z")

</div>

I am looking to implement a custom model and loss function using the new API stack. Can someone guide me to a straightforward example of a custom MLP and LSTM model to get started?

---

<div class="post-metadata">

**Author:** ![smallsuper](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@smallsuper](https://discuss.ray.io/u/smallsuper)\
**Post date:** [June 16, 2024, 5:27am UTC](https://discuss.ray.io/t/custom-loss-and-model-implementatiom/14975/2 "2024-06-16T05:27:37Z")

</div>

@PhilippWillms

I’m working on a project related to using RL to dynamic adjust learning rate during model training. I want to create a custom policy networks ( basically MLP and LSTM). While the old API has similar examples such as fcnet etc. I can’t find any similar examples for the new API. Could you assist with a simple example or a layout how the policy network should look like for the new api?

---

<div class="post-metadata">

**Author:** ![PhilippWillms](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/philippwillms/32/3885_2.png) [@PhilippWillms](https://discuss.ray.io/u/PhilippWillms)\
**Post date:** [June 16, 2024, 2:41pm UTC](https://discuss.ray.io/t/custom-loss-and-model-implementatiom/14975/3 "2024-06-16T14:41:55Z")

</div>

Thanks for asking me on that. However, due to other obligations I am currently operating more with the “old” API Stack. Starting point would be the updated sub-folder `rllib/examples` in the ray git repository, and from there digging deep in the new API by reading the code docs and experimenting.

---

<div class="post-metadata">

**Author:** ![Ralph\_Harris](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/ralph_harris/32/6254_2.png) [@Ralph\_Harris](https://discuss.ray.io/u/Ralph_Harris)\
**Post date:** [June 25, 2024, 3:01am UTC](https://discuss.ray.io/t/custom-loss-and-model-implementatiom/14975/4 "2024-06-25T03:01:41Z")

</div>

I’d love to hear about any updates/progress with this topic. there is interest…
