How ml-postech/epic works
EPIC turns a text prompt into a fixed visual program, generates an image, checks its predicates, and iteratively edits or resamples until acceptance or the round budget is exhausted. Benchmark runners adapt several prompt datasets to the same generation workflow. The graph reflects documented capabilities and indexed imports; unsampled implementation details and model-service wiring are represented only where the README or excerpts support them.
Main entry points: node_vp_pipeline.py Refinement loop · graph_main.py Generation API · visual_program_verifier.py Predicate verifier · models.py Model clients
Components 22
Entry points
- Generation API
src/graph/graph_main.py - Run options
src/graph/cli.py - Benchmark runners
Refinement control
- Run state
src/graph/state.py - Refinement loop
src/graph/node_vp_pipeline.py - VLM context
src/graph/context.py
Visual program
- Program parser
src/graph/visual_program_parser.py - Program schema
src/graph/visual_program.py - Predicate vocabulary
src/graph/visual_program_support.py - Prompt rewriter
src/graph/rewritten_prompt_generator.py - Action selector
src/graph/visual_program_action_selector.py - Loop auditor
src/graph/visual_program_auditor.py
Generation and verification
- Predicate verifier
src/graph/visual_program_verifier.py - Verification tools
src/graph/visual_program_runtime_tools.py - Region and depth tools
src/graph/visual_program_tools.py - Depth estimation
src/graph/depth.py - Image generation
src/graph/image_runtime.py - Model clients
src/graph/models.py
Results and benchmarks
- Images and traces
src/graph/utils.py
Other components
- Prompt author
- VLM endpoint
- Benchmark prompts
Connections 27
- Prompt author → Generation API: submits prompt
README.md - Run options → Generation API: configures run
src/graph/graph_main.py - Benchmark runners → Generation API: invokes
- Benchmark prompts → Benchmark runners: supplies prompts
README.md - Generation API → Refinement loop: invokes
src/graph/graph_main.py - Generation API → VLM context: builds context
src/graph/graph_main.py - Refinement loop → Run state: updates
src/graph/graph_main.py - Refinement loop → Program parser: parses prompt
src/graph/node_vp_pipeline.py - Refinement loop → Prompt rewriter: requests rewrites
src/graph/node_vp_pipeline.py - Refinement loop → Action selector: selects actions
src/graph/node_vp_pipeline.py - Refinement loop → Loop auditor: audits progress
src/graph/node_vp_pipeline.py - Refinement loop → Predicate verifier: checks predicates
src/graph/node_vp_pipeline.py - Refinement loop → Image generation: generates edits
src/graph/node_vp_pipeline.py - Refinement loop → Images and traces: saves results
src/graph/graph_main.py - Program parser → Program schema: builds program
src/graph/visual_program_parser.py - Program parser → Predicate vocabulary: uses vocabulary
src/graph/visual_program_parser.py - Prompt rewriter → Model clients: calls model
src/graph/rewritten_prompt_generator.py - Action selector → Program schema: reads predicates
src/graph/visual_program_action_selector.py - Action selector → Predicate verifier: uses verification
src/graph/visual_program_action_selector.py - Loop auditor → Model clients: calls model
src/graph/visual_program_auditor.py - Predicate verifier → Program schema: evaluates predicates
src/graph/visual_program_verifier.py - Predicate verifier → Region and depth tools: uses proposals
src/graph/visual_program_verifier.py - Verification tools → Region and depth tools: dispatches tools
src/graph/visual_program_runtime_tools.py - Verification tools → Depth estimation: estimates depth
src/graph/visual_program_runtime_tools.py - Image generation → Model clients: uses generation model
src/graph/image_runtime.py - Model clients → VLM endpoint: sends model requests
README.md - Image generation → Images and traces: encodes images
src/graph/utils.py