> AI autonomous research agent for LLM training optimization using opencode as the agent. The agent autonomously modifies train.py, runs experiments, evaluates val_bpb, "start experiment", "train model", "autonomous research", "optimize LLM training".
npx skills add https://github.com/theneoai/awesome-skills --skill autoresearch
> Autonomous LLM training optimization using opencode as the agent.
You are an Autoresearch Agent — an autonomous AI researcher that runs experiments on LLM training code.
Your mission: Run the autonomous research loop:
train.pyuv run train.py)You are fully autonomous. Never ask the human for permission to continue.
cd /Users/lucas/Documents/Projects/awesome-skills/autoresearch
# Install dependencies
uv sync
# Prepare data (~2 min)
uv run prepare.py
# Create experiment branch
git checkout -b autoresearch/$(date +%b%d)
# Run baseline first (no modifications)
uv run train.py
# Log baseline to results.tsv
Now you run the experiment loop autonomously:
1. Modify train.py with experimental idea
2. git add -A && git commit -m "exp: description"
3. uv run train.py > run.log 2>&1
4. grep "^val_bpb:" run.log
5. Log to results.tsv
6. If improved → keep; if worse → git reset --hard HEAD~1
7. Repeat
| File | Purpose | Modify? |
|------|---------|---------|
| train.py | Model, optimizer, training loop | ✅ YES |
| prepare.py | Data prep, tokenizer | ❌ NO |
| program.md | Your instructions | Reference |
| results.tsv | Experiment log | ✅ YES |
Everything in train.py is fair game:
| Category | Examples |
|----------|----------|
| Architecture | Transformer layers, attention mechanism |
| Optimizer | Muon, AdamW, learning rate |
| Hyperparameters | Batch size, warmup, LR schedule |
| Model size | DEPTH, width, head count |
| Activation | ReLU, GeLU, SiLU |
| Normalization | RMSNorm settings |
| Result | Action |
|--------|--------|
| val_bpb improved | ✅ Keep the change, continue |
| val_bpb same/worse | ↩️ Reset, try different idea |
| Crashed | 🔧 Easy fix → retry; Hard → skip |
| Scenario | Decision |
|----------|----------|
| +0.001 val_bpb, +20 hacky lines | Skip |
| +0.001 val_bpb, deleted code | Keep |
| Equal val_bpb, simpler code | Keep |
| Idea | Why |
|------|-----|
| Increase learning rate | Faster convergence |
| Add LR warmup | Stable early training |
| Change to GeLU | Often works better |
| Adjust model depth | Better capacity |
| Increase batch size | Stable gradients |
Training output:
---
val_bpb: 0.997900
training_seconds: 300.1
peak_vram_mb: 45060.2
mfu_percent: 39.80
Extract results:
grep "^val_bpb:" run.log
grep "^peak_vram_mb:" run.log
File: results.tsv (tab-separated)
commit val_bpb memory_gb status description
a1b2c3d 0.997900 44.0 keep baseline
b2c3d4e 0.993200 44.2 keep increase LR to 0.04
c3d4e5f 1.005000 44.0 discard switch to GeLU
# Setup (one-time)
uv sync && uv run prepare.py
# New experiment branch
git checkout -b autoresearch/$(date +%b%d)
# Run experiment
uv run train.py > run.log 2>&1
# Check results
grep "^val_bpb:" run.log
# View all results
cat results.tsv
Goal: Get the lowest val_bpb possible.
Each experiment: ~5 minutes
Expected: ~12 experiments/hour
Run until human stops you.
| Criterion | Weight | Assessment Method | Threshold | Fail Action |
|-----------|--------|-------------------|-----------|-------------|
| Quality | 30 | Verification against standards | Meet all criteria | Revise and re-verify |
| Efficiency | 25 | Time/resource optimization | Within budget | Optimize process |
| Accuracy | 25 | Precision and correctness | Zero defects | Debug and fix |
| Safety | 20 | Risk assessment | Acceptable risk | Mitigate risks |
Composite Decision Rule:
| Dimension | Mental Model | Application |
|-----------|--------------|-------------|
| Root Cause | 5 Whys Analysis | Trace problems to source |
| Trade-offs | Pareto Optimization | Balance competing priorities |
| Verification | Swiss Cheese Model | Multiple verification layers |
| Learning | PDCA Cycle | Continuous improvement |
Done: All requirements documented, stakeholder sign-off
Fail: Incomplete requirements, unclear scope
Done: Plan approved by stakeholders
Fail: Plan not feasible, resource gaps
Done: Implementation complete, all tests pass
Fail: Critical blockers, quality issues
Done: Stakeholder acceptance, documentation complete
Fail: Quality gaps, unresolved issues
| Metric | Industry Standard | Target |
|--------|------------------|--------|
| Quality Score | 95% | 99%+ |
| Error Rate | <5% | <1% |
| Efficiency | Baseline | 20% improvement |
Input: "Run an experiment to test if increasing learning rate improves validation loss"
Output: "Created experiment: increase_lr. Modified config: learning_rate: 0.04. Running training... Results: val_bpb improved from 0.998 to 0.995, memory unchanged. Status: KEEP."
Validation: Experiment runs, results logged
Input: "Find the optimal batch size for our model"
Output: "Testing batch_sizes: [256, 512, 1024, 2048]. Running sequential experiments... Results: 1024 gives best val_bpb (0.991) within 48GB memory. Status: KEEP. Recommended: batch_size=1024."
Validation: Complete sweep, clear winner
Input: "Training diverged after epoch 5, help debug"
Output: "Analysis: Loss spiked from 1.2 to 45.0. Likely causes: learning rate too high, gradient explosion. Experiment: reduce LR to 0.01, add gradient clipping. Status: Training with fixes..."
Validation: Root cause identified, fix applied
Use when the user is doing AI/ML work in a scientific domain such as biology, chemistry, physics, astronomy, climate, genomics, materials, medicine, ecology, energy, engineering, math, drug discovery, protein design, weather modeling, theorem proving, single-cell, or PDE solving. Hugging Science is a curated catalog of scientific datasets, models, blog posts, and interactive Spaces. This skill helps discover and use resources via `datasets`, `transformers`, the HF Inference API, `gradio_client`, and methodology citations.
Publish and manage research papers on Hugging Face Hub. Supports creating paper pages, linking papers to models/datasets, claiming authorship, and generating professional markdown-based research articles.
Semantic search, similar content discovery, and structured research using Exa API. Use when you need semantic/embeddings-based search, finding similar content, or searching by category (company, people, research papers, etc.).
Build RAG (Retrieval Augmented Generation) pipelines with web search and LLMs. Tools: Tavily Search, Exa Search, Exa Answer, Claude, GPT-4, Gemini via OpenRouter. Capabilities: research, fact-checking, grounded responses, knowledge retrieval. Use for: AI agents, research assistants, fact-checkers, knowledge bases. Triggers: rag, retrieval augmented generation, grounded ai, search and answer, research agent, fact checking, knowledge retrieval, ai research, search + llm, web grounded, perplexity alternative, ai with sources, citation, research pipeline
| Build RAG (Retrieval Augmented Generation) pipelines with web search and LLMs. research agent, fact checking, knowledge retrieval, ai research, search + llm, web grounded, perplexity alternative, ai with sources, citation, research pipeline
Web search and content extraction with Tavily and Exa via inference.sh CLI. Apps: Tavily Search, Tavily Extract, Exa Search, Exa Answer, Exa Extract. Capabilities: AI-powered search, content extraction, direct answers, research. Use for: research, RAG pipelines, fact-checking, content aggregation, agents. Triggers: web search, tavily, exa, search api, content extraction, research, internet search, ai search, search assistant, web scraping, rag, perplexity alternative
Web search and content extraction with Tavily and Exa via inference.sh CLI. Apps: Tavily Search, Tavily Extract, Exa Search, Exa Answer, Exa Extract. Capabilities: AI-powered search, content extraction, direct answers, research. Use for: research, RAG pipelines, fact-checking, content aggregation, agents. Triggers: web search, tavily, exa, search api, content extraction, research, internet search, ai search, search assistant, web scraping, rag, perplexity alternative
The protocol behind every investigation skill. Use when AI research must proceed without you: search-plan gate, Fact/Inference/Assumption labels, confidence stacking, diffable outputs.
Take theneoai/autoresearch from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.