๐Ÿ”ฌ NanoResearch

May 12, 2026 ยท View on GitHub

๐Ÿ”ฌ NanoResearch

A tri-level co-evolving multi-agent research automation system.

Re-implementation of NanoResearch (arXiv:2605.10813) with a ChatGPT-style web UI and field-agnostic prompts.

License: Apache 2.0 Python 3.11+ FastAPI React Tests Docs

๐Ÿ“– Documentation ยท ๐Ÿ— Architecture ยท ๐Ÿš€ Quickstart ยท ๐Ÿ“„ Original paper


"Automation for whom? Researchers operate under different resource configurations, hold different methodological preferences, and target different output formats. A system that produces uniform outputs regardless of these differences will systematically under-serve every individual user."

โ€” NanoResearch (Xu et al., 2026)

NanoResearch takes a one-line research idea โ€” in any scholarly field โ€” and rides it through ideation, planning, experimentation, analysis, writing, and review to produce a downloadable LaTeX paper, while learning your preferences so the next run feels more like you.

โœจ Highlights

  • ๐Ÿ’ฌ Single chat surface. No buttons. Tell it your field and a topic; it narrates the pipeline back to you and pauses for feedback at every stage.
  • ๐ŸŒ Field-agnostic. Biology, social sciences, engineering, mathematics, computer science โ€” prompts adapt to the field's conventions (regressions vs. proofs vs. case studies vs. ablations).
  • ๐Ÿง  Tri-level co-evolution. Per-user Skill Bank (procedural rules), Memory Module (project-specific facts), and a planner adapter trained via SDPO from your free-form feedback.
  • ๐Ÿ”ฌ Real artefacts. Generates and runs a Python project for empirical fields, parses results, then assembles a section-by-section LaTeX paper that compiles to PDF (when pdflatex is installed).
  • ๐Ÿ” Azure AD auth. Talks to your private GPT-5.1 deployment via DefaultAzureCredential โ€” no API keys in .env.

Pipeline at a glance

flowchart LR
  T[Topic] --> O((Orchestrator))
  O -->|retrieve| SB[(Skill Bank ๐’ฎ)]
  O -->|retrieve| MM[(Memory Module โ„ณ)]
  O --> I[Ideation]:::s1
  I --> P[Planning]:::s1
  P --> C[Coding +<br/>Execution]:::s2
  C --> A[Analysis]:::s2
  A --> W[Writing]:::s3
  W --> R[Review]:::s3
  R --> Paper[paper.pdf]
  W -.->|distil| SB
  W -.->|distil| MM
  I -.->|narrations| U[Chat]
  P -.-> U
  C -.-> U
  A -.-> U
  W -.-> U
  U -.->|feedback โ„ฑ| O
  classDef s1 fill:#1e3a8a,stroke:#3b82f6,color:#fff
  classDef s2 fill:#92400e,stroke:#f59e0b,color:#fff
  classDef s3 fill:#065f46,stroke:#10b981,color:#fff

๐Ÿ—‚ What's in the box

ComponentFolderPurpose
๐Ÿง  Backend (Python)src/nanoresearch/Multi-agent pipeline, FastAPI server, Skill/Memory stores, SDPO trainer
๐Ÿ’ฌ Frontend (React + Vite)ui/Chat-first UI with assistant-uiโ€“style bubbles and live SSE narrations
๐Ÿ“š Documentation sitedocs/Jekyll-friendly markdown; deployed to GitHub Pages
๐Ÿ–ผ Diagramsdocs/assets/diagrams/Mermaid sources + rendered PNGs
๐Ÿงช Teststests/61 unit + integration tests, offline-runnable

๐Ÿš€ Quickstart

Prerequisites

  • Python 3.11+ (3.12 tested)
  • Node 18+ (Vite + assistant-ui)
  • An Azure OpenAI / Foundry deployment of GPT-5.1 (or a compatible reasoning model)
  • az login performed locally; your account needs the Cognitive Services OpenAI User role
  • (optional) pdflatex or tectonic for PDF compilation โ€” otherwise the paper ships as .tex
  • (optional) Apple-Silicon Mac with 32 GB+ unified RAM for the local Qwen planner (SDPO)

Setup

# 1. Clone + venv
git clone https://github.com/saadmsft/nanoresearch.git
cd nanoresearch
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# 2. Configure Azure (AAD auth โ€” no API keys)
cp .env.example .env
# edit AZURE_OPENAI_ENDPOINT + AZURE_OPENAI_DEPLOYMENT
az login

# 3. Backend
nanoresearch serve            # http://127.0.0.1:8000

# 4. Frontend (separate terminal)
cd ui && npm install && npm run dev   # http://localhost:5173

Open http://localhost:5173 and say hi.

Optional: local SDPO planner

pip install -e ".[local]"     # torch, transformers, peft, accelerate
huggingface-cli download Qwen/Qwen2.5-7B-Instruct \
  --local-dir data/models/Qwen2.5-7B-Instruct

๐Ÿ’ฌ What it looks like

You โ–ธ I'm Mia, an ecologist. I prefer field studies, 6-month timeline.
      Start a run on canopy cover and breeding-bird richness in city parks.

NanoResearch โ–ธ Nice to meet you, Mia. Starting on canopy cover + bird richness.
NanoResearch โ–ธ ๐Ÿ”Ž Searching scholarly databasesโ€ฆ
NanoResearch โ–ธ ๐Ÿ“š Done. 12 papers.
NanoResearch โ–ธ ๐Ÿ’ก Drafted hypotheses (n=6). Checking novelty next.
NanoResearch โ–ธ ๐ŸŽฏ Going with: Canopy ร— heterogeneity interaction predicts richness.
NanoResearch โ–ธ โธ Paused at ideation โ€” what should I emphasise or change?

You โ–ธ Keep the design simple and proceed.

NanoResearch โ–ธ ๐Ÿ“ Drafting an experiment blueprintโ€ฆ
NanoResearch โ–ธ ๐Ÿ‘€ Running an internal peer review of the blueprintโ€ฆ
NanoResearch โ–ธ ๐Ÿงช Writing a small experiment project to test the planโ€ฆ
NanoResearch โ–ธ โ–ถ๏ธ Running the experimentโ€ฆ
NanoResearch โ–ธ ๐Ÿ“ˆ Run finished (ok=True exit=0 dur=3.2s).
NanoResearch โ–ธ ๐Ÿ“Š Analysing resultsโ€ฆ
NanoResearch โ–ธ โœ๏ธ Drafting the introduction / method / experiments / โ€ฆ sections.
NanoResearch โ–ธ ๐Ÿ‘“ Reviewing the paper draft.
NanoResearch โ–ธ ๐Ÿ“„ Paper compiled. [Download PDF] โ€” or the [LaTeX source].

๐Ÿ› Architecture

NanoResearch is a stage pipeline orchestrated around two persistent stores and one trainable planner.

flowchart TB
  subgraph User["๐Ÿ‘ค User"]
    Chat["๐Ÿ’ฌ Chat UI"]
  end

  subgraph API["โšก FastAPI"]
    Intent["/api/intent<br/>NL โ†’ action"]
    RunMgr["RunManager<br/>background thread"]
    Narr["Narrator<br/>event โ†’ English"]
    SSE["SSE /stream<br/>+ narration"]
    Files["paper.pdf<br/>paper.tex"]
  end

  subgraph Pipe["๐Ÿ”ฌ Pipeline (Orchestrator)"]
    direction LR
    I[Ideation] --> P[Planning]
    P --> C[Coding]
    C --> An[Analysis]
    An --> W[Writing]
  end

  subgraph Stores["๐Ÿ’พ Per-User Stores"]
    Profile[(Profile)]
    Skill[(Skill Bank ๐’ฎ)]
    Mem[(Memory โ„ณ)]
    LoRA[(LoRA adapter)]
  end

  subgraph LLMs["๐Ÿค– Models"]
    Azure[Azure OpenAI<br/>GPT-5.1]
    Qwen[Qwen2.5-7B<br/>local ยท planner only]
  end

  Chat <-->|HTTP| Intent
  Chat <-->|EventSource| SSE
  Chat -->|download| Files
  Intent --> RunMgr
  RunMgr --> Pipe
  Pipe --> Narr --> SSE
  Pipe <-->|retrieve / distil| Stores
  Pipe -->|complete| Azure
  Pipe -->|plan| Qwen
  Qwen <-->|SDPO LoRA| LoRA

๐Ÿ“– Full architecture deep-dive: docs/architecture.md ยท paper ยง3 mapping ยท SDPO math

๐Ÿงช Testing

pytest -m "not azure and not local_model"   # 61 offline tests
pytest -m azure                              # AAD smoke
pytest -m local_model                         # Qwen MPS smoke
SuiteTests
Config + manifest + router9
Stores (schemas, retrieval, distill)18
Orchestrator8
Stage I (literature + ideation + planning)9
Stage II + III (sandbox, narrator, TeX, schemas)9
HTTP API7
SDPO (gradient + LoRA)3 (opt-in)
Azure / local smoke2 (opt-in)

๐Ÿ“‚ Repository layout

nanoresearch/
โ”œโ”€โ”€ src/nanoresearch/
โ”‚   โ”œโ”€โ”€ agents/           # Stage I-III stage controllers + prompts + artefacts
โ”‚   โ”œโ”€โ”€ api/              # FastAPI app, RunManager, intent classifier, narrator
โ”‚   โ”œโ”€โ”€ cli/              # `nanoresearch serve`, `health`, `settings`
โ”‚   โ”œโ”€โ”€ config/           # pydantic-settings
โ”‚   โ”œโ”€โ”€ literature/       # OpenAlex client + evidence extraction
โ”‚   โ”œโ”€โ”€ llm/              # Azure (AAD) + local Qwen backends, agent-role router
โ”‚   โ”œโ”€โ”€ logging/          # structlog + per-run JSONL manifest
โ”‚   โ”œโ”€โ”€ orchestrator/     # Retrieve โ†’ Plan โ†’ Dispatch โ†’ Reflect โ†’ Update
โ”‚   โ”œโ”€โ”€ planner/          # Qwen wrapper + LoRA + SDPO trainer (Eq. 14-15)
โ”‚   โ”œโ”€โ”€ schemas/          # Profile / Skill / Memory pydantic models
โ”‚   โ””โ”€โ”€ stores/           # SkillBank + MemoryStore + Profile (JSON-backed)
โ”œโ”€โ”€ ui/                   # React + TypeScript + Tailwind chat
โ”œโ”€โ”€ docs/                 # Jekyll site (GitHub Pages)
โ”œโ”€โ”€ tests/                # Pytest suite
โ”œโ”€โ”€ runs/                 # โ† created at runtime (event logs + papers/<run>/paper.tex)
โ””โ”€โ”€ data/users/<id>/      # โ† created at runtime (profile, skills, memories, lora)

๐Ÿ—บ Roadmap

  • Phase 0โ€“4 โ€” bootstrap, stores, planner+SDPO, orchestrator, Stage I (Ideation + Planning)
  • Phase 5 โ€” Stage II (Coding + sandboxed exec + debug loop) + Analysis
  • Phase 6 โ€” Stage III (Writing + Reviewer + LaTeX/PDF)
  • FastAPI + React/Vite UI with live SSE narrations
  • Phase 7 โ€” Compliance/Novelty/Writing judges (paper ยง8โ€“10) + 20-topic benchmark harness
  • Phase 8 โ€” CLI ergonomics (nanoresearch run, nanoresearch eval)
  • Docker sandbox upgrade for Stage II
  • Per-section figure generation + bibliography auto-fill

๐Ÿ“œ Citation

If this implementation is useful in your research, please cite the original paper:

@misc{xu2026nanoresearch,
  title  = {NanoResearch: Co-Evolving Skills, Memory, and Policy for Personalized Research Automation},
  author = {Xu, Jinhang and Zhu, Qiyuan and Wu, Yujun and Wang, Zirui and Zhang, Dongxu and others},
  year   = {2026},
  eprint = {2605.10813},
  archivePrefix = {arXiv},
  primaryClass  = {cs.AI},
  url    = {https://arxiv.org/abs/2605.10813}
}

๐Ÿ“„ License

Apache 2.0 โ€” see LICENSE.

Original NanoResearch paper ยฉ Xu et al., 2026.
This implementation is independent and not affiliated with the original authors.