ai, agents, deep dive,

Deep Dive: PaperOrchestra, a Paper-Writing Pipeline Gated by a Reviewer Score

Cui Cui Follow Dec 01, 2026 · 5 mins read
Deep Dive: PaperOrchestra, a Paper-Writing Pipeline Gated by a Reviewer Score
Share this

google-research/paper-orchestra is a multi-agent framework for automated AI research paper writing (Apache-2.0, from Google Cloud AI Research; its README says it is not an officially supported Google product). This is a source reading at commit d9bae99: I cloned the repo and read methods/paper_writer.py, methods/paper_writer_with_plotting.py, methods/agents/outline_agent.py, literature_review_agent.py, section_writing_agent.py, content_refinement_agent.py, plotting_agent.py and paper_writing_cli.py.

Companion tutorial: how to set it up and run it is on Cui.Guru: Turn raw research notes into a LaTeX paper with PaperOrchestra.

The workflow in motion

Animated workflow: raw materials go to the outline agent, then literature and plotting agents, then the section writer, then a refinement loop that outputs the final PDF.

Architecture

The orchestrator is not an agent. (The class diagram below is conceptual: write_single_paper and run_batch_writeup are module-level functions, and with plotting enabled the entry module is paper_writer_with_plotting.py.) write_single_paper is a plain function that runs four numbered steps in a fixed order and wraps the whole thing in a retry loop (max_n_tries = 3). Each agent is a class with a run method that reads files and writes files, so the “protocol” between agents is the file system: outline.json, citation_map.json, references.bib, raw_draft_paper.tex.

paper_writer_with_plotting.py is the same pipeline with one change: step 2 runs the literature agent and the plotting agent concurrently. run_batch_writeup then fans papers out over a ProcessPoolExecutor and keeps a paper_writing_log.json, skipping papers already marked success so a batch can resume.

The core design idea

Writing agents are easy to build; knowing when an LLM rewrite made the paper worse is the hard part. PaperOrchestra’s answer is to put a second LLM in the role of reviewer, score every revision, and accept a change only if the score does not regress. The rule has three cases, visible in ContentRefinementAgent.run:

  • Overall score went up: accept the revision and continue.
  • Overall score went down: stop and keep the previous version.
  • Overall score is the same: compare the per-axis deltas. If total drop exceeds total gain, stop and revert; otherwise accept.

The excerpt below is from methods/agents/content_refinement_agent.py (condensed to the decision):

# Case 1: Overall Increased -> SUCCESS -> ACCEPT & CONTINUE
if new_metrics["Overall"] > old_metrics["Overall"]:
    current_log_entry["outcome"] = "ACCEPTED_SCORE_INCREASE"
    self.current_tex = new_tex
    final_valid_pdf_path = cur_pdf_path

# Case 2: Overall Decreased -> FAIL -> BREAK & REVERT
elif new_metrics["Overall"] < old_metrics["Overall"]:
    current_log_entry["outcome"] = "REJECTED_SCORE_DECREASE"
    break

# Case 3: Overall Same
else:
    if total_drop > total_gain:
        current_log_entry["outcome"] = "REJECTED_DEGRADATION"
        break
    else:
        current_log_entry["outcome"] = "ACCEPTED_NEUTRAL_IMPROVEMENT"
        self.current_tex = new_tex

Each content revision that compiles and gets scored is also written to content_refinement_worklog.json with the before and after scores, the deltas and the outcome label, so a run leaves an audit trail (a round that fails to compile is skipped without an entry). After this loop, run makes a separate formatting pass; a formatted PDF replaces the selected one if it compiles, but it is not re-scored, so the score gate covers the content revisions, not that last step. The loop is bounded: the orchestrator passes max_reflections=3.

The plotting agent uses the same bounded critique idea for figures: process_single_figure loops for round_idx in range(max_critic_rounds) and calls critique_and_revise_figure each round (default 3).

Other design details

Files as the interface. The orchestrator copies the chosen latex_template_dir into a latex_writeup folder, asserts that guidelines.md, template.tex, the idea file and the experimental log exist, then hands paths, not objects, to each agent:

# methods/paper_writer.py
outline_agent.run(
    idea_file=idea_file_path,
    experimental_log_file=experimental_log_file_path,
    latex_template_file=latex_template_path,
    conference_guidelines_file=guidelines_path,
    output_filepath=outline_file_path,
)

Literature with a date cutoff. HybridLiteratureAgent runs search tasks derived from the outline in a thread pool, enriches candidates through Semantic Scholar title search, then filters them with _is_paper_allowed, which compares year, month and day against the cutoff passed in as --research_cutoff. It is a best-effort filter: papers with no publication year are allowed, and a YYYY-MM cutoff is treated as day 1 of that month. A one-second time.sleep(1.0) and a “rate-limited, sequential” comment mark the enrichment phase.

Template-driven section writing. SectionWritingAgent sends the outline, citation library, idea, log, figure list, guidelines and template.tex to the model, with the instruction to identify missing sections and return the full compilable LaTeX file; existing template text is marked “DO NOT CHANGE”.

Takeaways

  • Treat the file system as the agent interface: each stage reads and writes named artifacts, which makes stages restartable and inspectable.
  • Gate LLM rewrites with an independent scorer and a revert rule; a bounded loop plus a worklog beats open-ended “improve this”.
  • Run independent stages (literature and plotting) in parallel and keep sequential only what truly depends on the previous output.
  • The orchestrator owns whole-pipeline retries (three attempts); some agent steps and API calls also retry on their own.
  • Check outputs yourself: this is a research codebase, and its literature step depends on LLM search plus title matching.

Want a pipeline like this for your own team’s documents or reports? Get in touch.

Join Newsletter
Get the latest news right in your inbox. We never spam!
Cui
Written by Cui Follow
Hi, I am Z, the coder for cuizhanming.com!

Click to load Disqus comments