SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.05530 · ICML · 2021

Adversarial Option-Aware Hierarchical Imitation Learning

Chuang Gan, Tao Kong, Lei Li, Fuchun Sun, Wenbing Huang, Mingxuan Jing, Xiaojian Ma

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2106.05530.json · badge: /api/ran/2106.05530.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
id9502/Option-GAIL marked official in Papers with Code
Papers with Code archive
7 ran · 1 no recorded run
FunctionStatusWhere it lives
Config Ran
ran on a synthesized input · constructed an object; no result was computed
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("9972b67b3e225cd8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Config: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import ast
import tempfile

torch_imported = False
try:
    import torch
    torch_imported = True
    torch.manual_seed(0)
except ImportError:
    pass

class Config(dict):

    def __init__(self, seq=None, **kwargs):
        if seq is None:
            seq = {}
        super(Config, self).__init__(seq, **kwargs)

    def __setattr__(self, key, value):
        self[key] = value

    def __getattr__(self, item):
        return self[item]

    def __str__(self):
        disc = []
        for k in self:
            if k.startswith('_'):
                continue
            disc.append(f'{k}: {repr(self[k])},\n')
        return ''.join(disc)

    def copy(self):
        return Config(self)

    def load_saved(self, path):
        if not os.path.isfile(path):
            raise FileNotFoundError(f'Error: file {path} not exists')
        lines = open(path, 'r').readlines()
        dic = {}
        for l in lines:
            key, value = l.strip().split(':', 1)
            if value == '':
                break
            key = key.strip()
            value = value.strip().rstrip(',')
            dic[key] = ast.literal_eval(value)
        self.update(dic)
        return self

# Create test arguments for Config.__init__
# Parameters: seq (optional dict/sequence), **kwargs

# Test case 1: Empty initialization
test_seq_1 = None
test_kwargs_1 = {}

# Test case 2: With sequence (dict)
test_seq_2 = {'model_name': 'bert', 'hidden_size': 768}
test_kwargs_2 = {}

# Test case 3: With kwargs
test_seq_3 = None
test_kwargs_3 = {'learning_rate': 0.001, 'batch_size': 32}

# Test case 4: With both seq and kwargs
test_seq_4 = {'model': 'gpt2'}
test_kwargs_4 = {'epochs': 10, 'seed': 42}

# Use a comprehensive example for ARGS
ARGS = {
    'seq': {'learning_rate': 0.001, 'batch_size': 32, 'model_type': 'transformer'},
    'kwargs': {'hidden_dim': 128, 'num_layers': 3, 'dropout': 0.1}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Config — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
OptionDiscriminator Ran
ran on a synthesized input · constructed an object; no result was computed
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("cb69610d67b430f0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, OptionDiscriminator: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math
from torch import nn

torch.manual_seed(0)

class Config(dict):
    def __init__(self, seq=None, **kwargs):
        if seq is None:
            seq = {}
        super(Config, self).__init__(seq, **kwargs)

    def __setattr__(self, key, value):
        self[key] = value

    def __getattr__(self, item):
        return self[item]

config = Config({
    'dim_c': 3,
    'use_c_in_discriminator': True,
    'shared_discriminator': False,
    'device': 'cpu',
    'hidden_discriminator': [64, 32],
    'activation': 'relu'
})

dim_s = 4
dim_a = 5

ARGS = {
    'config': config,
    'dim_s': dim_s,
    'dim_a': dim_a
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OptionDiscriminator — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a OptionDiscriminator output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
OptionPolicy Ran
ran on a synthesized input · constructed an object; no result was computed
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("03ee444c467aa8b2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, OptionPolicy: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch import nn as nn_module
import math

torch.manual_seed(0)

class Config(dict):
    def __init__(self, seq=None, **kwargs):
        if seq is None:
            seq = {}
        super(Config, self).__init__(seq, **kwargs)

    def __setattr__(self, key, value):
        self[key] = value

    def __getattr__(self, item):
        return self[item]

    def __str__(self):
        disc = []
        for k in self:
            if k.startswith('_'):
                continue
            disc.append(f'{k}: {repr(self[k])},\n')
        return ''.join(disc)

    def copy(self):
        return Config(self)

def init_layer(module, gain=math.sqrt(2)):
    with torch.no_grad():
        nn.init.orthogonal_(module.weight.data, gain=gain)
        nn.init.constant_(module.bias.data, 0)
    return module

def make_activation(act_name):
    return torch.nn.ReLU if act_name == 'relu' else torch.nn.Tanh if act_name == 'tanh' else torch.nn.Sigmoid if act_name == 'sigmoid' else torch.nn.Softplus if act_name == 'softplus' else None

def make_module(in_size, out_size, hidden, activation=nn.ReLU):
    n_in = in_size
    l_hidden = []
    for h in hidden:
        l_hidden.append(init_layer(torch.nn.Linear(n_in, h)))
        l_hidden.append(activation())
        n_in = h
    l_hidden.append(init_layer(torch.nn.Linear(n_in, out_size), gain=0.1))
    return torch.nn.Sequential(*l_hidden)

def make_module_list(in_size, out_size, hidden, n_net, activation=nn.ReLU):
    return nn.ModuleList([make_module(in_size, out_size, hidden, activation) for _ in range(n_net)])

config = Config()
config.dim_c = 3
config.device = 'cpu'
config.log_clamp_policy = (-20.0, 2.0)
config.shared_policy = True
config.activation = 'relu'
config.hidden_policy = [64, 64]
config.hidden_option = [64, 64]

ARGS = {
    'config': config,
    'dim_s': 4,
    'dim_a': 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OptionPolicy — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a OptionPolicy output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
init_layer Ran
ran; our contract draft was wrong, not the code
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("57fbf4ad5560672d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Linear. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math
from torch import nn

torch.manual_seed(0)

# Create a simple linear module with weight and bias
module = nn.Linear(in_features=4, out_features=3)

ARGS = {
    "module": module,
    "gain": math.sqrt(2)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
make_activation Ran
ran; our contract draft was wrong, not the code
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("ce2ec8da5152b34e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned type. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function make_activation takes one parameter: act_name
# It returns different activation function classes based on the string input
# Valid inputs are: 'relu', 'tanh', 'sigmoid', 'softplus', or anything else (returns None)

ARGS = {
    'act_name': 'relu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
make_module Ran
ran; our contract draft was wrong, not the code
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("04e7d7340bbcb048")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Sequential. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math
from torch import nn

torch.manual_seed(0)

ARGS = {
    "in_size": 4,
    "out_size": 3,
    "hidden": [8, 6],
    "activation": nn.ReLU,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
make_module_list Ran
ran; our contract draft was wrong, not the code
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("836c1844c1eed5ab")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ModuleList. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math
from torch import nn

torch.manual_seed(0)

ARGS = {
    "in_size": 4,
    "out_size": 3,
    "hidden": [8, 6],
    "n_net": 2,
    "activation": nn.ReLU
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ModuleList — a ModuleList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModuleList output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
OptionGAIL Not yet run
unverified (harvested, no recorded run)
id9502/Option-GAIL/model/option_gail.py
code served (permissive licence) · get_code("5a8ebbdfe4f7b701")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

It has been a challenge to learning skills for an agent from long-horizon unannotated demonstrations. Existing approaches like Hierarchical Imitation Learning(HIL) are prone to compounding errors or suboptimal solutions. In this paper, we propose Option-GAIL, a novel method to learn skills at long horizon. The key idea of Option-GAIL is modeling the task hierarchy by options and train the policy via generative adversarial optimization. In particular, we propose an Expectation-Maximization(EM)-style algorithm: an E-step that samples the options of expert conditioned on the current learned policy, and an M-step that updates the low-and high-level policies of agent simultaneously to minimize the newly proposed option-occupancy measurement between the expert and the agent. We theoretically prove the convergence of the proposed algorithm. Experiments show that Option-GAIL outperforms other counterparts consistently across a variety of tasks.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2106.05530")
get_code_for_paper("2106.05530")
have("2106.05530")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2106.05530.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2106.05530.svg)](https://syntology.ai/paper/2106.05530)

Connect an agent — have() is free.