Algorithm Reconstructor
Reconstruct methodological logic from papers and code into publication-grade LaTeX pseudocode.
Workflow
- Gather sources — Read paper methodology section, appendix, and source code. Prioritize paper over code.
- Identify novelty — Pinpoint the core contribution. Do NOT reduce it to a generic training loop.
- Select structure — Single unified algorithm, or multi-algorithm by stage. Adapt to paper's natural decomposition.
- Draft pseudocode — Follow style rules below. Use
references/notation.mdfor symbol mapping. - Compile — Run
scripts/compile_algo.pyon the generated.tex. Fix errors until PDF succeeds. - Output — Deliver: Rationale → LaTeX → Complexity Analysis → Compilation Result.
Source Priority
| Priority | Source | Use for |
|---|---|---|
| 1 | Paper methodology | Core logic, algorithmic flow |
| 2 | Appendix / supplementary | Missing steps, detailed procedures |
| 3 | Source code | Clarify ambiguity, verify consistency |
If code conflicts with paper → trust paper, note discrepancy in Rationale.
Abstraction Level
METHOD-LEVEL pseudocode. Include:
- Core methodological pipeline
- Key optimization logic
- Important mathematical transformations
- Novel modules
- Training / inference stages
Exclude:
- Low-level tensor ops (
tensor.cuda(),batch.to(device)) - Framework APIs (
optimizer.zero_grad(),loss.backward()) - Engineering clutter
If the contribution IS a specific module → elaborate that module sufficiently.
Pseudocode Style
Package: \usepackage[ruled,vlined,linesnumbered]{algorithm2e}
Conventions:
\KwIn/\KwOutfor input/output- Line numbering enabled
- Scientific notation over programming notation (see
references/notation.md) - Concise mathematical wording
Output Format
Always output in this order:
# Rationale
- How algorithm was reconstructed
- Abstraction decisions and assumptions
- Paper-code discrepancies
# LaTeX Pseudocode
Full compilable LaTeX snippet. Must compile directly.
# Complexity Analysis
- Algorithm intuition (2-3 sentences)
- Time complexity: O(...)
- Space complexity: O(...)
- State assumptions if derivation is uncertain
# Compilation Result
- Engine used
- Success/failure
- PDF path
- Fixes applied
Quality Checklist
Before finalizing, verify:
- Looks like top-tier conference pseudocode
- Reflects methodology, not source code
- Highlights novelty
- Scientifically concise
- Mathematical notation normalized
- No engineering clutter
- Fully compilable
- Publication-ready
Resources
references/notation.md— Symbol mapping and LaTeX conventionsreferences/style_guide.md— Per-venue style expectations and examplesscripts/compile_algo.py— Compile.texto PDF with auto-retry