页面简介
Explore KerasRS, a new library built on Keras 3 with state-of-the-art recommendation techniques with multi-backend support.
正文摘录
TensorFlow / Keras Build and train a recommender system in 10 minutes using Keras and JAX MAY 13, 2025 Yufeng Guo Developer Advocate Core ML Frameworks Monica Song Product Manager Share Facebook Twitter LinkedIn Mail Today, we are excited to announce the launch of Keras Recommenders, a new library that puts state-of-the-art recommendation techniques at your fingertips.Power digital experiences with recommendation systemsRecommendation systems power many of the interactions you have with technology today. Open up any app on your phone and you’ll likely find yourself interacting with a recommendation model right away, from the homefeed on your go-to social media platform to video suggestions on YouTube to even the ads that pop up in your favorite game. As the world of AI continues to evolve, delivering personalized experiences is more important than ever. Large language models can't do everything, and recommender systems are responsible for creating many top-tier digital experiences today.To help developers create performant and accurate recommender systems, Keras Recommenders (KerasRS) contains a set of APIs with building blocks designed for tasks such as ranking and retrieval. For example, at Google, we use KerasRS to help power the feed in Google Play.Install KerasRS with JAX, TensorFlow, or PyTorchTo get started, pip install the keras-rs package. Then set the backend to JAX (or TensorFlow or PyTorch). Now you are on your way to crafting your own state-of-the-art recommender system. import os os.environ["KERAS_BACKEND"] = "jax" import keras import keras_rs class SequentialRetrievalModel(keras.Model): def __init__(self): self.query_model = keras.Sequential([ keras.layers.Embedding(query_count, embed_dim), keras.layers.GRU(embed_dim), ]) self.candidate_model = keras.layers.Embedding(candidate_count, embed_dim) self.retrieval = keras_rs.layers.BruteForceRetrieval(k=10) self.loss_fn = keras.losses.CategoricalCrossentropy(from_logits=True) def call(self, inputs): query_embeddings = self.query_model(inputs) predictions = self.retrieval(query_embeddings) return {"query_embeddings": query_embeddings, "predictions": predictions} Python Copied In this example, we show a popular retrieval architecture in which we identify a set of candidate recommendations. KerasRS provides everything you need to implement this architecture, with specialized layers, losses, and metrics designed specifically for recommender tasks. You can also follow along in this colab notebook.And of course, all these building blocks work with the standard Keras APIs of model.compile to build your model and model.fit to easily configure your training loop. model.compile( loss=keras_rs.losses.PairwiseHingeLoss(), metrics=[keras_rs.metrics.NDCG(k=8, name="ndcg")], optimizer=keras.optimizers.Adagrad(learning_rate=3e-4), ) model.fit(train_ds, validation_data=val_ds, epochs=5) Python Copied In the coming months, we plan to release the keras_rs.layers.DistributedEmbedding class for leveraging SparseCore chips on TPU for doing large embedding lookups distributed across machines. Additionally, we will add popular model implementations to our library continuously, making it even easier to build state-of-the-art recommender systems.Explore the KerasRS documentation and examplesWe also want to highlight all the documentation we have for Keras Recommenders on our recently redesigned keras.io website. On keras.io/keras_rs, you can find starter examples involving the classic Deep and Cross Network (DCN) and two-tower embedding model that show the step-by-step processes for writing and training your first recommender. There are also more advanced tutorials, such as SASRec, showing an end-to-end example of training a transformer model. Sorry, your browser doesn't support playback for this video Get startedVisit our website today for more examples, documentation, and guides to build your very own recommendation system. You can also browse the code and contribute at https://github.com/keras-team/keras-rs (feel free to give it a star ⭐ too while you’re there!).We look forward to seeing all the excellent recommendation systems that get built with Keras Recommenders.AcknowledgementsShout-out to Fabien Hertschuh and Abheesht Sharma for building Keras Recommenders. We also want to thank the Keras and ML Frameworks teams as well as all our collaborators and leadership for helping us pull this off. posted in: TensorFlow Keras Mobile Web Announcements Solutions JAX PyTorch Machine Learning RecSys Previous Next Related Posts Mobile Web Tutorials How-To Guides A2UI 1.0: Build delightful, fast, reliable, agentic experiences NOV. 11, 2026 AI Cloud Announcements Agent Anomaly Detection: Safeguarding agents across other clouds NOV. 20, 2026 Keras AI Announcements Farewell and thank you for the continued partnership, Francois Chollet! NOV. 13, 2024 Mobile AI Case Studies Announcements Accelerating development for massive Git repositories NOV. 17, 2026 Kaggle Keras AI Tutorials How-To Guides Using KerasHub for easy end-to-end machine learning workflows with Hugging Face JUNE 24, 2025 Gemini AI Cloud Announcements Best Practices Check what your AI agents do before they do it, with Semantic governance policies NOV. 20, 2026