Linguistic communication as (inverse) reward design
CSAILMIT
Abstract
Natural language is an intuitive and expressive way to communicate reward information to autonomous agents.
It encompasses everything from concrete instructions to abstract descriptions of the world.
Despite this, natural language is often challenging to learn from: it is difficult for machine learning methods to make appropriate inferences from such a wide range of input.
This paper proposes a generalization of reward design as a unifying principle to ground linguistic communication: speakers choose utterances to maximize expected rewards from the listener’s future behaviors.
We first extend reward design to incorporate reasoning about unknown future states in a linear bandit setting.
We then define a speaker model which chooses utterances according to this objective.
Simulations show that shorthorizon speakers (reasoning primarily about a single, known state) tend to use instructions, while long-horizon speakers (reasoning primarily about unknown, future states) tend to describe the reward function.
We then define a pragmatic listener which performs inverse reward design by jointly inferring the speaker’s latent horizon and rewards.
Our findings suggest that this extension of reward design to linguistic communication, including the notion of a latent speaker horizon, is a promising direction for achieving more robust alignment outcomes from natural language supervision.
Introduction
Imagine taking up mushroom foraging as a hobby.
How would you learn which fungi are delicious and which are deadly?
Learning from direct experience (Sutton and Barto, 2018) seems risky.
But how might we best learn from others?
Prior work in reinforcement learning (RL) has examined a number of social learning strategies, including passive inverse reinforcement learning (observe an expert pick mushrooms, then infer their reward function;
Ng and Russell, 2000; Abbeel and Ng, 2004) or active preference learning (offer an expert pairs of mushrooms, observe which one they eat, and infer their reward function; Markant and Gureckis, 2014;
Christiano et al., 2017; Basu et al., 2018).
We posit that few humans would rely on such indirect observations if they had access to a cooperative teacher (Vélez and Gweon, 2021; Gweon, 2021; Wang et al., 2020).
For example, an expert guiding a foraging trip might demonstrate or verbally instruct the learner to pick certain mushrooms rather than others (Shafto et al., 2014;
Ho et al., 2016).
While such explicit instruction has been a useful tool for guiding RL agents (Goyal et al., 2019;
Luketina et al., 2019; Fu et al., 2019;
Tellex et al., 2020), natural language affords much richer forms of expression.
For example, an expert teaching a seminar might describe how to recognize edible or toxic mushrooms from their features.
1 Descriptive language is particularly powerful if learners can expect experts to prioritize relevant and context-sensitive information (Sperber and Wilson, 1986; Tessler and Goodman, 2019).
To formalize these expectations, we generalize models of reward design (Singh et al., 2009) to linguistic communication in a linear bandit setting.
Section 2 begins by defining a speaker that chooses utterances to maximize an (imagined) listener’s expected rewards over the likely distribution of future states.
Section 3 shows that speakers focused on a single state prefer instructions (designating an action to take), while those reasoning about many states prefer descriptions (providing information about the reward function).
Finally, we consider how a listener might learn from such a speaker.
Section 4 defines a pragmatic listener which performs inverse reward design (IRD, Hadfield-Menell et al., 2017), to learn about rewards from both instructions and descriptions.
Using IRD on natural language input offers two distinct benefits over its non-linguistic formulation.
First, language is expressive yet tractable (for humans): while reward functions are notoriously difficult to specify (Amodei et al., 2016), natural language provides an accessible and expansive space of proxy rewards.
Second, language can address future settings : speakers can refer to actions or features which are not physically present.
Thus, while reward design and IRD assume the reward designer optimizes a known Markov Decision Process (MDP), our formulation relaxes this requirement.
We show that pragmatic listeners which jointly infer the speaker’s reward function and distribution over states reliably outperform a literal listener.
Communication as Reward Design Linear Bandits
We begin by formulating the reward design problem in a linear bandit setting (Lattimore and Szepesvari, 2020; Amin et al., 2017).
Formally, we define a set of A possible actions.
Actions are associated with a binary feature vector ϕ :
A → { 0 , 1 } K (e.g. a mushroom may be green or not; have spots or not).
Rewards are defined as a function of these features: R : ϕ ( a ) → R .
We assume they are a linear combination of the features:
R ( a, [Equation] =
[Equation] a ) (1) so w is a vector that defines the value of each feature (e.g. green mushrooms are tasty and blue are toxic; see Fig.
1A).
Each task consists of a sequence of H i.i.d.
states.
At each time step t < H , the agent is presented with a state s t consisting of a subset of possible actions: s t ⊆
A (e.g., a particular mushroom patch).
They choose an action a ∈ s t according to their policy, π L : S → ∆( A ) .
While the bandit problem is typically considered as an individual learning problem, we assume that rewards are not directly observable and instead ask how agents should learn socially .
We formalize the social learning problem by introducing a second agent: a speaker who knows the true rewards w and the initial state s 0 , and produces an utterance u .
The listener updates their policy to π L ( a | u, s ) before beginning to choose actions.
Intuitively, the horizon H determines how much supervision the speaker exerts.
H = 1 is maximum supervision (i.e. guided foraging), whereas H → ∞ is minimal supervision (teaching the listener to forage in future settings).
We first assume H is known to both listener and speaker, but later relax this assumption.
This social learning framework exposes two interrelated problems.
First, what should the speaker agent say to be most helpful?
And second, how should the listener update their policy in light of this information?
Speakers as Reward Designers
Drawing on the
Rational Speech Act framework (RSA, Goodman and Frank, 2016)
, we define a speaker S 1 that chooses utterances u according to a utility function U S 1 ( · ) :
[Equation]
where β S 1 is the speaker’s soft-max temperature.
But what utility is appropriate?
Rather than defining utility simply as Gricean informativeness (Grice, 1975), i.e. inducing true beliefs, we suggest that a cooperative speaker should maximize the listener’s rewards , thus grounding utility in terms of the listener’s subsequent actions.
When the state is known, the present utility of an utterance is the expected reward from using the resulting policy to choose an action in that state:
[Equation]
This formulation is equivalent to the reward design objective (Singh et al., 2009; Hadfield-Menell et al., 2017), where the reward designer chooses a proxy reward for a single, known MDP.
However, because only the first state is known, we must also consider how well the policy generalizes to other mushroom patches.
Thus, unlike the reward design objective, speakers may reason about future states.
We represent the future utility of an utterance with respect to some distribution over states P ( s ) :
[Equation]
Because states are i.i.d.
in the bandit setting, a speaker optimizing for a horizon H can be defined as a linear combination of Eqs.
3 and 4:
[Equation]
where H = 1 reduces to Eq. 3.
We next define how utterances may affect the listener’s policy.
Choosing Optimal Utterances
We formally define two classes of utterances, instructions and descriptions , by specifying how they affect the policy of a “literal” listener.
We then show how varying the horizon H systematically affects the speaker’s choice of utterance.
Instructions
Instructions map to specific actions or trajectories (Tellex et al., 2011; Jeon et al., 2020).
Given an instruction, a literal listener executes the corresponding action.
If the action is not available, the listener chooses an action randomly:
[Equation]
where δ
[Equation]
represents the meaning of u , evaluating to one when utterance u grounds to a and zero otherwise.
An instruction is a partial policy : it designates the correct action in a subset of states.
Descriptions
Rather than mapping to a specific action, descriptions provide information about the world (Ling and Fidler, 2017; Narasimhan et al., 2018; Sumers et al., 2021b).
Following Sumers et al.
(2021a), we assume that descriptions provide the reward of a single feature, similar to feature queries (Basu et al., 2018).
Formally, we define descriptions as a tuple: a one-hot binary feature vector and a scalar value, ⟨ 1 K , R ⟩ .
These are messages like ⟨ Blue, -2 ⟩ .
Given a description, a literal listener “rules out” inconsistent hypotheses about reward weights w :
[Equation]
(7) where δ (cid:74) u (cid:75) ( w ) represents the meaning of u , evaluating to one when u is true of w and zero otherwise.
Intuitively, descriptions set L 0 ’s beliefs about the reward of a single feature without affecting others.
Descriptions need not be accurate; for example, ⟨ Spotted, +2 ⟩ is a false but valid utterance.
The listener then marginalizes over possible reward functions to choose an action:
[Equation]
where β L 0 is again a softmax optimality.
Horizons and Utterance Preferences
We use simulations to explore the effects of speaker horizons and utterance sets.
Fig.
1A shows our bandit setting.
“Instruction” utterances correspond to the nine actions.
“Description” utterances are the 6 features × 5 values in [ − 2 , − 1 , 0 , 1 , 2] , yielding 30 feature-value tuples.
We assume the listener begins with a uniform prior over reward weights and set β L 0 = 3 , β S 1 = 10 .
We use states consisting of three unique actions, giving 84 possible states.
To quantify how the horizon H affects the generalization of the listener’s policy, we repeat the task for all 84 start states using horizons ranging 1-10 and different utterance sets.
Fig 1B shows one example, and Fig 2 plots a literal listener’s average future rewards.
When the horizon is short (small
H )
, speakers focus on the visible state, producing utterances which generalize poorly (low future rewards).
As H increases, they provide more generally useful information.
Finally, instructions are most useful at short horizons; speakers with access to descriptions use them exclusively when H > 2 .
Learning from Utterances
We now ask how the listener should learn from the speaker’s utterance, using pragmatic inference to recover information about the reward function.
Known Horizon
Following the standard RSA formulation, a pragmatic listener L 1 can invert the speaker model.
When the speaker’s horizon H is known, this is equivalent to inverse reward design (Hadfield-Menell et al., 2017):
[Equation]
Given an instruction, L 1 can recover information about the reward weights; given a description, Lcan recover information about features that were not mentioned.
The L 1 listener then chooses actions with respect to this posterior by substituting it into Eq. 8.
Fig.
3 shows the gain in “future” rewards for a pragmatic listener ( L 1 - L 0 ) when the speaker has access to both instructions and descriptions, and their horizon is known.
Pragmatics are particularly helpful when the speaker has a short horizon and is not attempting to provide general information.
Reward inference works best when the listener knows the speaker’s horizon, but can reduce performance if this assumption is incorrect.
Jointly inferring the rewards and horizon (Eq. 10) mitigates this risk.
Misaligned Horizons
However, unlike IRD, in linguistic communication the speaker’s horizon H is not explicitly known.
Prior work has highlighted the risks of assuming a human is behaving pedagogically when they are not (Milli and Dragan, 2020), so we test one form of misalignment: when the speaker H =
but the listener assumes a H ranging from 1-10.
Fig.
3 shows that when the pragmatic listener assumes a longer horizon than the speaker intends, it overgeneralizes and performs worse than L 0 .
Inference over Speaker Horizons
To mitigate the risk of horizon misalignment, we can instead assume the speaker’s horizon is unknown.
Given an utterance, the listener jointly infers both their horizon and rewards, then marginalizes out the horizon:
[Equation]
We test a pragmatic listener with a uniform prior over H ∈ [1 , 2 , 3 , 4 , 5 , 10] .
This results in more conservative reward inference, but avoids the misalignment risk posed by assuming the speaker’s horizon.
Fig.
3 shows the results.
Discussion
In this work, we formalized communication as reward design, allowing us to unify instructions and descriptions under a single objective.
Simulations show that instructions are optimal when the state is known, but descriptions are optimal when considering a distribution over states.
Finally, a pragmatic listener can jointly infer the speaker’s horizon and reward function.
One important limitation of this work is our reliance on simulations.
Future work should validate the speaker model proposed here with behavioral data.
Finally, developmental studies indicate that even young children reason about exploration costs when teaching (Bridgers et al., 2020), suggesting that the reward design objective could be extended further to incorporate reasoning about individual learning. Acknowledgements
TRS is supported by the NDSEG Fellowship Program and RDH is supported by the NSF (grant #1911835).
This work was additionally supported by a John Templeton Foundation grant to TLG (#61454) and a grant from the Hirji Wigglesworth
Family Foundation to DHM.