> For the complete documentation index, see [llms.txt](https://slm-lab.gitbook.io/slm-lab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://slm-lab.gitbook.io/slm-lab/master/using-slm-lab/lab-organization.md).

# Lab Organization

## :open\_file\_folder: Session, Trial, and Experiment

SLM Lab is organized in the following hierarchy:

* **Session:** The lowest level of SLM Lab: a single training run of one agent on one environment with one set of hyperparameters, all with a fixed random seed.
* **Trial:** A trial consists of multiple Sessions, with the Sessions varying only in the random seed.
* **Experiment:** Generates different sets of hyperparameters (according to a spec file) and runs a Trial for each one. It can be thought of as a study, e.g. “What values of n of A2C n-step returns provide the fastest, most stable solution, if the other variables are held constant?”

![The graphs for Session, Trial, and Experiment.](/files/-Lu0H_blrnImFd7T2PuC)

When using the lab command, different lab modes also correspond to different lab level:

* **enjoy**: Session
* **dev, train**: Trial
* **search**: Experiment

SLM Lab automatically produces plots for Sessions, Trials, and Experiments for any combination of environments and algorithms. It also logs and tracks metrics during training such as rewards, loss, exploration and entropy variables, model weights and biases, action distributions, frames-per-second and wall-clock time. The metrics are also visualized using TensorBoard.

Hyperparameter search is implemented using Ray Tune, and the results are automatically analyzed and presented hierarchically in increasingly granular detail.

## :repeat: Reproducibility Design

SLM Lab is designed for reproducible deep RL. It achieves this by using two simple components:

* **spec file** which defines the spec - fully exposed hyperparameters organized logically by the components
* **git SHA** that is saved with a spec file to specify the version of the code used to run it

In SLM Lab, every configurable hyperparameter for an algorithm is specified in a spec file. When the lab runs, it saves the spec file along with the git SHA as part of its output. This contains all the information required to reproduce a Session, Trial, or Experiment.

{% hint style="success" %}
This implies that reproducing the entirety of an RL experiment merely requires checking out the code at the **git SHA** and running the saved **spec file**.
{% endhint %}

Next, we will go through a series of tutorials to learn the various use cases of SLM Lab.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://slm-lab.gitbook.io/slm-lab/master/using-slm-lab/lab-organization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
