How wzsyyh/auto-slides works
1. What this repository is
Auto-Slides is a command-line pipeline that turns an academic PDF into Beamer slide decks. The architecture is not a single monolith; it is a staged multi-agent workflow that moves from PDF understanding to slide planning, LaTeX generation, validation/repair, and optional interactive revision.
2. Top-level entry and orchestration
main.py is the primary entry point. It likely parses CLI flags such as language, theme, revision mode, verification/repair toggles, and speech generation, then coordinates the workflow across the modules. modules/tex_workflow.py and modules/workflow_state.py appear to hold the orchestration logic and shared state for the pipeline.
3. PDF ingestion and content extraction
The first subsystem is PDF parsing: modules/pdf_parser.py plus extractors such as lightweight_extractor.py, simple_text_extractor.py, and table_image_extractor_v2.py. The README indicates the system can use a heavier PDF model (marker-pdf, downloaded via down_model.py) for layout-aware extraction, including text, figures, tables, and structure. This is the boundary where the original paper is converted into normalized raw content.
4. Multimodal asset handling
Figures and tables are handled as first-class artifacts rather than embedded text blobs. modules/intelligent_figure_matcher.py, table_image_extractor_v2.py, and special_char_handler.py likely map extracted visual elements to the right slide locations and clean up text/LaTeX-unfriendly characters. The repository’s static/figures and static/themes directories support presentation assets and theme styling.
5. Presentation planning layer
After extraction, the system plans the slide structure. modules/lightweight_planner.py and modules/presentation_planner.py generate a pedagogically optimized outline: what sections to show, what to emphasize, and how to split the paper into slides. The prompts/slides_planning* and prompts/summarize_text_for_presentation* files are the prompt layer that drives this planning step.
6. Reference and citation subsystem
The modules/reference_agent/ package is a dedicated sub-pipeline for literature-aware enhancement. It includes citation extraction, content extraction, content integration, and literature search, with a small cache under literature_cache/. This subsystem is separate from the core slide planner because it augments the presentation content with reference context rather than only summarizing the source paper.
7. LaTeX/Beamer generation
Slide rendering is done through a family of TEX generators: basic_tex_generator.py, direct_tex_generator.py, tex_generator.py, and revision_tex_generator.py. These modules turn the presentation plan into Beamer source, selecting themes, formatting equations/code/tables, and embedding extracted images. Prompt templates in prompts/tex_generation*, prompts/basic_tex_generation.py, and prompts/direct_tex_generation* drive this generation layer.
8. Quality control: verification and repair loop
Generated slide content is checked before final output. modules/verification_agent.py, simplified_verification_agent.py, and tex_validator.py appear to inspect whether the TEX matches the planned content and whether it compiles cleanly. If issues are found, modules/repair_agent.py and simplified_repair_agent.py attempt automated fixes. This creates a closed loop between generation, validation, and repair.
9. Interactive revision path
The repository also supports human-in-the-loop refinement. modules/interactive_reviser.py, react_interactive_editor.py, and react_interactive_editor_new.py suggest a dialog-based revision interface using ReAct-style prompting. Prompt files such as prompts/interactive_refinement.py and prompts/react_editor_prompts.py define how user feedback is translated into plan or TEX edits.
10. Optional speech generation
modules/speech_generator.py adds an auxiliary output channel: a presentation speech script aligned to the slide deck. The README’s speech options imply this is downstream of slide planning and generation, using the planned structure to produce a timed narration.
11. LLM integration and configuration
modules/llm_interface.py is the abstraction boundary to the language model provider. config/llm_params.py stores model parameters, and patch_openai.py suggests compatibility handling around the OpenAI client. The system is configured via .env, with OpenAI API access as the central runtime dependency.
12. Compilation and runtime artifacts
The final stage is LaTeX compilation and artifact organization. The README describes output folders for raw extraction, plans, TEX, images, verification, repair, and speech, which implies the workflow persists intermediate state at each boundary. The project depends on a local LaTeX toolchain for producing the final PDF, and compilation can be skipped to keep only TEX output.
13. How to think about the architecture diagram
A good diagram would show a left-to-right pipeline with feedback loops: PDF input → extraction → planning → TEX generation → validation/repair → LaTeX compilation → final slides, with side branches for reference enhancement, interactive revision, and speech generation. The key architectural distinction is that raw PDF understanding, slide reasoning, and presentation rendering are separated into distinct modules connected by persisted intermediate artifacts and shared workflow state.
Main entry points: tex_workflow.py Tex workflow · tex_generator.py TEX generator · llm_interface.py LLM interface · pdf_parser.py PDF parser
Components 25
Orchestration
CLI entrypoint and shared workflow state.
- main.py · Parses options and starts the slide-generation pipeline.
main.py - Tex workflow · Coordinates extraction, planning, generation, and finalization.
modules/tex_workflow.py - Workflow state · Carries intermediate artifacts and pipeline status across stages.
modules/workflow_state.py
PDF Extraction
PDF parsing and content normalization.
- PDF parser · Central PDF ingestion layer for document parsing and dispatch.
modules/pdf_parser.py - Light extractor · Fast extraction path for paper text and structure.
modules/lightweight_extractor.py - Text extractor · Fallback or simplified text extraction from PDFs.
modules/simple_text_extractor.py - Table images · Extracts and normalizes tables and image-based assets.
modules/table_image_extractor_v2.py - Figure matcher · Matches extracted figures to the right presentation locations.
modules/intelligent_figure_matcher.py
Slide Planning
Outline and presentation structure synthesis.
- Presentation planner · Builds the main pedagogical slide structure from extracted content.
modules/presentation_planner.py - Light planner · Fast planning path for concise slide outlines.
modules/lightweight_planner.py - Summarize prompt · Prompt for condensing paper text into presentation-ready content.
prompts/summarize_text_for_presentation.py - Slides prompt · Prompt layer that shapes slide planning decisions.
prompts/slides_planning.py
TEX Generation
Beamer rendering, validation, and repair.
- TEX generator · Primary rendering layer for Beamer source generation.
modules/tex_generator.py - Basic TEX · Simpler generation path for producing Beamer output.
modules/basic_tex_generator.py - Revision TEX · Generates updated TEX after interactive or repair-driven changes.
modules/revision_tex_generator.py - Verifier · Checks generated TEX against the plan and expected output quality.
modules/verification_agent.py - Repair agent · Attempts automated fixes when TEX or content validation fails.
modules/repair_agent.py - TEX validator · Validates generated LaTeX for structural or compilation issues.
modules/tex_validator.py
Reference & Revision
Citation enrichment and interactive edits.
- Reference agent · Adds literature context and citation-aware enhancements.
modules/reference_agent/reference_agent.py - Interactive reviser · Supports dialog-based revision of slides and TEX.
modules/interactive_reviser.py - Speech generator · Produces an aligned presentation speech script.
modules/speech_generator.py
Runtime & Assets
Configuration, prompts, themes, and compiled artifacts.
- LLM interface · Abstraction boundary for language-model calls.
modules/llm_interface.py - LLM params · Model and runtime settings used by the pipeline.
config/llm_params.py - Prompts · Repository prompt templates that drive extraction, planning, generation, and revision.
prompts - Static assets · Presentation themes and reusable figure assets.
static
Connections 27
- main.py → Tex workflow: starts · CLI hands off execution to the workflow orchestrator.
- Tex workflow → Workflow state: stores · Workflow state tracks artifacts across stages.
- Tex workflow → PDF parser: ingests · Begins by parsing the source PDF.
- PDF parser → Light extractor: dispatches · Routes to a fast extraction path.
- PDF parser → Text extractor: fallback · Uses simplified text extraction when needed.
- PDF parser → Table images: extracts · Pulls tables and image-based elements.
- Table images → Figure matcher: matches · Aligns extracted visual assets with source content.
- Tex workflow → Presentation planner: plans · Hands normalized content to the main slide planner.
- Tex workflow → Light planner: alternative path · Supports a lighter planning strategy.
- Presentation planner → Slides prompt: guided by · Planning behavior is shaped by prompt templates.
- Presentation planner → Summarize prompt: summarizes with · Uses summarization prompts to condense source content.
- Tex workflow → Reference agent: enriches · Optional reference-aware enhancement stage.
- Tex workflow → Speech generator: optional output · Can generate a narration script from the slide plan.
- Presentation planner → TEX generator: feeds · Presentation plan becomes TEX generation input.
- TEX generator → Basic TEX: variant · Basic generator is one rendering option.
- TEX generator → Revision TEX: variant · Revision-aware generator supports edits and fixes.
- TEX generator → Verifier: checks · Generated TEX is validated against expectations.
- Verifier → Repair agent: fails over · Validation problems route to automated repair.
- Repair agent → Revision TEX: regenerates · Repair loop produces revised TEX.
- Verifier → TEX validator: compile check · LaTeX syntax and compilation are checked.
- Interactive reviser → Revision TEX: edits · Human-in-the-loop changes flow into revised TEX.
- Reference agent → LLM interface: uses · Reference pipeline relies on model calls.
- Interactive reviser → LLM interface: uses · Interactive editing also routes through the LLM boundary.
- Tex workflow → LLM interface: drives · Core workflow delegates reasoning tasks to the model layer.
- LLM interface → LLM params: configured by · Model behavior is parameterized centrally.
- LLM interface → Prompts: prompted by · Prompt assets define task-specific behavior.
- TEX generator → Static assets: styles with · Themes and figures support final presentation rendering.