CoolFace
Apppublic

nensi1311/research-paper-formatter-agent

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
0likes
App README

πŸ“„ Research Paper Formatter β€” OpenEnv

An OpenEnv-compliant RL environment where AI agents learn to reformat academic research papers between conference and journal submission styles.

Motivation

Every researcher who has submitted papers across multiple venues knows the pain: a paper formatted for NeurIPS needs 15+ changes before it can be submitted to IEEE. The column count changes, the reference style changes, the abstract length limit changes, the author name format changes, the citation style changes... and it's all manual.

This environment teaches agents to:

  1. 1.Identify formatting violations across 6+ dimensions
  2. 2.Plan an efficient sequence of formatting actions
  3. 3.Execute targeted fixes with the right parameters
  4. 4.Submit only when the paper is fully compliant

It fills a genuine gap β€” formatting-aware document agents are underexplored in the RL community, despite being a high-value real-world task.


Environment Description

The environment simulates reformatting a real academic paper from one conference style to another. The paper is represented as a structured object (sections, references, authors, metadata) and the agent applies formatting actions one at a time.

Supported conference formats: IEEE, ACM, NeurIPS, ICML, AAAI, arXiv

Each conference has a FormatSpec defining:

  • β€”Required and forbidden sections
  • β€”Section ordering
  • β€”Abstract word limit
  • β€”Reference citation style (IEEE, ACM, APA, AAAI)
  • β€”Author name format ("F. Last" vs "First Last")
  • β€”Column layout (1 or 2)
  • β€”In-text citation style (numeric vs author-year)

Observation Space

The observation is a PaperObservation JSON object:

FieldTypeDescription
paper_idstringUnique paper identifier
paper_titlestringPaper title
current_formatenumSource conference format
target_formatenumTarget conference format
target_specFormatSpecFull spec for target conference
sectionslist[Section]Paper sections with metadata
section_orderlist[string]Current section ordering
referenceslist[Reference]Reference list with style info
authorslist[AuthorInfo]Author names and affiliations
abstract_word_countintCurrent abstract length
column_layoutintCurrent column count (1 or 2)
title_case_stylestringCurrent title casing
citation_stylestringnumeric or author_year
compliance_scorefloatRunning 0.0–1.0 compliance score
issueslist[string]All current formatting violations
fixed_issueslist[string]Issues resolved so far
steps_takenintSteps used so far
max_stepsintMaximum allowed steps
doneboolEpisode completion flag

Action Space

Actions are JSON objects with action_type and parameters:

ActionParametersDescription
set_formatformat: strDeclare target format
rename_sectionold_name, new_name: strRename a section
reorder_sectionsorder: list[str]Reorder sections
format_referencesstyle: strChange reference style
set_title_casestyle: strChange title casing
set_abstract_word_limitlimit: intTrim abstract
remove_sectionname: strRemove a section
add_sectionname, section_type: strAdd a section
format_author_liststyle: strChange author format
set_column_layoutcolumns: intSet 1 or 2 columns
format_citationsstyle: strSwitch citation style
submit{}Submit paper (ends episode)

Tasks

Task 1: NeurIPS β†’ IEEE (Easy)

Max steps: 8 | Success threshold: 0.85

Convert a transformer paper from NeurIPS to IEEE format. 4 clear issues:

  • β€”Abstract exceeds 150-word limit (current: 220 words)
  • β€”Column layout is 1 (IEEE requires 2)
  • β€”Citation style is author_year (IEEE requires numeric)
  • β€”References use APA style (IEEE requires IEEE style)

Task 2: ACM β†’ NeurIPS (Medium)

Max steps: 12 | Success threshold: 0.80

Convert an LLM systems paper from ACM to NeurIPS. 6 issues requiring careful sequencing:

  • β€”Author names use abbreviated format (D. Zhang β†’ full first name)
  • β€”Section names have numeric prefixes (1. Introduction)
  • β€”Duplicate Related Work sections
  • β€”Citation style is numeric (NeurIPS requires author_year)
  • β€”References use ACM style (NeurIPS requires APA)
  • β€”Column layout is 2 (NeurIPS requires 1)

Task 3: IEEE β†’ ICML (Hard)

Max steps: 15 | Success threshold: 0.75

Full reformat of a NAS paper from IEEE to ICML. 7+ issues including traps:

  • β€”Title is ALL CAPS (must switch to title case)
  • β€”Section names use IEEE roman numeral convention (I. Introduction)
  • β€”Author names abbreviated (H. Liu β†’ expanded)
  • β€”Citation style wrong (numeric β†’ author_year)
  • β€”Reference style wrong (IEEE β†’ APA)
  • β€”Section V. Discussion needs renaming and reordering
  • β€”Multiple sections need clean renaming without double-fixing

Reward Function

The reward is a weighted composite of 6 dimension scores, all in [0.0, 1.0]:

DimensionWeightDescription
Section structure30%Required sections present, no forbidden, correct order
Reference format20%All references use target citation style
Abstract compliance15%Abstract within word limit
Author format15%Names follow target format pattern
Layout10%Correct column count
Citation style10%In-text citations use target style

Step penalty: βˆ’0.005 per step (max βˆ’0.10) β€” rewards efficient agents.

Reward is provided every step, not just on submission, giving dense learning signal.


API Endpoints

POST /reset          {"task_id": "task_easy"}         β†’ PaperObservation
POST /step           {"action_type": ..., "parameters": {...}} β†’ StepResult
GET  /state          β†’ EpisodeState (full internal state)
GET  /health         β†’ {"status": "ok"}
GET  /tasks          β†’ list of task metadata
GET  /action_space   β†’ action schema documentation
GET  /docs           β†’ Swagger UI

Setup & Usage

Local

bash
git clone https://huggingface.co/spaces/Nensi1311/research-paper-formatter-agent
pip install -r requirements.txt
python server.py

Docker

bash
docker build -t paper-formatter-env .
docker run -p 7860:7860 paper-formatter-env

Inference / Baseline

bash
export HF_TOKEN=your_token
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=Qwen/Qwen2.5-72B-Instruct

python inference.py

Baseline Scores

Measured with Qwen/Qwen2.5-72B-Instruct at temperature 0.2:

TaskScoreSuccessSteps
task_easy (NeurIPSβ†’IEEE)~0.88βœ“4–5
task_medium (ACMβ†’NeurIPS)~0.72βœ“8–9
task_hard (IEEEβ†’ICML)~0.61βœ—12–13
Average~0.74

These scores represent a strong baseline β€” the hard task is genuinely challenging for frontier models.


Project Structure

paper-formatter-openenv/
β”œβ”€β”€ server.py           # FastAPI HTTP server (OpenEnv endpoints)
β”œβ”€β”€ environment.py      # Core env: reset(), step(), state()
β”œβ”€β”€ models.py           # Pydantic typed models (Observation, Action, Reward, State)
β”œβ”€β”€ grader.py           # Deterministic multi-dimension grader
β”œβ”€β”€ tasks.py            # Task definitions (easy/medium/hard)
β”œβ”€β”€ paper_data.py       # Synthetic paper dataset
β”œβ”€β”€ conference_specs.py # Conference format specifications
β”œβ”€β”€ inference.py        # Baseline LLM agent script
β”œβ”€β”€ openenv.yaml        # OpenEnv spec metadata
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ Dockerfile
└── README.md

Citation

bibtex
@misc{paper-formatter-openenv,
  title={Research Paper Formatter: An OpenEnv Environment for Academic Document Reformatting},
  year={2025},
  publisher={HuggingFace Spaces},
  url={https://huggingface.co/spaces/Nensi1311/research-paper-formatter-agent}
}