# Autoresearch

## Autoresearch: Autonomous ML on Ocean

This tutorial ports [Karpathy's autoresearch](https://github.com/karpathy/autoresearch) experiment to run entirely on Ocean Network. An open-source LLM (Qwen3-14B, served via vLLM) acts as the research agent: it reads the experiment history, generates a new training hypothesis, runs a short training job, and keeps the result only if it improves validation performance. The loop repeats for up to 200 iterations, autonomously, on a single H200 GPU, with no external API calls.

This is one of the most compute-intensive workloads in the tutorials repository and a direct demonstration of what Ocean Network's high-performance GPU tier can do.

***

### What Runs on the Network

* **Agent LLM**: Qwen3-14B (unquantized bf16, \~28GB VRAM) served via vLLM, resident in the container for the full job duration
* **Training loop**: GPT pretraining script executed on the same H200, sharing VRAM with the agent
* **Data pipeline**: HuggingFace data shards downloaded and a BPE tokenizer trained at container startup — nothing needs to persist between runs
* **Output**: `results.json` with the full experiment history and the winning `train.py`

Everything runs inside a single Docker container. Ocean delivers the container to the node, executes it, and returns the outputs to you.

***

### Results Across Five Runs

| Run | Model         | Setup                 | Iterations | Best val\_bpb | Improvement |
| --- | ------------- | --------------------- | ---------- | ------------- | ----------- |
| 1   | Qwen3-32B-AWQ | 1×H200, 0.7 temp      | 201        | 0.9818        | 2.6%        |
| 2   | Qwen3-32B-AWQ | 1×H200, 0.5 temp, 6h  | 94         | 1.0072        | 1.5%        |
| 3   | Qwen3-32B-AWQ | 1×H200, 0.5 temp, 12h | 201        | 1.0074        | 1.4%        |
| 4   | Qwen3.5-27B   | 2×H200, 0.5 temp      | 77         | 0.9993        | 2.5%        |
| 5   | Qwen3-14B     | 1×H200, 0.7 temp      | 165        | 0.9967        | 2.9%        |

The smallest model (Qwen3-14B) achieved the best result — faster iterations outweigh raw model size when throughput matters.

***

### Hardware Requirements

| Resource | Minimum                         |
| -------- | ------------------------------- |
| GPU      | 1× NVIDIA H200 (80GB VRAM)      |
| RAM      | 64GB system memory              |
| Runtime  | 6–12 hours for a meaningful run |

For the 2×H200 variant (`algo_qwen3.5-27B.py`), select a two-GPU environment from the node catalog.

***

### Run It on Ocean Network

1. **Clone the repo**

   ```bash
   git clone https://github.com/oceanprotocol/oncompute-tutorials
   ```
2. **Open the `autoresearch/` folder** in Ocean Orchestrator.
3. **Browse nodes** at [dashboard.oncompute.ai](https://dashboard.oncompute.ai/) and select a node with a single H200 GPU environment.
4. **Start a paid compute job** — the container builds automatically, runs `algo.py`, and streams logs back in real time.
5. **Download results** — when the job completes, `results.json` is saved to your `results/` folder. Extract the winning code with:

   ```python
   import json
   results = json.load(open("results.json"))
   print(results["best"]["train_py"])
   ```

**Tutorial source:** [github.com/oceanprotocol/oncompute-tutorials/tree/main/autoresearch](https://github.com/oceanprotocol/oncompute-tutorials/tree/main/autoresearch)


---

# 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://docs.oncompute.ai/use-cases/publish-your-docs.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.
