Sequential Causal Imitation Learning with Unobserved Confounders

Daniel Kumor, Junzhe Zhang, Elias Bareinboim

Introduction

Without access to observational data, an agent must learn how to operate at a suitable level of performance through trial and error . This from-scratch approach is often impractical in environments with the potential of extreme negative - and final - outcomes (driving off a cliff). While both Nature and machine learning researchers have approached the problem from a wide variety of perspectives, a particularly potent method which has been used with great success in many learning machines, including humans, is exploiting observations of other agents in the environment .

Learning to act by observing other agents offers a data multiplier, allowing agents to take into account others’ experiences. Even when the precise loss function is unknown (what exactly goes into being a good driver?), the agent can attempt to learn from “experts”, namely agents which are known to gain an acceptable reward at the target task. This approach has been studied under the umbrella of imitation learning . Several methods have been proposed, including inverse reinforcement learning and behavior cloning . The former attempts to reconstruct the loss/reward function that the experts minimize and then use it for optimization; the latter directly copies the expert’s actions (behavior cloning).

Despite the power entailed by this approach, it relies on a somewhat stringent condition: the expert and imitator’s sensory capabilities need to be perfectly matched. As an example, self-driving cars rely solely on cameras or lidar, completely ignoring the auditory dimension - and yet most human demonstrators are able to exploit this data, especially in dangerous situations (car horns, screeching tires). Perhaps without a microphone, the self-driving car would incorrectly attribute certain behaviors to visual stimuli, leading to a poor policy? For concreteness, consider the scenario shown in Fig. 1(a), where the human driver (XX, i.e., the demonstrator, in blue) is looking forward (FF), and can hear car horns (HH) from cars behind (BB), and to the side (SS). The driver’s performance is represented by a variable YY (red), which is unobserved (dashed node). Since our dataset only contains visual data, car horns HH remain unobserved to the learning agent (i.e., the imitator). Despite not being able to hear car horns, the learner from Figure 1(a) had a full view of the car’s surroundings, including cars behind and to the side, which turns out to be sufficient to perform imitation in this example. Consider an instance where F,B,SF,B,S are drawn uniformly over {0,1}\{0,1\}. The reward YY is decided by ¬X⊕F⊕B⊕S\neg X\oplus F\oplus B\oplus S; ⊕\oplus represents the exclusive-or operator. The human driver decides the action X←HX\leftarrow H where values of horn HH is given by F⊕B⊕SF\oplus B\oplus S. Preliminary analysis reveals that the learner could perfectly mimic the demonstrator’s decision-making process using an imitating policy X←F⊕B⊕SX\leftarrow F\oplus B\oplus S. On the other hand, if the driving system does not have side cameras, the side view SS becomes latent; see Figure 1(b). The learner’s reward IE[Y∣do(π)]{\rm I\kern-3.00003ptE}[Y|\text{do}(\pi)] is equal to 0.50.5 for any policy π(x∣f,b)\pi(x|f,b), which is far from the optimal demonstrator’s performance, IE[Y]=1{\rm I\kern-3.00003ptE}[Y]=1.

Based on these examples, there arises the question of determining precise conditions under which an agent can account for the lack of knowledge or observations available to the expert, and how this knowledge should be combined to generate an optimal imitating policy, giving identical performance as the expert on measure YY. These questions have been recently investigated in the context of causal imitation learning , where a complete graphical condition and algorithm were developed for determining imitability in the single-stage decision-making setting with partially observable models (i.e., in non-Markovian settings). Other structural assumptions, such as linearity , were also explored in the literature, but were still limited to a single action. Finally, explore the case when expert and imitator can observe the same contexts, but the causal diagram is not available. Despite this progress, it is still unclear how to systematically imitate, or even whether imitation is possible when a learner must make several actions in sequence, where expert and imitator observe differing sets of variables (e.g., Figures 1(c) and 1(d)).

The goal of this paper is to fill this gap in understanding. More specifically, our contributions are as follows. (1) We provide a graphical criterion for determining whether imitability is feasible in sequential settings based on a causal graph encoding the domain’s causal structure. (2) We propose an efficient algorithm to determine imitability and to find the policy for each action that leads to proper imitation. (3) We prove that the proposed criterion is complete (i.e. both necessary and sufficient). Finally, we verify that our approach compares favorably with existing methods in contexts where a demonstrator has access to latent variables through simulations. Due to space constraints, proofs are provided in the complete technical report .

We start by introducing the notation and definitions used throughout the paper. In particular, we use capital letters for random variables (ZZ), and small letters for their values (zz). Bolded letters represent sets of random variables and their samples (Z={Z1,...,Zn}\bm{Z}=\{Z_{1},...,Z_{n}\}, z={z1∼Z1,...,zn∼Zn}\bm{z}=\{z_{1}\sim Z_{1},...,z_{n}\sim Z_{n}\}). ∣Z∣|\bm{Z}| represents a set’s cardinality. The joint distribution over variables Z\bm{Z} is denoted by P(Z)P(\bm{Z}). To simplify notation, we consistently use the shorthand P(zi)P(z_{i}) to represent probabilities P(Zi=zi)P(Z_{i}=z_{i}).

The basic semantic framework of our analysis rests on structural causal models (SCMs) [17, Ch. 7]. An SCM MM is a tuple ⟨U,V,F,P(u)⟩\langle\bm{U},\bm{V},\bm{F},P(\bm{u})\rangle with V\bm{V} the set of endogenous, and U\bm{U} exogenous variables. F\bm{F} is a set of structural functions s.t. for fV∈Ff_{V}\in\bm{F}, V←fV(paV,uV)V\leftarrow f_{V}(\mathit{pa}_{V},u_{V}), with PAV⊆V,UV⊆U\mathit{PA}_{V}\subseteq\bm{V},U_{V}\subseteq\bm{U} . Values of U\bm{U} are drawn from an exogenous distribution P(u)P(\bm{u}), inducing distribution P(V)P(\bm{V}) over the endogenous V\bm{V}. Since the learner can observe only a subset of endogenous variables, we split V\bm{V} into O⊆V\bm{O}\subseteq\bm{V} (observed) and L=V∖O\bm{L}=\bm{V}\setminus\bm{O} (latent) sets of variables. The marginal P(O)P(\bm{O}) is thus referred to as the observational distribution.

Each SCM MM is associated with a causal diagram G\mathcal{G} where (e.g., see Figure 2(d)) solid nodes represent observed variables O\bm{O}, dashed nodes represent latent variables L\bm{L}, and arrows represent the arguments pa(V)\mathit{pa}(V) of each functional relationship fVf_{V}. Exogenous variables U\bm{U} are not explicitly shown; a bi-directed arrow between nodes ViV_{i} and VjV_{j} indicates the presence of an unobserved confounder (UC) affecting both ViV_{i} and VjV_{j}. We will use standard conventions to represent graphical relationships such as parents, children, descendants, and ancestors. For example, the set of parent nodes of X\bm{X} in G\mathcal{G} is denoted by pa(X)G=∪X∈Xpa(X)G\mathit{pa}(\bm{X})_{\mathcal{G}}=\cup_{X\in\bm{X}}\mathit{pa}(X)_{\mathcal{G}}. ch\mathit{ch}, de\mathit{de} and an\mathit{an} are similarly defined. Capitalized versions Pa,Ch,De,An\mathit{Pa},\mathit{Ch},\mathit{De},\mathit{An} include the argument as well, e.g. De(X)G=de(X)G∪X\mathit{De}(\bm{X})_{\mathcal{G}}=\mathit{de}(\bm{X})_{\mathcal{G}}\cup\bm{X}. An observed variable Vi∈OV_{i}\in\bm{O} is an effective parent of Vj∈VV_{j}\in\bm{V} if there is a directed path from ViV_{i} to VjV_{j} in G\mathcal{G} such that every internal node on the path is in L\bm{L}. We define pa+(S)\mathit{pa}^{+}(\bm{S}) as the set of effective parents of variables in S\bm{S}, excluding S\bm{S} itself, and Pa+(S)\mathit{Pa}^{+}(\bm{S}) as S∪pa+(S)\bm{S}\cup\mathit{pa}^{+}(\bm{S}). Other relations, like ch+(S)ch^{+}(\bm{S}) are defined similarly.

A path from a node XX to a node YY in G\mathcal{G} is said to be “active" conditioned on a (possibly empty) set W\bm{W} if there is a collider at AA along the path (→A←\rightarrow A\leftarrow) only if A∈An(W)A\in\mathit{An}(\bm{W}), and the path does not otherwise contain vertices from W\bm{W} (d-separation, ). X\bm{X} and Y\bm{Y} are independent conditioned on W\bm{W} (X⊥ ⁣ ⁣ ⁣⊥Y∣W)G(\bm{X}\perp\!\!\!\perp\bm{Y}|\bm{W})_{\mathcal{G}} if there are no active paths between any X∈XX\in\bm{X} and Y∈YY\in\bm{Y}. For a subset X⊆V\bm{X}\subseteq\bm{V}, the subgraph obtained from G\mathcal{G} with edges outgoing from X\bm{X} / incoming into X\bm{X} removed is written GX‾\mathcal{G}_{\underline{\bm{X}}}/GX‾\mathcal{G}_{\overline{\bm{X}}} respectively. Finally, we utilize a grouping of observed nodes, called confounded components (c-components, ).

For a causal diagram G\mathcal{G}, let N\bm{N} be a set of unobserved variables in L∪U\bm{L}\cup\bm{U}. A set C⊆Ch(N)∩O\bm{C}\subseteq\mathit{Ch}(\bm{N})\cap\bm{O} is a c-component if for any pair Ui,Uj∈NU_{i},U_{j}\in\bm{N}, there exists a path between UiU_{i} and UjU_{j} in G\mathcal{G} such that every observed node Vk∈OV_{k}\in\bm{O} on the path is a collider (i.e., →Vk←\rightarrow V_{k}\leftarrow).

C-components correspond to observed variables whose values are affected by related sets of unobserved common causes, such that if A,B∈CA,B\in\bm{C}, (A⊥̸ ⁣ ⁣ ⁣⊥B∣O∖{A,B})(A\not\perp\!\!\!\perp B|\bm{O}\setminus\{A,B\}). In particular, we focus on maximal c-components C\bm{C} , where there doesn’t exist c-component C′\bm{C}^{\prime} s.t. C⊂C′\bm{C}\subset\bm{C}^{\prime}. The collection of maximal c-components forms a partition C1,…,Cm\bm{C}_{1},\dots,\bm{C}_{m} over observed variables O\bm{O}. For any set S⊆OS\subseteq\bm{O}, let C(S)\bm{C}(S) be the union of c-components Ci\bm{C}_{i} that contain variables in SS. For instance, for variable ZZ in Figure 1(d), the c-component C({Z})={Z,X1}\bm{C}(\{Z\})=\{Z,X_{1}\}.

Causal Sequential Imitation Learning

We are interested in learning a policy over a series of actions X⊆O\bm{X}\subseteq\bm{O} so that an imitator gets average reward Y∈VY\in\bm{V} identical to that of an expert demonstrator. More specifically, let variables in X\bm{X} be ordered by X1,…,XnX_{1},\dots,X_{n}, n=∣X∣n=|\bm{X}|. Actions are taken sequentially by the imitator, where only information available at the time of the action can be used to inform a policy for Xi∈XX_{i}\in\bm{X}. To encode the ordering of observations and actions in time, we fix a topological ordering on the variables of G\mathcal{G}, which we call the “temporal ordering”. We define functions \before(Xi)\before(X_{i}) and \after(Xi)\after(X_{i}) to represent nodes that come before/after an action Xi∈XX_{i}\in\bm{X} following the ordering, excluding XiX_{i} itself. A policy π\pi on actions X\bm{X} is a sequence of decision rules {π1,…,πn}\{\pi_{1},\dots,\pi_{n}\} where each πi(Xi∣Zi)\pi_{i}(X_{i}|\bm{Z}_{i}) is a function mapping from domains of covariates Zi⊆\before(Xi)\bm{Z}_{i}\subseteq\before(X_{i}) to the domain of action XiX_{i}. The imitator following a policy π\pi replacing the demonstrator in an environment is encoded by replacing the expert’s original policy in the SCM MM with π\pi, which gives the results of the imitator’s actions as P(V∣do(π))P(\bm{V}|\text{do}(\pi)). Our goal is to learn an imitating policy π\pi such that the induced distribution P(Y∣do(π))P(Y|\text{do}(\pi)) perfectly matches the original expert’s performance P(Y)P(Y). Formally

Given a causal diagram G\mathcal{G}, Y⊆V\bm{Y}\subseteq\bm{V} is said to be imitable with respect to actions X⊆O\bm{X}\subseteq\bm{O} in G\mathcal{G} if there exists π∈Π\pi\in\Pi uniquely discernible from the observational distribution P(O)P(\bm{O}) such that for all possible SCMs MM compatible with G\mathcal{G}, P(Y)M=P(Y∣do(π))MP(\bm{Y})_{M}=P(\bm{Y}|do(\pi))_{M}.

In other words, the expert’s performance on reward YY is imitable if any set of SCMs must share the same imitating policy π∈Π\pi\in\Pi whenever they generate the same causal diagram G\mathcal{G} and the observational distribution P(O)P(\bm{O}). Henceforth, we will consistently refer to Definition 2.1 as the fundamental problem of causal imitation learning. For single stage decision-making problems (X={X}\bm{X}=\{X\}), demonstrated imitability for reward YY if and only if there exists a set Z⊆\before(X)\bm{Z}\subseteq\before(X) such that (Y⊥ ⁣ ⁣ ⁣⊥X∣Z)GX‾\left(Y\perp\!\!\!\perp X|\bm{Z}\right)_{\mathcal{G}_{\underline{X}}}, called the backdoor admissible set, [17, Def. 3.3.1] (Z={F,B,S}\bm{Z}=\{F,B,S\} in Figure 1(a)). It is verifiable that an imitating policy is given by π(X∣F,B,S)=P(X∣F,B,S)\pi(X|F,B,S)=P(X|F,B,S).

Since the backdoor criterion is complete for the single-stage problem, one may be tempted to surmise that a version of the criterion generalized to multiple interventions might likewise solve the imitability problem in the general case (∣X∣>1|\bm{X}|>1). Next we show that this is not the case. Let X1:i\bm{X}_{1:i} stand for a sequence of variables {X1,…,Xi}\{X_{1},\dots,X_{i}\}; X1:i=∅\bm{X}_{1:i}=\emptyset if i<1i<1. generalized the backdoor criterion to the sequential decision-making setting as follows:

Given a causal diagram G\mathcal{G}, a set of action variables X\bm{X}, and target node YY, sets Z1⊆\before(X1),…,Zn⊆\before(Xn)\bm{Z}_{1}\subseteq\before(X_{1}),\dots,\bm{Z}_{n}\subseteq\before(X_{n}) satisfy the sequential backdoor for (G,X,Y)(\mathcal{G},\bm{X},Y) if for each Xi∈XX_{i}\in\bm{X} such that (Y⊥ ⁣ ⁣ ⁣⊥Xi∣X1:i−1,Z1:i)GX‾iX‾i+1:n(Y\perp\!\!\!\perp X_{i}|\bm{X}_{1:i-1},\bm{Z}_{1:i})_{\mathcal{G}_{\underline{X}_{i}\overline{\bm{X}}_{i+1:n}}}.

While the sequential backdoor is an extension of the backdoor to multi-stage decisions, its existence does not always guarantee the imitability of latent reward YY. As an example, consider the causal diagram G\mathcal{G} described in Figure 1(d). In this case, Z1={},Z2={Z}\bm{Z}_{1}=\{\},\bm{Z}_{2}=\{Z\}, {(X1,Z1),(X2,Z2)}\{(X_{1},\bm{Z}_{1}),(X_{2},\bm{Z}_{2})\} is a sequential backdoor set for (G,{X1,X2},Y)(\mathcal{G},\{X_{1},X_{2}\},Y), but there are distributions for which no agent can imitate the demonstrator’s performance (YY) without knowledge of either the latent U1U_{1} or U2U_{2}. To witness, suppose that the adversary sets up an SCM with binary variables as follows: U1,U2∼Bern(0.5)U_{1},U_{2}\sim Bern(0.5), with X1:=U1X_{1}:=U_{1}, Z:=U1⊕U2Z:=U_{1}\oplus U_{2}, X2:=ZX_{2}:=Z and Y=¬(X1⊕X2⊕U2)Y=\lnot(X_{1}\oplus X_{2}\oplus U_{2}), with ⊕\oplus as a binary XOR. The fact that U⊕U=0U\oplus U=0 is exploited to generate a chain where each latent variable appears exactly twice in YY, making Y=¬(U1⊕(U1⊕U2)⊕U2)=1Y=\lnot(U_{1}\oplus(U_{1}\oplus U_{2})\oplus U_{2})=1. On the other hand, when imitating, X1X_{1} can no longer base its value on U1U_{1}, making the imitated Y^=¬(X^1⊕X^2⊕U2)\hat{Y}=\lnot(\hat{X}_{1}\oplus\hat{X}_{2}\oplus U_{2}). The imitator can do no better than IE[Y^]=0.5{\rm I\kern-3.00003ptE}[\hat{Y}]=0.5! We refer readers to [9, Proposition C.1] for a more detailed explanation.

We now introduce the main result of this paper: a generalized backdoor criterion that allows one to learn imitating policies in the sequential setting. For a sequence of covariate sets Z1⊆\before(X1),…,Zn⊆\before(Xn)\bm{Z}_{1}\subseteq\before(X_{1}),\dots,\bm{Z}_{n}\subseteq\before(X_{n}), let Gi′\mathcal{G}^{\prime}_{i}, i=1,…,ni=1,\dots,n, be the manipulated graph obtained from a causal diagram G\mathcal{G} by first (1) removing all arrows coming into nodes in Xi+1:nX_{i+1:n}; and (2) adding arrows Zi+1→Xi+1,…,Zn→Xn\bm{Z}_{i+1}\rightarrow X_{i+1},\dots,\bm{Z}_{n}\rightarrow X_{n}. We can then define a sequential backdoor criterion for causal imitation as follows:

Given a causal diagram G\mathcal{G}, a set of action variables X\bm{X}, and target node YY, sets Z1⊆\before(X1),…,Zn⊆\before(Xn)\bm{Z}_{1}\subseteq\before(X_{1}),\dots,\bm{Z}_{n}\subseteq\before(X_{n}) satisfy the “sequential π\pi-backdoor" The π\pi in “π\pi-backdoor” is part of the name, and does not refer to any specific policy. for (G,X,Y)(\mathcal{G},\bm{X},Y) if at each Xi∈XX_{i}\in\bm{X}, either (1) (Xi⊥ ⁣ ⁣ ⁣⊥Y∣Zi)(X_{i}\perp\!\!\!\perp Y|\bm{Z}_{i}) in (Gi′)Xi‾(\mathcal{G}^{\prime}_{i})_{\underline{X_{i}}}, or (2) Xi∉An(Y)X_{i}\notin An(Y) in Gi′\mathcal{G}^{\prime}_{i}.

The first condition of Definition 2.3 is similar to the backdoor criterion where Zi\bm{Z}_{i} is a set of variables that effectively encodes all information relevant to imitating XiX_{i} with respect to YY. In other words, if the joint P(Zi∪{Xi})P(\bm{Z}_{i}\cup\{X_{i}\}) matches when both expert and imitator are acting, then an adversarial YY cannot distinguish between the two. The critical modification of the original π\pi-backdoor for the sequential setting comes from the causal graph in which this check happens. Gi′\mathcal{G}^{\prime}_{i} can be seen as G\mathcal{G} with all future actions of the imitator already encoded in the graph. That is, when performing a check for XiX_{i}, it is done with all actions after ii being performed by the imitator rather than expert, with the associated parents of each future Xj>iX_{j>i} replaced with their corresponding imitator’s conditioning set. Several examples of Gi′\mathcal{G}^{\prime}_{i} are shown in Figure 3.

The second condition allows for the case where an action at XiX_{i} has no effect on the value of YY once future actions are taken. Since Gi′\mathcal{G}^{\prime}_{i} has modified parents for future Xj>i\bm{X}_{j>i}, the value of XiX_{i} might no longer be relevant at all to YY, i.e. YY would get the same input distribution no matter what policy is chosen for XiX_{i}. This allows XiX_{i} to fail condition (1), meaning that it is not imitable by itself, but still be part of an imitable set X\bm{X}, because future actions can shield YY from errors made at XiX_{i}.

The distinction between condition 1 and condition 2 is shown in Figure 3(c): in the original graph G\mathcal{G} described in Figure 2(c), if ZZ comes after X1X_{1}, then there is no valid adjustment set that can d-separate X1X_{1} from YY. However, if the imitating policy for X2X_{2} uses ZZ instead of WW or X1X_{1} (i.e. πX2=P(X2∣Z)\pi_{X_{2}}=P(X_{2}|Z)), X1X_{1} will no longer be an ancestor of YY in G1′\mathcal{G}^{\prime}_{1}. In effect, the action made at X2X_{2} ignores the inevitable mistakes made at X1X_{1} due to not having access to confounder U1U_{1} when taking the action.

Indeed, the sequential π\pi-backdoor criterion can be seen as a recursively applying the single-action π\pi-backdoor. Starting from the last action XkX_{k} in temporal order, one can directly show that YY is imitable using a backdoor admissible set Zk\bm{Z}_{k} (or XkX_{k} doesn’t affect YY by any causal path). Replacing XkX_{k} in the SCM with this new imitating policy, the resulting SCM with graph Gk−1′G^{\prime}_{k-1} has an identical distribution over YY as G\mathcal{G}. The procedure can then be repeated for Xk−1X_{k-1} using Gk−1′G^{\prime}_{k-1} as the starting graph, and continued recursively, showing imitability for the full set:

Given a causal diagram G\mathcal{G}, a set of action variables X\bm{X}, and target node YY, if there exist sets Z1,Z2,...,Zk\bm{Z}_{1},\bm{Z}_{2},...,\bm{Z}_{k} that satisfy the sequential π\pi-backdoor criterion with respect to (G,X,Y)(\mathcal{G},\bm{X},Y), then YY is imitable with respect to X\bm{X} in G\mathcal{G} with policy π(Xi∣Zi)=P(Xi∣Zi)\pi(X_{i}|\bm{Z_{i}})=P(X_{i}|\bm{Z}_{i}) for each Xi∈XX_{i}\in\bm{X}.

Theorem 2.1 establishes the sufficiency of the sequential π\pi-backdoor for imitation learning. Consider again the diagram in Figure 2(c). It is verifiable that covariate sets Z1={},Z2={Z}\bm{Z}_{1}=\{\},\bm{Z}_{2}=\{Z\} are sequential π\pi-backdoor admissible. Theorem 2.1 implies that the imitating policy is given by π1(X1)=P(X1)\pi_{1}(X_{1})=P(X_{1}) and π2(X2∣Z)=P(X2∣Z)\pi_{2}(X_{2}|Z)=P(X_{2}|Z). Once π\pi-backdoor admissible sets are obtained, the imitating policy can be learned from the observational data through standard density estimation methods for stochastic policies, and supervised learning methods for deterministic policies. This means that the sequential π\pi-backdoor is a method for choosing a set of covariates to use when performing imitation learning, which can be used instead of Pa(Xi)Pa(X_{i}) for each Xi∈XX_{i}\in\bm{X} in the case when the imitator does not observe certain elements of Pa(X)Pa(\bm{X}). With the covariates chosen using the sequential π\pi-backdoor, one can use domain-specific algorithms for computing an imitating policy based on the observational data.

Finding Sequential π\pi-Backdoor Admissible Sets

At each XiX_{i}, the sequential π\pi-backdoor criterion requires that Zi\bm{Z}_{i} is a back-door adjustment set in the manipulated graph Gi′\mathcal{G}^{\prime}_{i}. There already exist efficient methods for finding adjustment sets in the literature , so if the adjustment were with reference to G\mathcal{G}, one could run these algorithms on each XiX_{i} independently to find each backdoor admissible set Zi\bm{Z}_{i}. However, each action XiX_{i} has its Zi\bm{Z}_{i} in the manipulated graph Gi′\mathcal{G}^{\prime}_{i}, which is dependent on the adjustment used for future actions Xi+1:nX_{i+1:n}. This means that certain adjustment sets Zj\bm{Z}_{j} for Xj>iX_{j>i} will make there not exist any Zi\bm{Z}_{i} for XiX_{i} in Gi′\mathcal{G}^{\prime}_{i} that satisfies the criterion! As an example, in Fig. 2(c), X2X_{2} can use any combination of Z,X1,WZ,X_{1},W as a valid adjustment set Z2\bm{Z}_{2}. However, if ZZ comes after X1X_{1} in temporal order, only Z2={Z}\bm{Z}_{2}=\{Z\} leads to valid imitation over X={X1,X2}\bm{X}=\{X_{1},X_{2}\}.

The direct approach towards solving this problem would involve enumerating all possible backdoor admissible sets Zi\bm{Z}_{i} for each XiX_{i}, but there are both exponentially many backdoor admissible sets Zi\bm{Z}_{i}, and exponentially many combinations of sets over multiple Xi:nX_{i:n}. Such a direct exponential enumeration is not feasible in practical settings. To address these issues, this section will see the development of Algorithm 1, which finds a sequential π\pi-backdoor admissible set Z1:n\bm{Z}_{1:n} with regard to actions X\bm{X} in a causal diagram G\mathcal{G} in polynomial time, if such a set exists.

Before delving into the details of Algorithm 1, we describe a method intuitively motivated by the “Nearest Separator" from that can generate a backdoor admissible set Zi\bm{Z}_{i} for a single independent action XiX_{i} in the presence of unobserved variables. While it does not solve the problem of multiple actions due to the issues listed above, it is a building block for Algorithm 1.

Consider the Markov Boundary (minimal Markov Blanket, ) for a set of nodes OX⊆O\bm{O}^{X}\subseteq\bm{O}, which is defined as the minimal set Z⊂O∖OX\bm{Z}\subset\bm{O}\setminus\bm{O}^{X} such that (OX⊥ ⁣ ⁣ ⁣⊥O∖OX∣Z)(\bm{O}^{X}\perp\!\!\!\perp\bm{O}\setminus\bm{O}^{X}|\bm{Z}). This definition can be applied to graphs with latent variables, where it can be constructed in terms of c-components:

Given OX⊆O\bm{O}^{X}\subseteq\bm{O}, the Markov Boundary of OX\bm{O}^{X} in G\bm{G} is Pa+(C(Ch+(OX)))∖OX\mathit{Pa}^{+}(\bm{C}(\mathit{Ch}^{+}(\bm{O}^{X})))\setminus\bm{O}^{X}

If there is a set Z⊆\before(Xi)\bm{Z}\subseteq\before(X_{i}) that satisfies the backdoor criterion for XiX_{i} with respect to YY, then taking GY\mathcal{G}^{Y} as the ancestral graph of YY, the Markov Boundary Z′\bm{Z}^{\prime} of XiX_{i} in GXi‾Y\mathcal{G}^{Y}_{\underline{X_{i}}} has Z′⊆\before(Xi)\bm{Z}^{\prime}\subseteq\before(X_{i}), and also satisfies the backdoor criterion in G\mathcal{G}. The Markov Boundary can therefore be used to generate a backdoor adjustment set wherever one exists.

A naïve algorithm that uses the Markov Boundary of Xi∈XX_{i}\in\bm{X} in (Gi′)Xi‾Y(\mathcal{G}^{\prime}_{i})^{Y}_{\underline{X_{i}}} as the corresponding Zi\bm{Z}_{i}, and returns a failure whenever Zi∉\before(Xi)\bm{Z}_{i}\notin\before(X_{i}) for the sequential π\pi-backdoor is equivalent to the existing literature on finding backdoor-admissible sets. It cannot create a valid sequential π\pi-backdoor for Figure 2(c), since X2X_{2} would have Z2={W}\bm{Z}_{2}=\{W\}, but no adjustment set exists for X1X_{1} that d-separates it from YY in the resulting G1′\mathcal{G}^{\prime}_{1}. We must take into account interactions between actions encoded in Gi′\mathcal{G}^{\prime}_{i}.

We notice that an XiX_{i} does not require a valid adjustment set if it is not an ancestor of YY in Gi′\mathcal{G}^{\prime}_{i} (i.e. XiX_{i} does not need to satisfy (1) of Definition 2.3 if it can satisfy (2)). Furthermore, even if XiX_{i} is an ancestor of YY in Gi′\mathcal{G}^{\prime}_{i}, and therefore must satisfy condition (1) of Definition 2.3, any elements of its c-component that are not ancestors of YY in Gi′\mathcal{G}^{\prime}_{i} won’t be part of (Gi′)Y(\mathcal{G}^{\prime}_{i})^{Y}, and therefore don’t need to be conditioned.

It is therefore beneficial for an action XjX_{j} to have a backdoor adjustment set that maximizes the number of nodes that are not ancestors of YY in Gj−1′\mathcal{G}^{\prime}_{j-1}, so that actions Xi<jX_{i<j} can satisfy (2) of Definition 2.3 if possible, and have the smallest possible c-components in (Gi′)Y(\mathcal{G}^{\prime}_{i})^{Y} (increasing likelihood that backdoor set Zi⊆\before(Xi)\bm{Z}_{i}\subseteq\before(X_{i}) exists if XiX_{i} must satisfy condition (1)).

To demonstrate this intuition, we once again look at Figure 2(c), focusing only on action X2X_{2}. If we were to use {W}\{W\} as Z2\bm{Z}_{2}, we still have the same set of ancestors of YY in G1′\mathcal{G}^{\prime}_{1}. If we switch to {X1}\{X_{1}\}, then WW would no longer be an ancestor of YY in G1′\mathcal{G}^{\prime}_{1} - meaning that X1X_{1} is better as a backdoor adjustment set for X2X_{2} than {W}\{W\} if we only know that X2X_{2} is an action (i.e. WW would directly satisfy (2) of Definition 2.3 if it were the other action). Finally, using {Z}\{Z\} as Z2\bm{Z}_{2} makes both X1X_{1} and WW no longer ancestors of YY in G1′\mathcal{G}^{\prime}_{1}, meaning that it is the best option for the adjustment set Z2\bm{Z}_{2}.

FindOx in Algorithm 1 employs the above ideas to iteratively grow a set OX⊆O\bm{O}^{X}\subseteq\bm{O} of ancestors of X\bm{X} (and including X\bm{X}) in GY\mathcal{G}^{Y} whose elements (possibly excluding X\bm{X}) will not be ancestors of YY once the actions in their descendants are taken. That is, an element Oi∈OXO_{i}\in\bm{O}^{X} where ch+(Oi)⊂OX\mathit{ch}^{+}(O_{i})\subset\bm{O}^{X} is not present in (Gi′)Y(\mathcal{G}^{\prime}_{i})^{Y} for all actions XiX_{i} that come before it in temporal order. Combined with the Markov Boundary, FindOx can be used to generate sequential π\pi-backdoors.

We exemplify the use of Algorithm 1 through Figure 2(c). OX\mathscr{O}^{X} represents a map of observed variables which are not ancestors of YY in Gi<j′\mathcal{G}^{\prime}_{i<j} to the earliest action XjX_{j} in their descendants. The keys of OX\mathscr{O}^{X} will be the set OX\bm{O}^{X}. Considering the temporal order {X1,Z,W,X2,Y}\{X_{1},Z,W,X_{2},Y\}, the algorithm starts from the last node, YY, which has no children and is not an element of X\bm{X}, so is not added to OX\mathscr{O}^{X}. It then carries on to X2X_{2}, which is checked for the existence of a valid backdoor adjustment set. Here, the subgraph of the c-component of X2X_{2} and its parents (HasValidAdjustment) is simply W<spanclass="katex−display"><spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"display="block"><semantics><mrow><mo>→</mo></mrow><annotationencoding="application/x−tex">→</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.3669em;"></span><spanclass="mrel">→</span></span></span></span></span>X2W<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo>→</mo></mrow><annotation encoding="application/x-tex">\rightarrow</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.3669em;"></span><span class="mrel">→</span></span></span></span></span>X_{2}, meaning that we can condition on WW to make X2X_{2} independent of all other observed variables, including YY, in GX2‾\mathcal{G}_{\underline{X_{2}}} (WW is a Markov Boundary for X2X_{2} in GX2‾\mathcal{G}_{\underline{X_{2}}}). The algorithm therefore sets OX={X2:X2}\mathscr{O}^{X}=\{X_{2}:X_{2}\}, because X2X_{2} is an action with a valid adjustment set. Notice that if the algorithm returned at this point with OX={X2}\bm{O}^{X}=\{X_{2}\}, the Markov Boundary of OX\bm{O}^{X} in GX2‾\mathcal{G}_{\underline{X_{2}}} is WW, and corresponds to a sequential π\pi-backdoor for the single action X2X_{2} (ignoring X1X_{1}), with policy π(X2∣W)=P(X2∣W)\pi(X_{2}|W)=P(X_{2}|W).

Next, WW has X2X_{2} as its only child, which itself maps to X2X_{2} in OX\mathscr{O}^{X}. The subgraph of WW’s c-component and its parents is X1<spanclass="katex−display"><spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"display="block"><semantics><mrow><mo>→</mo></mrow><annotationencoding="application/x−tex">→</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.3669em;"></span><spanclass="mrel">→</span></span></span></span></span>WX_{1}<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo>→</mo></mrow><annotation encoding="application/x-tex">\rightarrow</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.3669em;"></span><span class="mrel">→</span></span></span></span></span>W, giving (W⊥ ⁣ ⁣ ⁣⊥O∣X1)GW‾(W\perp\!\!\!\perp\bm{O}|X_{1})_{\mathcal{G}_{\underline{W}}}, and {X1}⊆\before(X2)\{X_{1}\}\subseteq\before(X_{2}), allowing us to conclude that there is a backdoor admissible set for X2X_{2} where WW is no longer an ancestor of YY. We set OX={X2:X2,W:X2}\mathscr{O}^{X}=\{X_{2}:X_{2},W:X_{2}\}, and indeed with OX={X2,W}\bm{O}^{X}=\{X_{2},W\}, the Markov Boundary of OX\bm{O}^{X} in GX2‾\mathcal{G}_{\underline{X_{2}}} is X1X_{1}, and is once again a valid sequential π\pi-backdoor for the single action X2X_{2} (ignoring X1X_{1}), with policy π(X2∣X1)=P(X2∣X1)\pi(X_{2}|X_{1})=P(X_{2}|X_{1}). The WW in OX\bm{O}^{X} was correctly labeled as not being an ancestor of YY after action X2X_{2} is taken.

Since ZZ doesn’t have its children in the keys of OX\mathscr{O}^{X}, and is not an element of X\bm{X}, it is skipped, leaving only X1X_{1}. X1X_{1}’s children (WW) are in OX\mathscr{O}^{X}, we check conditioning using X2X_{2} instead of X1X_{1} (i.e. we check if X1X_{1} can satisfy (2) of Definition 2.3, and not be an ancestor of YY in G1′\mathcal{G}^{\prime}_{1}). This time, we have X1<spanclass="katex−display"><spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"display="block"><semantics><mrow><mo>↔</mo></mrow><annotationencoding="application/x−tex">↔</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.3669em;"></span><spanclass="mrel">↔</span></span></span></span></span>ZX_{1}<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo>↔</mo></mrow><annotation encoding="application/x-tex">\leftrightarrow</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.3669em;"></span><span class="mrel">↔</span></span></span></span></span>Z as the c-component subgraph, and ZZ comes before X2X_{2}, satisfying the check (X1⊥ ⁣ ⁣ ⁣⊥Z∣ZX_{1}\perp\!\!\!\perp Z|Z) in HasValidAdjustment, resulting in OX={X2:X2,W:X2,X1:X2}\mathscr{O}^{X}=\{X_{2}:X_{2},W:X_{2},X_{1}:X_{2}\}, and OX={X2,W,X1}\bm{O}^{X}=\{X_{2},W,X_{1}\}. Indeed, the Markov Boundary of OX\bm{O}^{X} in GX2‾\mathcal{G}_{\underline{X_{2}}} is {Z}\{Z\}, and we can construct a valid sequential π\pi-backdoor by using Z1={}\bm{Z}_{1}=\{\} and Z2={Z}\bm{Z}_{2}=\{Z\}, where X1X_{1} is no longer an ancestor of YY in G1′\mathcal{G}^{\prime}_{1}! In this case, we call X2X_{2} a “boundary action", because it is an ancestor of YY in G2′\mathcal{G}^{\prime}_{2}. On the other hand, X1X_{1} is not a boundary action, because it is not an ancestor of YY in G1′\mathcal{G}^{\prime}_{1}.

The set XB⊆X\bm{X}^{B}\subseteq\bm{X} called the “boundary actions" for OX:=\textscFindOx(G,X,Y)\bm{O}^{X}:=\textsc{FindOx}(\mathcal{G},\bm{X},Y) are all elements Xi∈X∩OXX_{i}\in\bm{X}\cap\bm{O}^{X} where ch+(Xi)⊈OX\mathit{ch}^{+}(X_{i})\not\subseteq\bm{O}^{X}.

Algorithm 1 is general: the set OX\bm{O}^{X} returned by FindOx can always be used in conjunction with its Markov Boundary to construct a sequential π\pi-backdoor if one exists:

Let OX:=\textscFindOx(G,X,Y)\bm{O}^{X}:=\textsc{FindOx}(\mathcal{G},\bm{X},Y), and X′:=OX∩X\bm{X}^{\prime}:=\bm{O}^{X}\cap\bm{X}. Taking Z\bm{Z} as the Markov Boundary of OX\bm{O}^{X} in GX′‾Y\mathcal{G}^{Y}_{\underline{X^{\prime}}} and XB\bm{X}^{B} as the boundary actions of OX\bm{O}^{X}, the sets Zi=(Z∪XB)∩\before(Xi′)\bm{Z}_{i}=(\bm{Z}\cup\bm{X}^{B})\cap\before(X^{\prime}_{i}) for each Xi′∈X′X^{\prime}_{i}\in\bm{X}^{\prime} are a valid sequential π\pi-backdoor for (G,X′,Y)(\mathcal{G},\bm{X}^{\prime},Y).

Let OX:=\textscFindOx(G,X,Y)\bm{O}^{X}:=\textsc{FindOx}(\mathcal{G},\bm{X},Y). Suppose that there exists a sequential π\pi-backdoor for X"⊆X\bm{X}"\subseteq\bm{X}. Then X"⊆OX\bm{X}"\subseteq\bm{O}^{X}.

Combined together, Lemmas 3.3 and 3.2 show that FindOx finds the maximal subset of X\bm{X} where a sequential π\pi-backdoor exists, and the adjustment sets Z1:n\bm{Z}_{1:n} can be constructed using the subset of a Markov Boundary over OX\bm{O}^{X} that comes before each corresponding action XiX_{i} (Lemma 3.2). FindOx is therefore both necessary and sufficient for generating a sequential π\pi-backdoor:

Let OX\bm{O}^{X} be the output of \textscFindOx(G,X,Y)\textsc{FindOx}(\mathcal{G},\bm{X},Y). A sequential π\pi-backdoor exists for (G,X,Y)(\mathcal{G},\bm{X},Y) if and only if X⊆OX\bm{X}\subseteq\bm{O}^{X}.

Necessity of Sequential π\pi-Backdoor for Imitation

In this section, we show that the sequential π\pi-backdoor is necessary for imitability, meaning that the sequential π\pi-backdoor is complete.

A given imitation problem can have multiple possible conditioning sets satisfying the sequential π\pi-backdoor, and a violation of the criterion for one set does not preclude the existence of another that satisfies the criterion. To avoid this issue, we will use the output of Algorithm FindOx, which returns a unique set OX\bm{O}^{X} for each problem:

Let OX:=\textscFindOx(G,X,Y)\bm{O}^{X}:=\textsc{FindOx}(\mathcal{G},\bm{X},Y). Suppose ∃Xi∈X\exists X_{i}\in\bm{X} s.t. Xi∈X∖OXX_{i}\in\bm{X}\setminus\bm{O}^{X}. Then X\bm{X} is not imitable with respect to YY in G\mathcal{G}.

Our next proposition establishes the necessity of the sequential π\pi-backdoor criterion for the imitability of the expert’s performance (Definition 2.1), which follows immediately from Lemmas 4.1 and 3.1.

If there do not exist adjustment sets satisfying the sequential π\pi-backdoor criterion for (G,X,Y)(\mathcal{G},\bm{X},Y), then X\bm{X} is not imitable with respect to YY in G\mathcal{G}.

The proof of Lemma 4.1 relies on the construction of an adversarial SCM for which YY can detect the imitator’s lack of access to the latent variables. For example, in Figure 2(a), ZZ can carry information about the latent variable UU to YY, and is only determined after the decision for the value of XX is made. Setting U∼Bern(0.5),X:=U,Z:=U,Y:=X⊕ZU\sim Bern(0.5),X:=U,Z:=U,Y:=X\oplus Z leaves the imitator with a performance of IE[Y^]=0.5{\rm I\kern-3.00003ptE}[\hat{Y}]=0.5, while the expert can get perfect performance (IE[Y]=1{\rm I\kern-3.00003ptE}[Y]=1).

Another example with similar mechanics can be seen in Figure 2(c). If the variables are determined in the order (X1,W,X2,Z,Y)(X_{1},W,X_{2},Z,Y), then the sequence of actions is not imitable, since ZZ can transfer information about the latent variable UU to YY, while X2X_{2} has no way of gaining information about UU, because the action at XX needed to be taken without context.

Finally, observe Figure 2(d). If ZZ is determined after X1X_{1}, the imitator must guess a value for X1X_{1} without this side information, which is then combined with U2U_{2} at WW. An adversary can exploit this to construct a distribution where guessing wrong can be detected at YY as follows: U1∼Bern(0.5)U_{1}\sim Bern(0.5), Z,X:=U1Z,X:=U_{1}, U2∼(Bern(0.5),Bern(0.5))U_{2}\sim(Bern(0.5),Bern(0.5)) (that is, U2U_{2} is a tuple of two binary variables, or a single variable with a uniform domain of 0,1,2,30,1,2,3). Then setting W=U2[Z]W=U_{2}[Z] ([][] represents array access, meaning first element of tuple if Z=0Z=0 and second if Z=1Z=1), and X2:=WX_{2}:=W, Y:=(U2[X1]==X2)Y:=(U_{2}[X_{1}]==X_{2}) gives IE[Y]=1{\rm I\kern-3.00003ptE}[Y]=1 only if π1\pi_{1} guesses the value of U1U_{1}, meaning that the imitator can never achieve the expert’s performance. This construction also demonstrates non-imitability when X1X_{1} and ZZ are switched (i.e., Figure 2(c) with W↔YW\leftrightarrow Y added, and X1X_{1} coming before ZZ in temporal order).

Due to these results, after running Algorithm 1 on the domain’s causal structure, the imitator gets two pieces of information:

Is the problem imitable? In other words, is it possible to use only observable context variables, and still get provably optimal imitation, despite the expert and imitator having different information?

If so, what context should be included in each action? Including/removing certain observed covariates in an estimation procedure can lead to different conclusions/actions, only one of which is correct (known as “Simpson’s Paradox” in the statistics literature ). Furthermore, as demonstrated in Figure 2(c), when performing actions sequentially, some actions might not be imitable themselves (X1X_{1} if ZZ after X1X_{1}), which leads to bias in observed descendants (WW) - the correct context takes this into account, using only covariates known not to be affected by incorrectly guessed actions.

Finally, the obtained context Zi\bm{Z}_{i} for every action XiX_{i} could be be used as input to existing algorithms for behavioral cloning, giving an imitating policy with an unbiased result.

Simulations

We performed 2 experiments (for full details, refer to [9, Appendix B]), comparing the performance of 4 separate approaches to determining which variables to include in an imitating policy:

All Observed (AO) - Take into account all variables available to the imitator at the time of each action. This is the approach most commonly used in the literature.

Observed Parents (OP) - The expert used a set of variables to take an action - use the subset of these that are available to the imitator.

π\pi-Backdoor - In certain cases, each individual action can be imitated independently, so the individual single-action covariate sets are used.

Sequential π\pi-Backdoor (ours) - The method developed in this paper, which takes into account multiple actions in sequence.

The first simulation consists of running behavioral cloning on randomly sampled distributions consistent with a series of causal graphs designed to showcase aspects of our method. For each causal graph, 10,000 random discrete causal models were sampled, representing the environment as well as expert performance, and then the expert’s policy X\bm{X} was replaced with imitating policies approximating π(Xi)=P(Xi∣ctx(Xi))\pi(X_{i})=P(X_{i}|ctx(X_{i})), with context ctxctx determined by each of the 4 tested methods in turn. Our results are shown in Table 1, with causal graphs shown in the first column, temporal ordering of variables in the second column, and absolute distance between expert and imitator for the 4 methods in the remaining columns.

In the first row, including ZZ when developing a policy for X\bm{X} leads to a biased answer, which makes the average error of using all observed covariates (red) larger than just the sampling fluctuations present in the other columns. Similarly, ZZ needs to be taken into account in row 2, but it is not explicitly used by X\bm{X}, so a method relying only on observed parents leads to bias here. In the next row, ZZ is not observed at the time of action X1X_{1}, making the π\pi-backdoor incorrectly claim non-imitability. Our method recognizes that X2X_{2}’s policy can fix the error made at X1X_{1}, and is the only method that leads to an unbiased result. Finally, in the 4th row, the non-causal approaches have no way to determine non-imitability, and return biased results in all such cases.

The second simulation used a synthetic, adversarial causal model, enriched with continuous data from the HighD dataset altered to conform to the causal model, to demonstrate that different covariate sets can lead to significantly different imitation performance. A neural network was trained for each action-policy pair using standard supervised learning approaches, leading to the results shown in Figure 4. The causal structure was not imitable from the single-action setting, so the remaining 3 methods were compared to the optimal reward, showing that our method approaches the performance of the expert, whereas non-causal methods lead to biased results. Full details of model construction, including the full causal graph are given in [9, Appendix B]

Limitations & Societal Impact

There are two main limitations to our approach: (1) Our method focuses on the causal diagram, requiring the imitator to provide the causal structure of its environment. This is a fundamental requirement: any agent wishing to operate in environments with latent variables must somehow encode the additional knowledge required to make such inferences from observations. (2) Our criterion only takes into consideration the causal structure, and not the associated data P(o)P(\bm{o}). Data-dependent methods can be computationally intensive, often requiring density estimation. If our approach returns “imitable", then the resulting policies are guaranteed to give perfect imitation, without needing to process large datasets to determine imitability.

Finally, advances in technology towards improving imitation can easily be transferred to methods used for impersonation - our method provides conditions under which an imposter (imitator) can fool a target (YY) into believing they are interacting with a known party (expert). Our method shows when it is provably impossible to detect an impersonation attack. On the other hand, our results can be used to ensure that the causal structure of a domain cannot be imitated, helping mitigate such issues.

Conclusion

Great care needs to be taken in choosing which covariates to include when determining a policy for imitating an expert demonstrator when expert and imitator have different views of the world. The wrong set of variables can lead to biased, or even outright incorrect predictions. Our work provides general and complete results for the graphical conditions under which behavioral cloning is possible, and provides an agent with the tools needed to determine the variables relevant to its policy.

Funding Transparency

The team is supported in part by funding from the NSF, Amazon, JP Morgan, and The Alfred P. Sloan Foundation, as well as grants from NSF IIS-1704352 and IIS-1750807 (CAREER).

References