Amy Zhang

Amy Zhang shares her work on Invariant Causal Prediction for Block MDPs, Multi-Task Reinforcement Learning with Context-based Representations, MBRL-Lib, shares insight on generalization on RL, and more!
Robin:

This is TalkRL Podcast, all reinforcement learning all the time. Interviews with brilliant folks from across the world of RL. I'm your host, Robin Chohan.

Robin:

Dr. Amy Zhang is a postdoctoral scholar at UC Berkeley and a research scientist at Facebook AI Research. She will be starting as a as an assistant professor at UT Austin in spring 2023. Thanks so much for taking the time to do this, Dr. Zhang.

Amy Zhang:

Yeah, of course. Thanks for inviting me.

Robin:

How do you like to describe your personal research interests?

Amy Zhang:

Very much within the reinforcement learning framework. I think that interaction with the environment is really interesting. It has to do with a lot of the tasks in the real world that I care about. Most of my work when the problems that I choose, I typically ground in robotics and I also have like an interest in healthcare.

Amy Zhang:

And so because I really care about these kind of real-world problems, a really important problem that I think we have in reinforcement learning that I think is now getting more traction is generalization. So I would definitely say that like the focus of most of my research in the last few years has been generalization and reinforcement learning.

Robin:

How do you describe how you got to RL? Did your interests evolve towards that over time?

Amy Zhang:

Yeah, it's been a definitely a winding journey. My bachelor's and master's were actually more on the double E side, and I used to do signal processing, information theory, network coding. It was after that I started exploring machine learning, and I actually worked in more supervised learning at the time. So I was working on recommendation systems.

Amy Zhang:

And then further went into computer vision, and that's when I started doing deep learning. So there I was doing object detection, object classification, really sort of classic problems.

Amy Zhang:

And I didn't like that for a lot of real problems. So we were working on doing building detection from satellite images in order to estimate population density to provide internet all over the world. What I didn't like was that a lot, most of the progress that you made, like the thing that really moved the needle, was more about the data, making sure the data was clean, that you had enough of it.

Amy Zhang:

And I really missed having like a mathematical framework that you could work in and really like develop grounded algorithms. And so it seemed like reinforcement learning was like a setting where you could actually do that. Although, of course, reinforcement learning is also very sample inefficient. And so you do have to do a lot of like you know, just software engineering and it requires a lot of compute. But I like that on the other side of it you do have this really nice framework to describe the world.

Robin:

Cool. Okay, so I remember seeing your Plan to Vec poster. That was back at Neurep's 2019 in the Deep RL workshop in Vancouver. At that workshop, I talked to a lot of the poster presenters. in that room for that episode back in episode eight but your poster was pretty busy so I didn't get to talk to you then so I'm really glad we get a we get a chance to talk now. We crossed paths at ICML earlier this year.

Amy Zhang:

That's right.

Robin:

Super excited to have you. So let let's talk about a couple of your recent papers. The first one is invariant causal prediction for block MDPs. And that was with yourself and Claire Lyle.

Amy Zhang:

Yes.

Robin:

Can you give us the general gist of this paper?

Amy Zhang:

Yeah, so Claire and I actually started talking at RLDM Reinforcement Learning and Decision Making, which is this really great conference that only happens once every two years, doesn't have formal proceedings, but it was in Montreal that year, and Claire and I had known each other because she'd done her master's at McGill, which is where I did my PhD.

Amy Zhang:

And we were both really interested in, I mean our core areas I would say are were reinforcement learning, but we were both getting really interested in causal inference. And specifically the inspiration for this paper was another paper on invariant causal prediction or defining invariant causal prediction by UNS Peters from 2015.

Amy Zhang:

And so this paper is very firmly in sort of causal inference land and was focused on this idea that there are these different kinds of interventions. that you can use in order to do causal discovery on data and their requirements on what kind of interventions you need and how much data you need in order to get statistically sound hypothesis testing in order to you know find like the true causal structure underlying the data that you've collected.

Amy Zhang:

And so we wanted it seemed really clear to us that there were really strong connections between causal inference and reinforcement learning. In causal inference, the assumption that you make is that you have access to all of these different environment variables. And the way that the environment and variables interact with each other is through directed edges, which are cause and effect.

Amy Zhang:

And so you can, the goal in causal discovery is to figure out what is the directed acyclic graph, the DAG, that connects all of these variables that you care about. And so usually most of those variables are your data, your X. And then one of those variables is your target, what you're trying to infer, your why.

Amy Zhang:

And so if you can, if you have the right data in order to find that DAG, then that basically builds your model and you can get outer distribution generalization. And so it seemed like this idea was really useful to try to get that same type of outer distribution generalization and reinforcement learning.

Amy Zhang:

And so we tried to pose the same problem in reinforcement learning. figure out how to define the stag in terms of the MDP. And here we focused on specifically out-of-distribution generalization for observations. So the idea is that typically the kind of state space that we work with in real problems is are these high-dimensional rich observations, pixels.

Amy Zhang:

And so When you have pixels, it's not the most pared down version of the state that you could use. There's all of these distractors, these like spurious correlations, right? You know, the that you have the sun in the sky and clouds and leaves moving in trees, but usually those are things that you don't necessarily care about for your specific task.

Amy Zhang:

And so in this paper, we really focused on like a few shot setting. And so this was sort of the high-level motivation when we actually get to the kinds of experiments that we did, it's obviously much more pared down and much simpler and all in simulation.

Amy Zhang:

But the focus was on this idea that we can have access to only a couple of different environments at training time, but if they're selected carefully, if you see variation across those training environments that models the true variation in the testing environment, the environment that you care about deploying in, then we can learn a model that will be robust to those variations and therefore generalize out of distribution to a testing environment where other things vary, basically.

Robin:

So that sounds like the magical part to me, the out of distribution part, right? Unlike domain at a generalization and methods where we're just trying to sample from within a distribution. If we go back to OpenAI's proc gen, they were they were just trying to s sort out the within distribution generalization issue, is that right?

Amy Zhang:

Yeah, you could say that. I guess so what I would say is that within distribution and out of distribution in RL is a bit of a murkier thing. And so even just in the scope of Procgen, right, there are all these different levels. Let's just pick one of the simpler environments, like the maze environment. You have all of these different levels that just correspond to different maze layouts. You can define a distribution that just consists of the training set of levels from Procgen. That's your within distribution, right?

Amy Zhang:

And you know, you can train on all of those. And then you could say, okay, well, maybe my test levels are a different distribution and if I can generalize to those that's out of distribution generalization. Because we're talking about samples are now environments. They're, they're like, you know, you can, you can define them as different MDPs rather than just a single data sample like it usually is in supervised learning. Like the numbers that we're talking about are so different. In supervised learning, you know, we have thousands, hundreds of thousands, millions of samples from a distribution.

Amy Zhang:

And so you can say that this distribution is very well defined by the samples that you've collected. Whereas in RL, the way specifically Procgen, you know, you can think of this as like a multitask RL problem. And now your samples from the distribution are MDPs, are separate tasks. And in the scope of Pracha, now we're really only talking about like tens and hundreds of samples.

Amy Zhang:

And so because of that, I think, you know, what we define as a distribution, I guess it it's just less well defined. And so I think like saying, oh, what's in distribution versus out of distribution, it doesn't have quite the same meaning in RL as it does in supervised learning.

Robin:

Can you tell us more about this setting? What is a block MDP? What does that mean?

Amy Zhang:

Yeah, yeah. So the Block MDP formulation was first defined by a paper by Simon Dew et al., I think in 2019. And that's like a very theoretical paper. And but the this definition of the Block MDP, I think, as like a form of structured MDP is very useful, again, in a lot of real world problems.

Amy Zhang:

And so what the block MDP is saying, it's not a very limiting assumption. It's just saying that in a typical, let's go back to a typical MDP, right? We have a state space, action space, you know, transition distribution, reward function, but the thing that we're really focusing on here is the state space. The block MDP is saying, okay, we have a state space, but now let's say that that's latent. We don't actually have access to that state space. Instead we see a different observation space.

Amy Zhang:

And the assumption is that this observation space is much larger than the state space. But we're going to make a simplifying assumption that it's still fully observable. And that's where the block assumption comes in, which is saying that for each observation, it is possible to decode what the underlying state is.

Amy Zhang:

And the way that you can do this is by saying that there is a one-to-many function, a rendering function that maps from the state S to the observation O. And each set of observations is disjoint. So a set of observations that belongs to a single state never overlaps with the set of observations that corresponds to a different state. And that's how we get full observability and we kind of avoid the whole POMDP partial observability problem.

Amy Zhang:

And so the reason that the block MDP formulation is nice is that it's just saying we have an environment in which we can get gains. There is latent structure and we can get generalization. Because you can define any MDP, you can you can define like a worst-case MDP where you will never get generalization, where, where every new state that you see has nothing to do with any other previous state that you've seen and you just have to fully, exhaustively explore your entire state action space in order to understand it.

Amy Zhang:

And so the block MDP formulation is just saying we don't care about that worst case scenario, we only care about problems where there is structure and therefore we can therefore generalization is possible.

Robin:

And is this the same blocking as the concept from design of experiments? Blocking factor as a source of variability that's not of primary interest to the experimenter? I read that off of Wikipedia, but is that is that the same blocking?

Amy Zhang:

Actually. Actually no. But that is a really interesting that is an interesting connection. So I think the block in block MDPs didn't come from that definition, but there's definitely a really nice link there. So the block from block MDP is really just this idea that if you if you construct like a matrix that to map from states to observations, this matrix has disjoint blocks in it. And so that's how you represent the fact that the different sets of observations are disjoint that belong to different states.

Robin:

In this paper you talk about model irrelevance abstraction. Can you talk about that phrase? What does that mean?

Amy Zhang:

So a model irrelevance abstraction, so as far as I know, this was coined by in a paper by Lee Hongli. It's a really nice paper, just sort of like unifying this framework of state abstractions. This paper was from 2009. And that that's the first place where I've seen this definition of model irrelevance abstraction.

Amy Zhang:

And it actually just means the same thing as by simulation, which is a is which is like another concept that I've like talked about in my papers. And it's just this idea that if you ignore the states or observations, it I mean, okay, in reinforcement learning, we don't really care about features in the state space. What we really just care about is reward, right?

Amy Zhang:

We want to learn a policy that can maximize the total return, the total sum of rewards that we can achieve in the environment. So instead of looking at states, if we just discard that and only pay attention to the reward and future reward that we get for some sequence of actions, then by simulation and model irrelevance abstractions, just say, I don't care if these states look different.

Amy Zhang:

If I do a test, and a test consists of like a sequence of actions, no matter what test I perform, if the sequence of rewards that these two states give me are exactly the same, like the also the distribution over rewards are the same, then these two states are the same to me. And so the model of relevance abstraction is just saying, is just constructing a state abstraction, like a coarser version of your state space that only pays attention to those differences.

Robin:

Cool, okay. And we featured Dr. Pablo Samuel Castro on episode five and he did his dissertation involving bi-simulation so that concept's come up here. So just so I I'm I understand if we look at let's say a Majoco environment and we look at the pixel version versus the proprioceptive version would that be a case of bisimulation or model irrelevance would that be related to that to this

Amy Zhang:

yeah okay so I think like the proprioceptive state versus the pixel right so if you just look at these two different state spaces they are you can define them as two different MDPs right But if you ignore that state and instead just look at the reward, we know that matches up. And so we can say that this MDP, the MDP consisting of the proprioceptive state, is bisimilar to the one consisting of pixels.

Amy Zhang:

And the model irrelevance abstraction I so I guess like in the example that you gave, like of, I think you said Atari, there's a one-to-one mapping, right? There's only one pixel observation that corresponds to one proprioceptive state unless you start adding in distractors or changing backgrounds and stuff.

Amy Zhang:

And so because this is one-to-one, you could say it in either direction that one is an abstraction of the other. But typically when we talk about model relevance abstraction, we are talking about something coarser, something smaller, of lesser cardinality, cardinality. And so in the setting where we're talking about like a pixel version where irrelevant features are changing, then we can say that the proprioceptive state version of this game is the abstraction of the pixel one.

Amy Zhang:

Another way of saying this is that what we want to find, like what we care about, is the coarsest by simulation. And that means it's just the version, it's the MDP that has the fewest number of states that captures the exact same reward behavior as the original game.

Robin:

Cool. Okay, and we will have the link to the ICML poster session in the episode notes. And for the audience, I recommend giving that a listen and also your second first author here Claire Lyle gave a great overview in that in that session including some diagrams and I saw she gave a more in-depth talk from the Simons Institute that's also on YouTube and so we'll link to that as well.

Amy Zhang:

Yeah awesome yeah that was part of the reinforcement learning program there and she definitely does like a really good job of dissecting that paper.

Robin:

Totally. Okay, so can you say a little bit more about invariant causal predictions? That's the concept. I gather that's the concept that this paper is built on from the causal world, and you brought it over to RO. But how does how does that really work? And are these linear models?

Amy Zhang:

Yeah, so in the original paper, the original ICP, which in our paper we called linear ICP, it relies on statistical tests. And so or You get stronger guarantees if we can, you know, only focus on linear models. So as an example, and with invariant causal prediction, the goal is to basically find the causal feature set. So this the assumption is that you've got this you know this supervised learning problem where you have your data set X and your labels Y and you're trying to infer Y from X.

Amy Zhang:

And The causal inference perspective on this is not just, you know, is not just like the typical one in machine learning that just says, okay, like there exists some model and if I do optimization, then I, with high likelihood, will find this model that can give the right prediction. In causal inference, there are a lot, there's like a more structured assumption, right, which is that your X and Y fit together as this directed acyclic graph.

Amy Zhang:

and you really want to find like the correct graph and if you find the correct graph and the and fit the correct edge functions then you can infer why correctly and so invariant causal prediction the original paper by Jonas Peters says that you need to have an intervention on every variable or you need to see a change in every variable in x and how it propagates to the other variables x and y in order to identify what the correct DAG is, to be able to eliminate all possible graphs except for one. And that one would be the correct one.

Robin:

That sounds like a lot of data in a lot of a lot of tests, potentially, right?

Amy Zhang:

Yeah. So in the original paper, this, yeah, so this paper I would say is it has algorithms in it that you don't necessarily want to apply to large-scale real-world problems. I remember there's actually a really funny passage in that paper that kind of, you know, admits, like, yeah, this algorithm will give you the correct solution, like, you know, with strong guarantees, but it's also super exponential in the amount of data that you need.

Amy Zhang:

So, and so as part of the paper with Claire in the ICP for block MVP paper, we do just like a very simple parallel from that ICP, that linear ICP, to the RL version with just linear models. So assuming that the MDP is just consisting of linear functions, but we do also adapt another version.

Amy Zhang:

just, you know, well, like assuming any type of function, right? And using neural networks so that you can have like universal function approximation. But then it also means that you have this trade-off, which is that you get these really strong theoretical guarantees with the linear version and we lose them with the deep learning version. But it at least it does scale up to two larger scale problems.

Robin:

It sounds pretty magical, keeping agents from being distracted by the confusing things that would be obvious to us, but maybe Uta Pearl would say that curve fitting, style learning could easily be distracted by all these things. So you talked about some of the assumptions, but can you is there is there more in terms of like the time delay and the rewards and like how I it just seems like you're tr it's a really hard problem.

Robin:

And I guess I don't know if you ever if you ever step back and think about how we do it in our brain, like how humans do it. Cause like when we're playing soccer in the rain, it's no harder than playing soccer in the sun. But to get to that point, we have so much experience in priors, which I guess we're not assuming here, right? We're coming in tabula rasa and saying, what can we do?

Amy Zhang:

Yeah. The amount of you're right, I mean, the kinds of priors and the amount of experience that we have, we are not giving to our agents right now. And so in that sense, it's not really a surprise that we are where we are, that we have, there were training agents that don't have good generalization.

Amy Zhang:

You know, you say that this sounds almost magical, but it's, it's, it's really so mundane. It's really just this trade-off of like how strong are the assumptions that you can make about a problem lead to the like strength in terms of the generalization results. Right. And so the kinds of assumptions that we make, especially in the linear setting, in order to get those kinds of guarantees are just not applicable.

Amy Zhang:

So there's really, I guess like what I want to highlight is that there's no free lunch. And I think what I'm really interested in or like one path that I think is useful is to think about different kinds of structure that do exist in the real world.

Amy Zhang:

and make those assumptions explicit and figure out how that leads to gains in terms of sample complexity, in terms of generalization performance of algorithms. Because if you think about the typical definition of an MDP of a Markov decision process, like it's so general. We're The definition makes no assumptions of underlying structure, like going back to the previous example that I gave of like this adversarially difficult MDP that you can construct, right? There's no hope of generalization to new unseen states.

Amy Zhang:

And it doesn't make sense to design algorithms for that setting. And so I'm a big proponent of defining new types of MDPs, new types of structured MDPs. like contextual MDPs, hidden parameter MDPs, block MDPs, because I think we need those in order to get better algorithm better algorithms and better guarantees.

Robin:

Awesome. Yeah, in episode two, I got to ask Michael Littman why is there so many RL algorithms? And his answer had to do with the fact that there's so many types of MDPs and we need different approaches to them.

Amy Zhang:

Yeah.

Robin:

Cool. Okay. So do you have follow-up work planned along these lines?

Amy Zhang:

Yeah, there's been an a couple of other things. Claire and I actually have another paper that we're working on right now, again, using this kind of causal inference perspective, but now for exploration, trying to develop new exploration algorithms for MDPs from this causal perspective. So that's one. Another one is on intervention design and this was led by a PhD student at McGill, Melissa Mazzifian.

Amy Zhang:

And so this was looking at centurial transfer. So again a type of generalization, also using this a similar type of causal inference perspective to say, well, one, to explain why data augmentation and domain randomization work so well for generalization. And two, to in basically inform the type of data augmentation and type of domain randomization that are needed and how many are needed in order to get generalization or the type of generalization that we want. So those are a couple of other works that I think are like along this line of causal inference and RL.

Robin:

Great. I look forward to it. So let's move to your next paper. That is multitask reinforcement learning with context-based representations. By that that's by Sadani et al. Yeah. With yourself as a co-author, is that right?

Amy Zhang:

Yes, yes, that's right.

Robin:

So can you give us a brief version of this paper?

Amy Zhang:

Yeah, this paper was really fun. So this paper was looking at how we can use context like side information that, you know, that's not really a part of, again, a part of the MDP formulation. But there are a lot of settings in which we have cyber information that is useful for our task at hand.

Amy Zhang:

And, you know, like this could be just sort of like a description of the task, just like prior knowledge about the dynamics or the environment. And so in the scope of this paper, we were actually focusing on this multitask and meta-RL benchmark meta-world. So Metaworld has this like easy and hard version. There is MT10, which consists of these 10 tasks. MT50 has 50 tasks. But these tasks are all manipulation tasks. There's like a in-simulation, a robot arm, different objects.

Amy Zhang:

And so in MT10, like examples of these different tasks are open a drawer, close a door, you know, open a window, close a window, open a door, close, or open a drawer, close a drawer.

Amy Zhang:

And In the multitask setting, what we usually do is we assign task IDs. And so this can just be a one-hot. We can just talk about it as just like in these energy values. And you know, task one is open drawer, task two is open door.

Amy Zhang:

And in Metaworld, it's really funny because there's actually these very simple sentence descriptions of each of these tasks.

Amy Zhang:

that are meant for human consumption. And so you can read this sentence that's like the robot arm must, you know, like turn the knob in order to open this door. Something like this. It's just like one sentence. And from reading that sentence as a human, you're just like, okay, I know exactly what this task is. But that sentence was never meant to be part of the MDP. It's not given to the RL algorithm. The agent never uses it.

Amy Zhang:

And so one portion, one contribution of this paper was to show that, you know, we can design an architecture that uses this kind of contextual information and we can beat state-of-the-art performance just from using these simple sentences, using pre-trained language models in order to construct the context embeddings.

Amy Zhang:

And my hope is that this work shows that. we should be using we should be thinking harder about how to incorporate that kind of context into tasks because it can improve important it can improve performance.

Robin:

Okay, so providing more about the context than just a task ID or what would be the alternative there?

Amy Zhang:

Yeah, so it in the multitask setup, the alternative is a task ID. And the reason the task ID is so terrible. It's really terrible because if you're using task IDs to denote tasks at training time, it means that you have no hope of generalizing to a new unseen task at test time because there is no there's no semantic meaning in the task ID. There is no structure underlying the mapping from the task ID to the actual task itself.

Amy Zhang:

And so if you're given a new task idea at test time, you have no idea what that new task is. Whereas if you use something more descriptive like these sentences, we show that you can actually get zero shot generalization to new unseen tasks. I mean, the performance was quite bad. This was just like a one-off experiment that we ran that was kind of like a side note.

Amy Zhang:

But I think the idea is that like if you can scale this up, like if we had done this with like a much larger family of tasks, we can definitely get better zero shot generalization because the agent would be able to learn a mapping between different words and rewards and actions.

Robin:

Cool. And then again this phrase block comes up again. I think you call this a block contextual MDP. What does block mean here again?

Amy Zhang:

Yeah, so the contextual MDP setting was something that was previously defined and it just means that, you know, you have this context which informs the transition function and reward function, and so it just creates all of these different tasks with this underlying structure.

Amy Zhang:

Meta world, interestingly, the they made some design choices basically to make it work well with like RL algorithms. So, you know, one of the downsides of using neural networks using a lot of models is that it requires like a fixed size input. And so you have all of these different tasks, but the objects in those tasks are different.

Amy Zhang:

And but we need the so this is all looking at proprioceptive state. And so we need the dimensions of that state space to be the same across all those tasks. And the way that they did this was to have different dimensions mean different things in different tasks because they represent different objects. And so the block component, yeah.

Amy Zhang:

And so the block component here is just to sort of reinforce that. And so the block component is saying not only do your reward and transition functions depend on this context, but your state space does too. And I think that's actually a really important component because when we think about the whole world and all the possible tasks that you can do, you can construct this as one giant MDP where your state space is, is, you know, the information about the whole world, but we don't operate that way.

Amy Zhang:

Like we operate by just, you know, having a focus on the objects at hand for a specific task. If you're, if you're, you know, trying to hammer nails, then your focus on is like the nails and the hammer. It's not some like stapler off in the corner. And so just because your state space can change doesn't mean that we're incapable of generalization. And so the block contextual and DP setting just is reinforcing that idea.

Robin:

Okay, then and I gather that in the algorithm here, which I think you called care, the state gets encoded by a set of encoders, and then you have attention over them. Can you can you talk to us about the intent with that, with the encoders and the attention? What is that doing and why does that help?

Amy Zhang:

Yeah, so this was like another major contribution of this paper. So the idea here is that by having these separate encoders, the goal is that We're basically trying to get some sort of compositional generalization. By compositional generalization, I just mean that same idea, right? Where if we train an agent to close a drawer and open a window, then if we tell it to close a window, then it may understand what that concept is.

Amy Zhang:

And so we have these different encoders with the hope of each encoder mapping to some concept or object that appears in multiple tasks. So in Metaworld, all those examples that I've been giving, like, you know, it's I think it should be pretty clear that there are concepts like open and close and drawers and doors that appear multiple times in different tasks, but just different combinations of them.

Amy Zhang:

And so the goal of using this mixture of encoders is that each encoder will hopefully map to implicitly each one of these concepts. And so then the context can be used to train and just basically attention weights over these encoders. And so certain encoders will only activate if that concept is necessary to solve that task.

Amy Zhang:

And so what we found, and this is kind of hard to, this is all done like implicitly, right? Like there's no supervised mapping from encoder to word that we're actually using here. And so the way that we test like if that's what it's actually doing is by just varying the number of encoders k.

Amy Zhang:

And so in the experiments, we found that if k equals one or two, we get poorer performance and this actually looks a lot more like you know like the multitask baseline for meta world but if we increase k to be too large like if we set k to be the number of actual tasks that we're trying to solve we actually found that we also get worse performance because what ends up happening is that each encoder just gets assigned a separate task and so no information is getting shared across tasks.

Amy Zhang:

And so K is something that you kind of have to tune or you can choose a K using the knowledge that you have about all of these tasks. So if we choose K to be approximately the number of concepts and objects that we think exist across this set of tasks, then we get the best performance.

Robin:

Cool. So I guess that shows that it's not just a matter of having enough capacity in that level in that layer.

Amy Zhang:

Yeah. Yeah. It's really about how you share information.

Robin:

Right on. And then so this paper talks about zero shot generalization. Can you talk about how zero shot works in this in this setting? Is that like a whole new context and textual description with a with a task it's never seen?

Amy Zhang:

Yeah. And so this is, again, why this kind of more descriptive task ID or context is more useful than using just a number or a one hot vector. Because there is actually structure in terms of like the components of the sentence, the context that describe the task.

Amy Zhang:

Okay, and we know that this is true because like as a human, if I read to you a sentence that's you know, like please open this door for me, you know exactly what to do even if you know had never opened a door before okay that was a bad example another example that people talk about in compositional generalization is like dax right so if i tell you know you don't necessarily know what dax means i'm just going to tell you it's like some motion like maybe like clap twice if you say dax twice you know what to do there you know that you want to perform that dax motion twice And so that's the same type of compositional generalization that we think we can get from this kind of kind of architecture and using this kind of context.

Amy Zhang:

And so just like in the scope of Metaworld, what we did was we very carefully split up these 10 tasks in MT10 so that all of the concepts and objects present in the test tasks are seen in the training tasks, but not the exact same combinations. And so we just wanted to see, okay, if an agent is introduced to all of these components necessary to figure out what these test tasks are, but never sees those test tasks, can it perform that task?

Amy Zhang:

And, you know, the success rates for this are pretty low. I think we were at like 30%, but that's still very promising given that we have an agent that's given seven tasks and then asked to perform another three that it's never been trained on before. So I think that was a really promising first step towards something just something more impressive in terms of zero share generalization.

Robin:

So would you say that this type of system is learning grounded language? Like is it is it attaching these words to concepts in the environment?

Amy Zhang:

In a very primitive way, yes. Like, you know, the vocabulary that we're using here consists of like definitely less than a hundred words. But if we can scale this up, then absolutely, I think that what we would find is that it's learning in an unsupervised way to match words and phrases to specific transition functions, reward functions, or like components of the environment.

Robin:

I want to recommend your talk at UCL Deciding, Acting, and Reasoning with Knowledge. That's the Dark Lab. That's on YouTube. And that was from June this year. And we'll have the link in the in the show notes. And that partly overlaps with the with this conversation and you shared a lot more besides in that talk. Okay, and then at the end of this paper, you mentioned some angles for follow up. Is that is that something you might you you're thinking of doing?

Amy Zhang:

Yeah. So one of the obvious follow-ups here is, you know, that we can also extend all of this to rich observations.

Amy Zhang:

And so that's actually something that we are doing now. But we can also scale this up in the way that you also suggested, right? Which is like increasing the vocabulary and seeing how far we can push this sort of grounded language and RL component. And so there's actually a really nice environment for this out of Fair London led by Tim Ruchteschell and Ed Greffenstedt, I believe. So that's the NetHack environment.

Amy Zhang:

And so I don't know if you're familiar with NetHack, but it's this I've never played it before, but I guess it's this like old school computer game that's text based. But the interesting thing about it is that there are a ton of different objects and agents and components of this game and there is an extensive wiki and I believe no human has ever beat the game without reading this wiki.

Robin:

Right.

Amy Zhang:

Yeah.

Robin:

So so your agent would read the wiki, is that what you're thinking?

Amy Zhang:

Yeah, yeah. Well this so that's what their hope is. That's what their goal is to have an agent that can read this wiki and learn to play the game or like through interacting with the game while reading this text sort of ground the text to the game and learn to solve it. It's very hard. I think it's gonna take a really long time before we can get there.

Amy Zhang:

But they have also created a mini version of this. I think the paper is now on archive and I believe the code is now publicly available. It's called Mini Hack and so it's just many simpler versions of this game with smaller or I'm actually not sure if there is text attached to it, but I think it would still be pretty easy to create like paragraphs like explaining what's going on.

Amy Zhang:

And so these smaller versions are much more doable with today's RL algorithms. And so the goal is to just sort of like push that envelope further and see what we can do. And so this is an environment that we're I'm working on with a collaborator and seeing how far we can get.

Robin:

That sounds really exciting and all and personally I am I've seen NetHack for years, but I'm terrified to even try it because it looks so addictive. Cool.

Robin:

I look forward to that since that sounds really powerful. So in these two papers that we just talked about, were you were you surprised by any of the results that you got or do you f feel more like that things turned out just as you expected and planned?

Amy Zhang:

The in the first paper with Claire, it definitely took a while for us, like I think these concepts of like spurious correlations, distractor variables or irrelevant features, I think they're very intuitive for us or at least, you know, we understand what they mean in supervised learning better, but it was actually kinda hard at first to design environments correctly. You can as an example from supervised learning that's maybe a little bit easier to think about. Understanding what's spurious or not, it like, it like has to be carefully tuned.

Amy Zhang:

So as an example, If you take combine like CFAR 10 and MNIST datasets, right? And so let's say that we construct a mapping from the digits 0 through 9 to the 10 classification labels from CFAR, and we append those corresponding images together to create this joint MNIST CFAR dataset.

Amy Zhang:

And now we're going to declare that one of those things is a distractor and the other thing is the real thing that we care about. Let's say it's like the CFAR label is the thing that we care about and the MNIST digit is just a distractor. But because we've created this incredibly strong correlation between a specific digit and a specific like object from CFAR, there's no way for you to be able to tell which is the spurious correlation and which is like the true thing that we care about.

Robin:

The way to because they're always together.

Amy Zhang:

Because they're always together, yeah. And so we know that the way that we tell which one is the actually the thing that we care about is if we add in some noise. So maybe there are some examples where you have a different digit that's been attached, like, you know, typically it's mostly, you know, one and cat that are attached together.

Amy Zhang:

And so maybe you have a couple examples that are three and cat that are attached together, but the label is still the same. Then we'll know, okay, if cat is the thing that we care about and not the digit. But if you don't have that, if you don't have that noise, then there's no way to tell. And so we had similar issues with like designing RL environments in which like we had the exact right type of variation.

Amy Zhang:

in order to like get the failure mode that we wanted to exhibit that we wanted to show that current RL algorithms have in order to fix it. But that's also just because we're dealing with toy environments and don't have real world problems.

Amy Zhang:

And, you know, it's like very clear these kinds of examples in the real world that do exist. So there's a really nice paper I think NEREPS 2019 on causal confusion, they have a really nice example with autonomous driving where there's like a light on your dashboard that denotes like whenever you break. And so if you see demonstration data of someone driving this car and the person breaks whenever a car in front of it breaks.

Amy Zhang:

So we know that the thing that we should be learning is that if you see brake lights on in front of on the car in front of you, then you should be braking. But what the agent learns instead is to pay attention to the brake light on the dashboard and only breaks when the brake light is on, which means it'll never break at test time.

Amy Zhang:

And so that's the kind of spurious correlation that you have to beware of. So that was for the first paper. The second paper care i the only surprise was how well it worked. I didn't expect to see such a huge gain in performance just from incorporating, you know, these like these very simple sentences and by giving these sentences to the agent. But it really did move the needle quite a lot and didn't require, you know, any tuning. So I thought that was really exciting and was surprising.

Robin:

Cool, that must have been a nice feeling.

Amy Zhang:

Yeah. You don't get those often.

Robin:

Okay, so I wanted to ask you more about generalization in general. Can you talk a bit about the difference between generalization and supervised learning versus generalization and reinforcement learning?

Amy Zhang:

Yeah. So at a high level, they're very similar. You know, you can define generalized we define generalization and supervised learning. You know, in distribution versus out of distribution is just sort of like the difference in performance of your model on training data versus test data. And we can do the same thing for RL. You can say generalization in RL can be measured by the total reward you can achieve with your trained policy on your training MDPs versus your test MDPs.

Amy Zhang:

But an MDP has a lot more components than just data distribution that you're sampling from in supervised learning, right? And so you can think about different levels of generalization in reinforcement learning that I think are useful to think about.

Amy Zhang:

So I think the degenerate setting, the simplest setting, which is what a lot of people were working in up until a few years ago, was the setting where your train and test are exactly the same. If you have deterministic dynamics, just a single initial state, then it's very obvious, right, that like whatever performance you get at train time will be exactly the same as the performance you get at test time.

Amy Zhang:

There's no testing of generalization at all. You can start testing generalization if you have an initial state distribution because now you can control what initial states you see at train time versus test. And so now you can actually start testing your agent on unseen states.

Amy Zhang:

And so one way that we did this in an early paper was by controlling the random seed. So if you control the random seed of the environment, then we can we can limit the number of initial states that you see at train time versus test time.

Amy Zhang:

And so we showed that If you limit your, depending on obviously the complexity of the environment, but even for very simple environments, if you limit your agent to 10 to 100 or hundreds of seeds at training time, so that's the initial states that it sees. And we have a held out set of initial states at test time, you do see generalization gap. You do see a performance difference of the agent on these like different initial states. There's another paper on dissecting, overfitting, and reinforcement learning by Qianzheng.

Amy Zhang:

And there they show that like, again, for these kinds of like maze and tunnel environments, that if you increase the difficulty of the environment, then it can take thousands, hundreds of thousands. of different maze layouts before you can generalize to new unseen layouts.

Amy Zhang:

And so I think there's been like a slew of papers examining generalization in RL in the last few years that have really highlighted how far behind we are because we have these benchmarks that are deterministic dynamics and, you know, very narrow initial state distribution. And so we just never really were testing generalization. So initial state distribution is sort of like the first rung on this ladder. But there are other things that you can change about your MDP that, you know, ways in which we as humans can generalize that our current agents can't, right?

Amy Zhang:

And so the first paper, ICP for block MDPs was focusing on observational generalization. Can we generalize to distractors or things changing in the environment that don't affect the dynamics and reward. How like how do we develop algorithms that can be robust to that kind of change?

Amy Zhang:

You can also have a setting where your dynamics and reward can change, but there are underlying rules that stay invariant across all your tasks. As an example, you know, the laws of physics are always the same, but different objects act differently because they have different attributes, like different mass and volume and friction coefficients.

Amy Zhang:

And so these are all types of multitask settings where we should be able to get generalization that we currently just can't.

Robin:

And Why is that we can't do it right now? And I wonder if how much of that we can blame deep learning in the sense that deep learning doesn't do a great job of extrapolation. It seems to be mostly doing interpolation, if that makes sense. Do you see it that way? Is it is it deep learning's fault that Deep RL is not great at generalizing that way? Or is it really we don't have the right algorithms yet? Or is that just a really hard question that doesn't have an answer yet?

Amy Zhang:

There are so many different problems. Like the examples that I gave are a few of ways in which our agents fail and, you know, we can solve them one by one. Okay, okay. I will say, yes, it's deep learning's fault.

Amy Zhang:

But it's a trade-off, right? The fact is that deep learning, deep neural networks are They're really nice because they're universal function approximators. They can fit anything. We don't need to hard code the model. We don't need to like program the laws of physics directly into an agent in order for it to learn to interact with the world.

Amy Zhang:

These are all trade-offs that we've made and it just means that it's a sample efficiency issue, I think, going back to like the causal inference. connections, it just in order to like learn that correct causal model of the world, it's just going to require a lot of interaction.

Amy Zhang:

And so a big part of that is just scaling up our algorithms, building larger multitask simulations so that we can develop agents that can use information from other tasks, leverage that information in order to solve a new task. I think everything that we've done so far has just been really toy.

Amy Zhang:

And part of the problem is the sample inefficiency. I think again it's a trade-off of what inductive biases do we want to put in to improve sample efficiency and which ones we don't, and then we pay the cost of sample efficiency, but we get this promise of better generalization.

Amy Zhang:

And I think we don't really know where that line is and the line is probably different for different classes of problems. So I guess I would say we need better algorithms, we need better sample efficiency so that we can actually do research on these like larger scale problems and we need better benchmarks. We need better simulation environments, real-world environments, things that we can actually iterate on quickly. So I think these are all limiting factors.

Robin:

And you mentioned inductive bias. Like it seems like there's that two sides of the coin in terms of generalization and inductive bias.

Amy Zhang:

Yeah.

Robin:

And how does that I guess when I think of deep learning, I think of that the inductive bias is largely about how you set up, how you frame the deep learning problem and how you set how you structure your network. And is that the same case in RL? Is all the inductive bias coming from the network design? Or how do you how do you see designing the inductive bias in an RL problem. Like is the algorithm really changing the inductive bias?

Amy Zhang:

It can. So a lot of like, you know, let's say let's just focus on like different model free RL algorithms.

Amy Zhang:

PPO, TRPO, like DDPG, like all of these different algorithms just have slightly different tricks in terms of the objective, right? Like the main objective is always the same. Like if it's policy gradient, you're just trying to get your policy to choose an action that's going to give higher return. Like that stays the same across all of these different algorithms, but you have different inductive biases as part of the objective. Like, you know, stay close to the previous policy. Like, you know, do updates that doesn't that don't change your policy very much.

Amy Zhang:

And so all of these things can are, a lot of these were meant to like stabilize training, but I think you can also do similar things in order to incorporate like inductive biases about the real world. So yes, there's a lot of architectural things that we can do. You know, we can use like attention masks, we can use residual nets, like we can do all of these things to try and like incorporate these inductive biases to like improve optimization, improve generalization.

Amy Zhang:

But we have another thing in RL that we don't really have in supervised learning as much, which is like this auxiliary objective. And so people use as auxiliary objectives like learning the dynamics of the environment, learning the dynamics of the reward of the environment, you know, keeping the entropy of the policy low or high. So like there are all of these things that we do. that is like based on our intuition of what will work well.

Robin:

Thanks. I'm gonna re-listen to that a few times. Okay, so let's move on to MBRL lib. So I see that you're a co-author for this library MBRL lib, which I gather is model-based RL library from Facebook Research. Can you tell us a bit about MBRL lib?

Amy Zhang:

Yeah. So this is a project that was led by Louis Punita who's a research engineer in Fair Montreal. I'm really excited about this project. So one of the difficulties of RL research, as I'm sure you know, is just the reproducibility, the fact that these tiny little hacks or like design decisions, implementation decisions have a really large impact on performance.

Amy Zhang:

And there are there have been an abundance of really great really usable modular libraries for model-free RL that have come out. And I think it's led to an explosion of research. Like it means that it's now research is now accessible to a lot more people because they have this platform to build off of. I think we haven't really seen this explosion as much in model-based RL.

Amy Zhang:

In big part because there just haven't there just hasn't been a good library consisting of many algorithms that is stable, easy to use, readable, modular, has hyperparameters for a bunch of benchmark environments.

Amy Zhang:

And so that's what this is. And so that's what NBRL lib is. And this is open sourced and the goal is to have practitioners, researchers use this library, contribute to this library in order to further model-based RL research.

Robin:

I see that you have Nathan Lambert as a co-author and he hinted at this library coming out when he was on episode 19, but I think he didn't name it at the time because it wasn't announced yet.

Amy Zhang:

Yeah.

Robin:

Yeah, and he did that incredible work using the model-based RL to get that tumbling behavior with the half cheetah, which kind of completely destroyed the benchmark, that benchmark, I think, for that environment was a very un very shocking score. Yeah. So it's cool to see this. That's great to see. So I can't wait to check that out. And so right now I think there's two algorithms implemented. And so I guess you're saying this the plan is to have that as a as a long-term project to grow that set.

Amy Zhang:

Yes. And so the goal is that there will also be, there have already been sort of users who have been contributing back to it. And so the goal is that like if you use the library to develop a new algorithm and write a paper about your algorithm, that you can submit a PR to add that to the library. What so right now the two algorithms in the library focus on proprioceptive state, and we're working on adding some algorithms that focus on rich observations as well to it.

Amy Zhang:

So it it's sort of it'll be usable for both of those settings.

Robin:

Ooh, rich observation model base.

Amy Zhang:

Yeah.

Robin:

Okay, so can you comment on how do you see the balance between like following the literature and other people's work and then also coming up with your own ideas. Like this just the flood of papers doesn't seem to be slowing down and I I'm sure all researchers could spend all day, every day just reading. How do you how do you kind of think about that balance?

Amy Zhang:

I guess that is a balance. I mean, m I guess my advice would definitely be read. Like read a lot. I don't know if I assume that this experience is shared by a lot of people, but I actually found that I assumed a lot more had been done than actually had been. And reading made me understand where the holes are and it makes you sort of realize like what is still left to do.

Amy Zhang:

When I enter into like a new sub-area. I think I typically tend to assume that like that a lot of major work has already been done and there's no point in doing it and there's like no contributions to be made.

Amy Zhang:

And I think when you read the literature and when you follow what's going on and recent papers are a good way of doing this because, you know, they'll have related work sections where like they explain what's been going on in the field so far and like what has what is left to do. it really it yeah it helps you see like where the holes are and where you can sort of step in and contribute in terms of coming up with my own ideas and sort of like that balance I've actually found that the easiest way to come up with new ideas is just through talking to people.

Amy Zhang:

Like I guess like my advice would be to just like have research conversations with like people in your lab, with people at conferences. you know, this will be a lot easier when we move back to in-person conferences. But a lot of my collaborations have come about just from meeting up with people at conferences and just chatting and it just makes you realize like a new fun idea that or a new insight that doesn't seem to really have spread in the literature yet.

Amy Zhang:

So I think in terms of like a like a balance makes it sound like it's some like stationary thing. I guess I would say it's usually what it should be is like you're following the literature. When you enter into like a new topic or new area, you should be doing a lot more following the literature.

Amy Zhang:

And then as you get more and more aware of like what's established, you know, like what's been done like in the last like 10, 20 years, then talking to other people and that kind of helps you figure out like where you can contribute.

Robin:

Great. And then do you do you spend much time focused on things well outside of RL or deep learning in terms of reading or concepts to find raw material for your for your work?

Amy Zhang:

I guess actually like a lot of inspiration comes from like the older RL literature, like the pre-deep learning stuff. I think there's a lot of really nice ideas. Like people have thought very carefully about different assumptions to make about different environments, like how to utilize those assumptions. So I found that literature to be very rich to dive into in order to get inspiration for how to develop algorithms and algorithms with guarantees that use deep learning and that can that can get scaled up to the kinds of problems that we deal with today.

Amy Zhang:

Yeah, so I guess like it's more of like the traditional RL focus. Actually, yeah, so I did want to say like bi simulation, you know, the stuff that Pablo has worked on and that I've worked on, by simulation is actually very old. It comes from like the formal verification community with regards to like how do you determine if two systems are the same based on their inputs and outputs.

Amy Zhang:

And then in the 90s, by simulation got transferred over or defined for the RL setting and then there's just been like a slow trickle of papers, especially by Norm Ferns and Pablo about by simulation for RL. So I think old ideas. I think there's a lot of richness in old ideas. Everything's been done before. It's just about modernizing it.

Robin:

Cool. Okay. And then besides your own work, are there other things happening in RL these days that you're particularly excited about?

Amy Zhang:

Lately I've been focusing more on compositional generalization. And so actually less lately and again sort of more back in the day, there's a lot of work on factored MDPs and object-oriented MDPs, so different kinds of assumptions of structure that lend themselves really nicely to achieving compositional generalization. I think these ideas tie a lot more closely to model-based RL rather than model-free. which is again why we've been pushing this MBRL lib.

Amy Zhang:

In terms of work that's more that's been coming out more recently, I think there's been a lot of exciting work on the use of external data, like again, trying to use information sources or feedback sources that aren't just reward because reward is really hard to design in a lot of problems and it often can be sparse.

Amy Zhang:

And so if we can use other sources of data like demonstrations, like videos of humans like performing tasks, then in order to speed up learning, I think those things are really exciting. There's a paper out of Chelsea Finn's lab, especially.

Amy Zhang:

I don't remember the title, but the first author, the first author is Annie. It was something about in the wild RL from in the wild videos and so I think they used YouTube videos in order to improve sample efficiency of RL across multiple tasks. That was really exciting.

Robin:

Is there anything else that I should have asked you about today or that you think the audience might want to hear about?

Amy Zhang:

I guess that you know I'm pretty biased. But I think you did a really great job of asking a lot of questions that at least I think are important in about generalization and reinforcement learning. So yeah, this has been really fun.

Robin:

Awesome. And likewise, so do you have any suggestions for the show or the format or who we should hear from or anything else about the show? I I'm hoping that it can be a useful resource to other people and it's actually really hard to get critical feedback.

Amy Zhang:

I'm a huge fan of just like more interaction. Obviously that's very difficult in podcast form. I think, yeah, I guess that is just hard with podcasts. I just like Q&A sessions are always nice. I don't know how you, I guess, like get feedback from your viewers or listeners at this, but I'm curious like if that's something that you incorporate in terms of the show?

Robin:

Okay, so I have done a few polls on the Twitter. So the there's the Twitter, which is TalkRL Podcast, and there's quite a few followers there and there is some interaction. We get some comments. I did some polls to ask people about general things but me and I also asked who people would like to see and actually a number of guests came out of out of those questions so that would be one thing.

Robin:

I guess another thing I could do is pre announce the guest and then ask get people to ask things on the Twitter. Maybe is that what you're pointing to?

Amy Zhang:

Yeah, I think, yeah, that would be nice. Yeah, just the ways and of like getting listeners involved. I'm a huge fan, I guess like where that comes from is like I'm a huge fan of like the unconference format that Ian Goodfellow has sort of espoused, where instead of creating a conference where you have speakers who are invited and sort of like talk out of crowd, you instead have the participants bring the content, right? Like you have them create breakout groups and lead discussions.

Amy Zhang:

And I think it's a really great, great format. In terms of who else you should hear from, again, from my very biased perspective, I think Claire, I've done a bunch of really great work with her. She's a very strong researcher, I've really enjoyed our collaborations. She has done a lot of really strong work in terms of causal inference and RL and formal verification. Audrey Durand, she is a professor at University of Laval. She's does bandit theory and as well as RL for healthcare.

Amy Zhang:

So I'm sure she has like a lot of fun anecdotes about using RL and bandits in the real world. And George Conadaris from Brown obviously is a, I think we share a lot of the same views.

Robin:

Awesome. These are great suggestions. I've actually wanted to have Claire Lyle on the show for a while and I've had the been lucky to meet her. I did invite Audrey and I will follow up with her. And George is a great suggestion too, so thanks for that.

Amy Zhang:

Yeah.

Robin:

Dr. Amy Zhang, this has been fantastic. Thank you so much for sharing your time today and your insight with TalkRL.

Amy Zhang:

Yeah, thank you for having me.

Robin:

Notes and links for this episode are at talkrl.com. If you like this show, I need your support. You can help in a few ways. One, subscribe on your favorite podcast platform. Subscriptions make a big difference. Two, Follow us on Twitter at TalkRL Podcast. We love retweets. 3.

Robin:

Give us a 5-star rating on Apple Podcasts. If you don't think we deserve 5 stars, let us know on Twitter what we could do better.

Creators and Guests

Robin Ranjit Singh Chauhan
Host
Robin Ranjit Singh Chauhan
๐ŸŒฑ Head of Eng @AgFunder ๐Ÿง  AI:Reinforcement Learning/ML/DL/NLP๐ŸŽ™๏ธHost @TalkRLPodcast ๐Ÿ’ณ ex-@Microsoft ecomm PgmMgr ๐Ÿค– @UWaterloo CompEng ๐Ÿ‡จ๐Ÿ‡ฆ ๐Ÿ‡ฎ๐Ÿ‡ณ
Amy Zhang
Broadcast by