# Run Benchmark: A2C on Atari Games

## :writing\_hand: Spec Params for A2C on Atari Games

Benchmark results for an algorithm requires running it for a number of environments. This can easily be done in SLM Lab by parametrizing the spec file, which is similar to how it was done in [Experiment and Search Spec: PPO on Breakout](/slm-lab/master/using-slm-lab/search-spec-ppo-on-breakout.md). Running benchmark in SLM Lab is easy by using **spec\_params** in the spec file, which uses [the same underlying function as experiment search](https://github.com/kengz/SLM-Lab/blob/master/run_lab.py#L59).

Let's run a benchmark for A2C on 4 Atari environments. We can look at an example spec from [slm\_lab/spec/benchmark/a2c/a2c\_gae\_atari.json](https://github.com/kengz/SLM-Lab/blob/master/slm_lab/spec/benchmark/a2c/a2c_gae_atari.json)

{% code title="slm\_lab/spec/benchmark/a2c/a2c\_gae\_atari.json" %}

```javascript
{
  "a2c_gae_atari": {
    "agent": [{
      "name": "A2C",
      "algorithm": {
        "name": "ActorCritic",
        ...
      },
      ...
      }
    }],
    "env": [{
      "name": "${env}",
      "frame_op": "concat",
      "frame_op_len": 4,
      "reward_scale": "sign",
      "num_envs": 16,
      "max_t": null,
      "max_frame": 1e7
    }],
    ...
    "spec_params": {
      "env": [
        "BreakoutNoFrameskip-v4", "PongNoFrameskip-v4", "QbertNoFrameskip-v4", "SeaquestNoFrameskip-v4"
      ]
    }
  }
}
```

{% endcode %}

{% hint style="info" %}
Spec param uses template string replacement to modify the spec and append to the spec name. Replace the value of the environment name with `"${env}"`.
{% endhint %}

## :rocket: Running A2C Atari Benchmark

This benchmark will run 4 trials in total. The command to run it is familiar:

```bash
python run_lab.py slm_lab/spec/benchmark/a2c/a2c_gae_atari.json a2c_gae_atari train
```

The spec name will be replaced with each value of the spec param, so the resulting trials will be named "a2c\_gae\_atari\_BreakoutNoFrameskip-v4", "a2c\_gae\_atari\_PongNoFrameskip-v4", "a2c\_gae\_atari\_QbertNoFrameskip-v4", and "a2c\_gae\_atari\_SeaquestNoFrameskip-v4".

{% hint style="info" %}
All the SLM Lab benchmark results are run from files in [slm\_lab/spec/benchmark/](https://github.com/kengz/SLM-Lab/tree/master/slm_lab/spec/benchmark).
{% endhint %}

Refer to the following pages for benchmark results in SLM Lab.

{% content-ref url="/pages/-Lti3U-T96\_jSYz332kZ" %}
[Discrete Environment Benchmark](/slm-lab/master/benchmark-results/discrete-benchmark.md)
{% endcontent-ref %}

{% content-ref url="/pages/-Lti3gXXj0E3FSY-F3PY" %}
[Continuous Environment Benchmark](/slm-lab/master/benchmark-results/continuous-benchmark.md)
{% endcontent-ref %}

{% content-ref url="/pages/-Lti3lLfTXQJ-9FacY6u" %}
[Atari Environment Benchmark](/slm-lab/master/benchmark-results/atari-benchmark.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://slm-lab.gitbook.io/slm-lab/master/using-slm-lab/run-benchmark-a2c-on-atari-games.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
