Content Recommendation with Graphs: From Basic Walks to Neural Networks
In this talk, we'll explore how the complex problem of content recommendation transforms when viewed through the innovative lens of graph algorithms.
Imagine a world where content and users form a bi-partite graph, and the key to unlocking personalized recommendations lies in predicting links and weights within this graph. We'll embark on a journey starting from the foundational graph-based recommender models, where simple graph walks lay the groundwork.
As we delve deeper, we'll uncover the potent capabilities of graph embeddings and the transformative impact of Graph Neural Networks.
Finally, we'll wrap up with valuable insights on the scenarios where graph-based approaches shine the brightest in solving recommender problems. Whether you're a seasoned data scientist or new to the field of machine learning, this talk will equip you with a fresh perspective on leveraging graphs for sophisticated and effective content recommendation strategies.
This session took place in track Machine Learning & Deep Learning & Stats and was classified suitable for intermediate domain / intermediate python by the speaker.
Transcript (auto)
Auto-generated from the recording utilizing Open-Source AI. Speaker labels (Speaker 1, Speaker 2) reflect diarization, not identity. Timestamps refer to the recording.
Speaker 1 [00:05]
Thanks a lot for joining me. I'm not sure if I will tell you everything, but I'll just tell you something interesting about the content recommendation with graphs, and we will speak about the basic works to graph neural networks. I am a CEO of Halcon EAI. This is a consulting company out of Munich. We specialize in machine learning and data science, and I personally, I worked, so as the announcement came, I hold a PhD in graph embeddings. back then it was graph drawing so particularly interested in 2d and 3d now it's outdated and i also develop design and develop the recommender system powering i have the audio take so those of you from from germany know what i have the audio take is so no surprise that i connected the two here so at the beginning actually i will tell you what i'm going to tell you in this talk first i'm going to tell you about the value of the recommender system so why they actually exist i will walk you through very quickly through the beginnings and the latest developments in the field of recommender systems and then we will dive deeper in the graph in the basic graph base model such that some of the graph embedding inspired models then page rank walks personalized walks and so on and then i will conclude with a little deeper dive into graph neural networks and in the end i will just remind you of what i've told you during this talk so let's speak about the recommender system so a typical recommender system as you see here consists of practically two components so this is the user on the one hand side and then there is the application offering certain products to the user the products can be types of media such as songs and movies or can be hardware such as smartphones and cameras and the user typically expresses certain implicit or explicit feedback related to the items offered by the application when i say implicit feedback that basically means like the relative duration of the particular user item pair in case the the item is a movie or a song so relative duration the the user spent with this item like 70 percent of the song listened 80 percent of the movie watched and so on and for instance the the explicit feedback would be like thumbs up or it can be actually that the user both the the item or actually negative feedback such that the user disliked the item all of these signals implicit and explicit are then fed back into the recommender system that figures out what are the the set of items to recommend back to the user such that there is a high probability that the user will continue interacting with the system so to answer the first question that i announced it with the agenda so why a recommender system why does a recommender system exist so i I will exemplify it with the story of the greatest players in the field. So Amazon attributes around 35% of its sales to its personalized recommendation engine. Netflix estimated to save a company around 1 billion per year by reducing churn. And those of you who know about the recommender system know actually that Netflix is the company that started most of the developments in the recommender system with the famous Netflix price of 1 million. And I will tell you more about this Netflix price a little bit later. But, however, a very interesting thing, I don't know if this is by accident. Me, as a data scientist, I think it's not by accident that I never met anyone who said that a Netflix recommender is a good one, but still it's what they claim to be very good. Okay, and as for YouTube, so their recommended system is responsible for over 70% of the total time spent on the platform. At one point, at a time of my life, I can tell you that it was more than 70% on YouTube, definitely. Okay, so early days versus the latest developments. Obviously, you can assume that the earliest days of the recommender system were just some filtration-based algorithms that practically learned about the categories that the user liked and then practically did the filtration before displaying the items. and then came the K-nearest neighbors approaches where literally they were devised several ways to represent the users and the user will be represented as one hot encoded vector of the item so index-based ISM that the user liked and then the vectors get compared, the similar users get the similar items and so on. And out of this was born the collaborative filtering paradigm and collaborative filtering rests on the assumptions that the user who actually shows similar behavior in consumption will show similar behavior in the future. And then there was a matrix factorization which combined explicit and implicit feedback, which we talked about before, and which was born practically the motive behind it was the, how do I say, the most advanced developments behind the matrix factorization family of algorithms was to the Netflix price. And, for instance, one of the Netflix prizes was in 2009, and it combined, matrix factorization was one of the leading models, but it combined around 105 models in the end, so it was an ensemble model. It never got to production, but they still awarded one million to the winning team of Bell Corps, which is Bell Labs, and Yehuda Koren, which is one of the famous researchers back then. However, as you may assume, that with more available metadata, so when you're speaking about recommender systems, there are three types of data like there is the data on the side of the user there is the data on the side of the item and then there is the data on the side in between which is the interaction data right everything that that comes into play when it when it comes to interactions right so the time of the day whatever the the the time of the year and so on and obviously with the more data deep learning approaches became attractive and then also there is the the famous two tower approaches developed by Google with their TensorFlow library and there are the so-called multi-stage models where I will show you what it basically is. So here I practically show you like a two-stage model that comes from a YouTube recommender and so the basic idea is since these platforms have an extremely large pool of data the purpose of the candidate generation is basically to narrow down the search for the ranker So out of, I don't know, 100 million of items, they produce, literally they narrow down the search to a couple of hundreds of items, so which you see here in the ranking side, and then these hundreds of items in the ranking sides get enriched with some video features and some user characteristics, and then the ranker practically produces the personalized ranking of the items for the user such that the probability is higher, that the user will be clicking on the items that are closer to the top. Typically, this is not a two-stage approach. This is like a multi-stage approach in a typical recommender systems. And I have to say that the recommender systems can be personalized recommenders, which means that they scan or they take into account the user browsing history, or they can be actually content-based. So irrelevant on your history, whatever item you click on, the item similarly will be displayed to you. So, for instance, in the audio take, we had Empfehlungen für dich, So recommendations for you. Then we had Endliche Inhalte, so similar content, or Andere Hörte Now. So this is like others also browse, others also listen to something like you had in early days in Amazon. Okay, so here is, I want to remind you, also those of you who are more proficient in recommender systems about the collaborative filtering, why I'm doing this, because I want you to then look at this algorithm through the lens of the graph algorithm. And there was a paper last year by Rendler and Yehuda Koren. So Rendler is author of Factorization Machines, so a pretty big shot in the field of recommenders. And Yehuda is the author of the Matrix Factorization, also a big shot who won the Netflix Award. So they published a paper where they revisited implicit alternative least-wear algorithms. So this is weighted matrix factorization. And they actually claimed that in the use case where there is no additional metadata on the users and on the item side, so basically you only have the user item spares possibly with some kind of indication of the likeliness or how much the user liked the item, then the AILS performs far better than the competitive algorithms. One of the parameters that they showed that it was very often overlooked is the actual embedding space. So we typically, for the audio take when we experimented, we take embedding space to have like 128 dimensions and they go north of 1,000 dimensions. And why I'm saying this is because I want you to understand is sometimes the actual nature of the platform decides what kind of algorithm is best suitable for it. For instance, we at Falcon AI, we were faced with to develop a recommender system for two different use cases. One is audio-on-demand platform. And for audio-on-demand platform, if you think about it, it makes sense to assume that if the users show similar behavior, like they clicked on the same items, they listened to the same items, it makes sense to assume that they will continue listening to the same items, right? So it kind of makes sense. But if Riverface also, they were a client, we were making recommendations for online betting sports shop. And this is a totally different world, right? So therefore, for online betting, you don't assume if the two users click on the same and place bet on the same pairs of matches that they will continue to do the same. No, they are only interested in the gains, and they all have their own personal view of how they achieve those gains. So collaborative filtering is not actually useful there. So what I'm telling you is that for audio-on-demand platform, it makes sense. And there are certain approaches, such as the weighted matrix factorization, which I will show you how to view through the lens of graph algorithms. Then EASE, which is embarrassingly shallow autoencoder. It's this kind of linear approach. It comes from the Netflix lab. And then there is the graph-based methods, such as PageRank, embedding approaches in graph neural networks. matrix factorization so this is just a quick overview on the left hand side you have the user item matrix basically the the non-zero the non-zero entries or the actual entries that you see are the entries that we are trying to recover with the user and item latent factors that you see on the right so the inner products on the right should actually match the the non-zero entries on the left now there is a the interesting interesting interpretation here so if you look at a user-item matrix, you can view it as an adjacency matrix of a bipartite graph. So bipartite means that there are two types of nodes, users and items, and the connections can only exist between users and items, so not between users-users, not between items-items. And then the whole matrix factorization actually problem, it can be observed as the problem of link prediction, right? However, here when it comes to optimization of the matrix factorization, there comes a The interesting question is whether you recover only the non-zero entries that you see here, which would be computationally very less demanding, or if you also recover the non-existing, so the actual non-zeros. And what it practically means in a graph sense, that the more connection you have, the more connected components you have, then the better the recovery is. But if you assume that you recover also the zero entries, it means that the links, that all the items are linked to all other items, but the weights are different. So it means that the link exists but the weight can actually be the weight of zero. So why I'm telling you all this is because I want to introduce one little tweak in case of existing additional metadata. So the matrix factorization only operates on the user item pairs. So practically you have the user's items and you have some kind of lighting. What you saw previously is on a scale from 1 to 5 or if there is movies or songs, it can be like 70% of the movie, like 0.7 and so on. But what if, for instance, we have some additional data on the user side or on the item side? What if we have category information on the item side, which is usually what audio-on-demand platforms have? So can we somehow add this information to the recommender that already proved to be good for us? And the solution is if you observe the actual problem as a graph-related problem, the solution offers itself very easily, and this is by adding new data points. This is by adding practically artificially generating new interactions to help gain better connectivity via the graph. And this connectivity, you will see, that it repeats quite often, and it offers better results when achieved. So let's assume that what you have here, the solid lines, are the actual interactions. So user U1 interacted with items I1 and I3, right? So you see that items I1, I3, and I4 actually are items that are of the same color. They belong to the same category. So how can you utilize now this information to basically allow the user U1 to know about the item I4? Because basically what you see here, that by following the solid lines, you cannot walk from I1 to I4. So what you can do is actually introduce, generate more data, add a dummy user, practically, where this dummy user has links to the items that belong to the same category. And then through the dummy user, then comes the connection between the user I1 to the item I4. The same for the user U2, the same for the user U3. The idea is actually very simple, and it's called the joint matrix factorization, and you will see later that it actually performed some quite good results, and my claim is this is because of the graph connectivity in this case. Another family of the algorithms that are often explored in the field of recommendations from the family of graph algorithms are the PageRank walks, or the personalized walks, however you prefer to call them. So let's say that I remind you about the PageRank. So it's an initial algorithm that actually made Google, and it's based on assigning the scores on the websites that are pointed to by another website. So the websites that are pointed to the most are actually the ones with the highest score. So in terms of a recommender system, what it practically does is you form a graph of user-item interactions. And then you literally perform the walk between the items, starting from the user towards the items, based on the now probabilities, which is your likeliness. These are the scores that I mentioned before. And this is how you then collect the similar items. So I have 10 more minutes. I will just have to, because the deepest dive is for graph neural networks. So page rank for recommendations is we actually tested it on the audiotech data. And the thing is, when we tested the page rank walks on the episode recommendations, we get very bad results. But when we studied the graph with the episodes, we saw that the graph is highly disconnected. Like on a typical seven days data set, we had like more than 1,000 disconnected components. However, when we consider podcasts, so the collection of episodes, like this is the basic, how you say, the flag of the episode. then the graph becomes more densely connected. So on the typical data set, we had around 12 to 16 components. So the graph was much more connected and then the walks actually made more sense. So in this case, then the PageRank walk actually made quite a sense and it was an A-B test. Back then when I left IRD, this PageRank was actually launched as an A-B test for the podcast recommendations, which we developed and you see here how we develop it with the libraries. So graph neural networks. So let me, like graph neural networks is one approach that basically considers the graph and tries to learn the node representation. So when I say node representation, this is on the side of users and on the side of items. Obviously, the ratings can be considered as the weights of the links. And what we also utilized is the age of the link. So we take the train set and then the distance from the last day of the train set, we consider like in the number of days we consider it as the as the edge age particular graph attention uh graph neural network family that we used is graph attention networks which are very good for sparse data because they have attention mechanism which practically means that they pay attention which link to actually pay attention to most such that the the most is kind of squeezed out of the data that you have and they are but what you can what you should also know is they are computationally expensive when it comes to very large data and now i will just give you a brief overview of the architecture so the memory is basically the initial the initial vectors of the users of items so the vectors of users is practically the the length of the vector is the number of items and then non-zero entries on the interactions analogously for the for the items they are passed through their respective encoders sources for the user destination is for the target we have initial node features. These node features are then fending to the graph attention network. We used two graph convolutional layers, which means that we do node propagation not only on the immediate neighborhood of a node, but we go one hop more. So this is like in a breadth-first search, what you would see, this is like two hop searches. Then we get new node representations, new latent node representations. We split them into the source vectors and destination vectors, and then we do some kind of operation between them. What we chose here is Hadamard product, which is basically like element-wise product of the two vectors. We do the sampling of the positives and negatives. Positives are obviously the edges that exist into the graphs and the negatives, well, you can either sample randomly or you can be smarter, you can embed the graph and then sample the pairs that are close in the embedding space but do not have any links. and then you output the probability of link prediction and then I will just tell you the results with IRD AudioTech these are the ranking on the precision at 10 and you will see that extended AILS, when I say extended this is to remind you this is this little tweak with the dummy nodes and then graph neural networks AILS page rank and factorization machines so what I want you to as a takeaway is that the data in the use case actually determine what paradigm works best Obviously, if you don't have enough metadata, or if you don't have metadata, maybe it doesn't make sense to use the more sophisticated approaches. But I would advise that whatever you have, try to dig deeper into the simpler approaches before going back to the more sophisticated approaches. So for the takeaway, what I told you is matrix factorization is a graph-based recommender model, where we looked at the actual interaction matrix as the adjacency matrix of the graph. Then there was an approach where I introduced dummy nodes where we saw that the items belonging to the same category can actually be linked via the additional user. And then there is the page rank where there are page rank walks performed. And there I told you about why page rank sometimes fails, which is because of the disconnectivity of the graph and when you connect. So when practically you do, how you say, the compression kind of the episodes into the podcasts, so into their families, basically the graph becomes more connected and then the walks make more sense. And then I told you about the graph neural networks, in particular graph attention networks. There are some blog posts that I wrote around these topics. So for dummy nodes, which you will see here, All of this is basically available on my LinkedIn, which I will show you. You will have links available. So there is also with code, with dummy notes of how it works. Then graph neural networks, we did it for a also, but it was practically the same architecture which we did for a Spanish startup which wanted to see how well we can recover the link. It was link prediction between investors and companies they invest in. So this was the problem. And just recently I wrote a, this was like for very introductory notebook style blog post on REXs, on basically how you do the k-nearest neighbors and what is left there. There are two more blog posts about how you can deploy this on GCP. What I also found interesting is some colleagues, I think they were also speakers at this conference, from Inovex. They also posted something about the graph-based recommender systems in the field of fashion. They used GraphSage for the graph neural networks, which is the most sophisticated approach there. And they also used graph embedding, which I was very happy to see this because this is where my academic background comes from. So feel free to check on their blog post. Exactly. And yeah, so feel free to connect with me. I will be very happy. so to talk about anything algorithms-related, anything vectors-related with you. Thanks a lot.
Speaker 2 [22:38]
Thank you so much. It was a really, really amazing talk. I have some questions. First question is, how do you approach the problem of feedback noise? For example, people watch things that are recommended because they were recommended, but not because it was the best recommendation.
Speaker 1 [22:59]
No, the thing is what you collect there is you practically collect the information that is, you collect the positive signal and the negative signal. If they get recommended something and then they watch 70% of it, you collect it as a positive signal. And if you recommend something and they collect only like 5% of it, then you collect it as a negative signal from your recommendation. So you can get it as a negative feedback, exactly. But there, I think what he or she wanted to ask is about whether you include this then in your training set. Because this is the major problem in recommenders. So you recommend something, the people click on it, but then you use the same thing that you recommended, you use it for your training. So it's like a closed loop. So this is really a problem very hard to answer, how you go around this. And this is like a whole topic for itself. But I think this was where the question was going into. Yeah.
Speaker 2 [23:51]
Yeah. Another question. Is the optimized metric still a good metric?
Speaker 1 [23:57]
Is the
Speaker 2 [23:58]
optimized metric still a good metric that's
Speaker 1 [24:01]
So if you are optimizing for, let's say, you launch and you do offline testing and you do precision at 5, precision at 10, whatever, it very often happened that we got, like, we have three candidates and we have, like, one ranking, one, two, three.
Speaker 2 [24:02]
yes
Speaker 1 [24:19]
When we launch A-B test with these three candidates, it's very often the case that we get a completely different ranking. And an A-B test is actually the golden standard of a recommender system. So I would not rely on offline testing exactly because of the reason that I just discussed previously, because the algorithms are fed in a kind of self-loop. This is the self-fit loop. So when we launched an A-B test, we actually had results 3-2-1, completely conversed from the offline testing.
Speaker 2 [24:50]
Oh, amazing. Another question. What is your view on current recommender systems and creating filter bubbles, not keeping diversity and promoting certain content types disproportionately?
Speaker 1 [25:11]
That's a very good question. So as I was working for ARD, so this is a public provider in Germany, and they were very interested into not putting people into the filter bubbles. But this can be relatively easily solved by introducing some randomness, introducing maybe some more, how you say, user categorization, and then seeing if the persons are actually willing to leave their filter bubbles. Why I'm saying this is because I'm very often faced with this question, and the thing is, most of the people actually don't want out of the filter bubble. So this is really the case. They just want what they want. So if you propose something that will broaden, at least you hope that it will broaden their view, they just don't want it, they don't visit it, and they are interested in the numbers, so we just stay with what we have.
Speaker 2 [26:06]
It's true, to be honest. I should say sad, but true. Another question, really interesting. How do you handle the problem of novelty? Recommendations that are really unlike the previous things, but are interesting or inspiring because they are different and new.
Speaker 1 [26:23]
new exactly so this is this we were another problem that the public service provider needs to to integrate into the systems but how they did it is they had a separate section practically integrated into the into the app where there is a novel content but still there is there is kind of human intervention where the editorial team picked what is the most relevant from the novel content and then when we intervened we from a data science team we said okay can we at least personally personally how you say to sort this list that they provided like personally sorted the list will be the same we will have the same list just different ranking they they declined so this is this is funny funny story so where I work where I work that
Speaker 2 [27:15]
We have time for some more. Let's have a look. What method do you recommend for content-based for semi-structured data? For example, XML files, where collaborative filtering might not be wanted. For example, to reduce social bias.
Speaker 1 [27:43]
Okay, well, obviously I would recommend some kind of a method that can extract the metadata and then feed it into the more sophisticated, maybe two-tower approach models, and then experiment with it. So my message is practically, it cannot be one, practically your problem defines what is the most appropriate model for you. it's whatever sophistication you have in your model like if your problem is a bit like as this problem is like with XML data it's most probably going to fail because it's not really built for it so you have to either see how you can extract as I said and feed into the existing models or you have to do some tweaks so this is with what is available there this is how much I could
Speaker 2 [28:33]
is how much I could answer. And so another question that's really, really relevant in those times. Would you consider using LLMs, large language models, to extract or design features? Of course. I think we can conclude this with that amazing answer. Thank you.
Speaker 1 [28:55]
Thanks a lot, Paul. Yeah.