# nanoresearch-experiment

Adopt this skill: https://proskills.md/skills/other/openraiser-nanoresearch-skills-nanoresearch-experiment

Page: https://proskills.md/skills/other/openraiser-nanoresearch-skills-nanoresearch-experiment
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/nanoresearch-experiment/SKILL.md
size: 1690
upstream: https://github.com/openraiser/nanoresearch/blob/main/skills/nanoresearch-experiment/SKILL.md

```text
---
name: nanoresearch-experiment
description: Generate a Python code skeleton from an experiment blueprint
version: 0.1.0
---

# Experiment Skill

## Purpose
Take the experiment blueprint and produce a runnable Python code skeleton that implements the proposed method, baselines, training loops, evaluation harness, and ablation configurations.

## Tools Required
None. This skill operates entirely through LLM code generation based on the experiment blueprint.

## Input
- `experiment_blueprint`: Path to `papers/experiment_blueprint.json` produced by the planning skill

## Process
1. Parse the experiment blueprint for datasets, baselines, metrics, and ablation groups
2. Generate the project directory structure (data loaders, models, training, evaluation, configs)
3. Produce data loading and preprocessing code for each specified dataset
4. Implement model architecture stubs for the proposed method and each baseline
5. Generate training loop with logging, checkpointing, and early stopping
6. Implement the evaluation harness computing all specified metrics
7. Create configuration files for each ablation group
8. Add a main entry point that accepts a config and runs the full train-evaluate pipeline

## Output
Produces `experiments/` directory containing:
- `data/`: Data loading and preprocessing modules
- `models/`: Model architecture implementations (proposed method and baselines)
- `training/`: Training loop and optimization utilities
- `evaluation/`: Metric computation and result aggregation
- `configs/`: YAML configuration files for each experiment and ablation variant
- `run.py`: Main entry point for launching experiments
- `requirements.txt`: Python dependencies
```

## File: README.md
upstream: https://github.com/openraiser/nanoresearch/blob/main/README.md

````text
<a id="top"></a>

<div align="center">

<div style="margin: 20px 0;">
  <img src="imgs/logo.png" alt="NanoResearch Logo" width="500" style="border-radius: 20px;">
</div>

# NanoResearch

<p>
  <a href="README.md"><img src="https://img.shields.io/badge/🇨🇳_中文-1a1a2e?style=for-the-badge" alt="中文"></a>
  <a href="README_en.md"><img src="https://img.shields.io/badge/🇺🇸_English-1a1a2e?style=for-the-badge" alt="English"></a>
</p>

**端到端自主 AI 科研引擎 — 从研究想法到完整论文，全程自动化**

<p>
  <a href="https://github.com/OpenRaiser/NanoResearch"><img src="https://img.shields.io/badge/🔥_Project-Page-00d9ff?style=for-the-badge&logo=github&logoColor=white&labelColor=1a1a2e" alt="Project"></a>
  <a href="https://github.com/OpenRaiser/NanoResearch/stargazers"><img src="https://img.shields.io/github/stars/OpenRaiser/NanoResearch?color=00d9ff&style=for-the-badge&logo=star&logoColor=white&labelColor=1a1a2e" alt="Stars"></a>
  <a href="https://github.com/OpenRaiser/NanoResearch/issues"><img src="https://img.shields.io/badge/🐛_Issues-ff6b6b?style=for-the-badge&logo=github&logoColor=white&labelColor=1a1a2e" alt="Issues"></a>
</p>

<p>
  <img src="https://img.shields.io/badge/Python-3.10%2B-4ecdc4?style=for-the-badge&logo=python&logoColor=white&labelColor=1a1a2e" alt="Python">
  <img src="https://img.shields.io/badge/License-MIT-16A34A?style=for-the-badge&labelColor=1a1a2e" alt="License">
  <img src="https://img.shields.io/badge/Pipeline-9_Stage_Deep-7C3AED?style=for-the-badge&labelColor=1a1a2e" alt="Pipeline">
  <img src="https://img.shields.io/badge/Execution-Local_|_SLURM-0EA5E9?style=for-the-badge&labelColor=1a1a2e" alt="Execution">
</p>

<p>
  <a href="#快速开始"><b>快速开始</b></a> ·
  <a href="#效果展示"><b>效果展示</b></a> ·
  <a href="#流水线"><b>流水线</b></a> ·
  <a href="#claude-code-模式"><b>Claude Code</b></a> ·
  <a href="#飞书机器人"><b>飞书机器人</b></a>
</p>

</div>

---

> 🔬 NanoResearch **真正运行计算实验**——它不仅生成代码，还能将代码提交到 GPU 集群执行训练，收集真实实验结果，生成论文配图，最终输出一篇有实验数据支撑的完整 LaTeX 论文。论文中的每一个数据、表格、图表都来自实际运行的实验结果，**而非 LLM 编造**。

---

## 📖 目录

- [📊 论文实测展示](#-论文实测展示)
- [⚡ CLI 演示](#cli-demo)
- [📢 最新动态](#-最新动态)
- [✨ 核心特性](#-核心特性)
- [🆚 为何选择 NanoResearch](#-为何选择-nanoresearch)
- [🎯 应用场景](#-应用场景)
- [🖼️ 效果展示](#️-效果展示)
- [CLI：标准输出与 TUI 对比](#cli-tui-vs-plain)
- [🔬 流水线](#-流水线)
- [📦 快速开始](#-快速开始)
- [🧬 Evo 自进化流水线](#-evo-自进化流水线)
- [🧩 Claude Code 模式](#-claude-code-模式)
- [⚙️ 配置](#️-配置)
- [💻 CLI 参考](#-cli-参考)
- [🍪 示例与 Demo](#-示例与-demo)
- [📂 输出结构](#-输出结构)
- [💬 飞书机器人](#-飞书机器人)
- [🏗️ 项目结构](#-项目结构)
- [❓ 常见问题](#-常见问题)
- [🎯 路线图](#-路线图)
- [📋 环境要求](#-环境要求)
- [🙏 致谢](#-致谢)
- [🤝 贡献](#-贡献)
- [📝 引用](#-引用)
- [📄 许可证](#-许可证)

<p align="right"><a href="#top">🔝 返回顶部</a></p>

---

## 📊 论文实测展示

以下为 NanoResearch 自动生成论文中的**真实配图**，所有数据、曲线、表格均来自实际运行的实验结果，**非 LLM 虚构**。

<table>
  <tr>
    <td align="center" valign="top" width="33%">
      <img src="imgs/recognition_1.jpg" height="200" alt="实验结果"/>
      <br />
      <sub><b>实验结果展示</b></sub>
    </td>
    <td align="center" valign="top" width="33%">
      <img src="imgs/recognition_2.jpg" height="200" alt="主结果对比"/>
      <br />
      <sub><b>方法对比 / 主结果</b></sub>
    </td>
    <td align="center" valign="top" width="33%">
      <img src="imgs/recognition_3.jpg" height="200" alt="消融与可视化"/>
      <br />
      <sub><b>消融与可视化</b></sub>
    </td>
  </tr>
</table>

> 以上配图均为流水线自动生成，数据来源于真实训练日志与实验结果。

---

<a id="cli-demo"></a>

## ⚡ CLI 演示

NanoResearch **命令行（CLI）** 提供 **TUI 全屏界面** 与 **传统流式日志** 两种呈现方式。下方为 CLI 端 **TUI 主题与界面** 演示视频（配色切换与布局优化）。其他入口（如 Claude Code、飞书机器人）见文档对应章节。

<table>
  <tr>
    <th><p align="center">🖥️ CLI / TUI</p></th>
  </tr>
  <tr>
    <td align="center">
      <video src="https://github.com/user-attachments/assets/008911c6-b015-47ff-a286-1d8c22f5817e" autoplay loop muted playsinline width="100%" style="max-width: 100%; border-radius: 8px;">
        <a href="https://github.com/user-attachments/assets/008911c6-b015-47ff-a286-1d8c22f5817e">下载 / 播放 CLI 演示视频</a>
      </video>
    </td>
  </tr>
</table>
<sub><i>演示：TUI 界面、配色主题切换与信息布局优化</i></sub>

<p align="right"><a href="#top">🔝 返回顶部</a></p>

---

## Why NanoResearch

| 特性 | 传统 AI 写作工具 | NanoResearch |
|------|-----------------|-------------|
| 文献检索 | 部分支持 | ✅ OpenAlex + Semantic Scholar 自动检索 |
| 实验设计 | ❌ | ✅ 自动生成实验方案 |
| 代码生成 | 部分支持 | ✅ 完整可运行的实验代码 |
| **GPU 实验执行** | ❌ | ✅ **本地 / SLURM 自动训练** |
| 结果分析 | ❌ | ✅ 解析真实训练日志 |
| 论文配图 | ❌ | ✅ 基于真实数据 |
| 论文撰写 | 大纲/草稿 | ✅ 完整 LaTeX 论文 |
| 断点续跑 | ❌ | ✅ 任意阶段可恢复 |
| 多模型协作 | 单一模型 | ✅ 按阶段路由 |

---

## 🎯 应用场景

- **科研原型验证** — 快速将研究想法变成完整的实验 + 论文工作空间
- **自主实验** — 系统自动生成代码、提交 GPU 训练、分析结果
- **Benchmark 批量生成** — 对多个课题批量运行，生成可复现的实验结果
- **论文初稿辅助** — 基于真实实验数据产出 LaTeX 草稿，加速写作
- **科研流程审计** — 完整工作空间、中间产物和日志，可追溯每一步

---

## 🖼️ 效果展示

<div align="center">
  <img src="imgs/before_after.png" alt="告别手动科研" width="90%" />
  <p><b>告别手动科研的痛苦循环</b></p>
  <p>不再反复调试失败的实验、手动整理数据、从零写论文——<br/>NanoResearch 将完整科研流程自动化，让你专注于真正的研究创新。</p>
</div>

<a id="cli-tui-vs-plain"></a>

### CLI：标准输出与 TUI 模式对比

CLI 支持 **传统流式日志（非 TUI）** 与 **全屏 TUI 面板** 两种呈现方式，可按习惯切换。

<div align="center" style="max-width: 720px; margin: 0 auto;">
  <p><b>标准输出（非 TUI）</b></p>
  <img src="imgs/demo_no_tui_mode.png" width="100%" alt="NanoResearch CLI 标准输出模式" style="max-width: 100%; border-radius: 8px;" />
  <p><sub><b>非 TUI</b>：经典终端日志流，便于重定向与脚本集成</sub></p>
</div>
<div align="center" style="max-width: 720px; margin: 0 auto; margin-top: 1.5em;">
  <p><b>TUI 模式</b></p>
  <img src="imgs/demo_tui_mode.png" width="100%" alt="NanoResearch CLI TUI 模式" style="max-width: 100%; border-radius: 8px;" />
  <p><sub><b>TUI</b>：结构化面板与状态分区，适合交互式监控</sub></p>
</div>

### 示例输出

<table>
  <tr>
    <td align="center" width="50%">
      <img src="imgs/framework_overview.png" alt="框架概览" width="95%" />
      <br />
      <sub><b>框架概览</b></sub>
    </td>
    <td align="center" width="50%">
      <img src="imgs/examples.png" alt="生成论文示例" width="95%" />
      <br />
      <sub><b>生成论文示例</b></sub>
    </td>
  </tr>
  <tr>
    <td align="center" width="50%">
      <img src="imgs/main_results.png" alt="主结果" width="95%" />
      <br />
      <sub><b>主结果（真实实验数据）</b></sub>
    </td>
    <td align="center" width="50%">
      <img src="imgs/ablation.png" alt="消融实验" width="95%" />
      <br />
      <sub><b>消融实验</b></sub>
    </td>
  </tr>
</table>

---

## 🔬 流水线

```text
Research Topic
     ↓
 IDEATION → PLANNING → SETUP → CODING → EXECUTION → ANALYSIS → FIGURE_GEN → WRITING → REVIEW
     ↓
 Exported: paper.pdf / paper.tex / references.bib / figures / code / data
```

<details>
<summary><b>📋 各阶段详细说明</b></summary>

| Stage | 功能 | 说明 |
|-------|------|------|
| `IDEATION` | 文献检索与创意生成 | 搜索学术文献、发现研究空白、提出假说、收集必引文献 |
| `PLANNING` | 实验方案设计 | 将研究想法转化为详细的实验蓝图（数据集、基线、指标、消融） |
| `SETUP` | 环境准备 | 准备代码仓库、依赖环境、模型和数据集 |
| `CODING` | 代码生成 | 生成完整可运行的实验项目（含训练脚本、数据处理、模型定义） |
| `EXECUTION` | **实验执行** | **在本地 GPU 或 SLURM 集群上运行训练，支持自动重试和调试** |
| `ANALYSIS` | 结果分析 | 解析训练日志和指标，生成结构化实验证据 |
| `FIGURE_GEN` | 图表生成 | 创建架构图、结果对比图、消融实验图 |
| `WRITING` | 论文撰写 | 基于实验证据和引用撰写 LaTeX 论文 |
| `REVIEW` | 审稿与修订 | 自动审阅各章节，检测问题并修订 |

</details>

<details>
<summary><b>🚀 EXECUTION 阶段核心能力</b></summary>

`EXECUTION` 阶段是 NanoResearch 的核心差异化能力：

- **自动提交 SLURM 作业** — 生成 sbatch 脚本，提交到集群，监控作业状态
- **本地 GPU 执行** — 自动检测可用 GPU，管理训练进程
- **自动调试与重试** — 训练失败时自动分析错误日志，修复代码并重新执行
- **实时日志监控** — 追踪训练进度和指标变化
- **混合执行模式** — 可根据任务复杂度在本地和集群之间自动切换

</details>

---

## 📦 快速开始

遵循以下步骤，约 5 分钟即可完成从安装到首次运行的完整流程。

### 步骤一：安装

```bash
git clone https://github.com/OpenRaiser/NanoResearch.git
cd NanoResearch
pip install -e ".[dev]"
```

### 步骤二：配置

> [!TIP]
> 创建 `~/.nanoresearch/config.json`，替换 `base_url` 和 `api_key` 为你自己的 OpenAI 兼容 API 端点。

<details>
<summary><b>查看完整配置示例</b></summary>

```json
{
  "research": {
    "base_url": "https://your-openai-compatible-endpoint/v1/",
    "api_key": "your-api-key",
    "template_format": "neurips2025",
    "execution_profile": "local_quick",
    "writing_mode": "hybrid",
    "max_retries": 2,
    "auto_create_env": true,
    "auto_download_resources": true,
    "ideation": { "model": "your-model", "temperature": 0.5, "max_tokens": 16384, "timeout": 600.0 },
````
