Learning by building: applying ML concepts to smarter image generation pipelines
I'm a research methodologist getting curious about the tools developers are using. Claude Code, test-driven development workflows, LLM APIsβthese are reshaping how people build software, and I wanted to understand them from the inside.
This project is me figuring out how these pieces fit together: taking machine learning concepts I know (beam search, iterative refinement) and building a pipeline that actually uses them. It's a learning exercise that happens to produce something functional. I'm also starting to apply TDD to my analysis code, and working through this project has given me a much clearer sense of where these tools can make a difference in research workflows.
If you're thinking about similar explorationsβapplying computational ideas to new problems, getting comfortable with LLM APIs, or just seeing what Claude Code can doβthis might be useful as a working example.
This is a rewrite of my earlier Python SDXL prompt generator, now built in Node.js with a focus on iterative refinement. It uses OpenAI's APIs to:
The pipeline implements beam searchβa standard ML algorithm for exploring multiple promising paths simultaneously. I wanted to see how these concepts translate when you're working with LLMs and image generation APIs rather than traditional model architectures.
# Clone and install
npm install
# Set up your OpenAI key
cp .env.example .env
# Edit .env with your API key
# Run the interactive web demo
npm run dev
# Open http://localhost:5000/demo.html
# Or try a single-iteration CLI demo
node demo-single-iteration.js
npm run dev) - Interactive beam search with live progress updatesdemo-single-iteration.js) - Complete pipeline walkthroughdemo-prompt-fidelity.js) - Vision evaluation focusdemo.js --real) - Multi-provider comparisonThe algorithm maintains a "beam" of the top-k candidate prompts, exploring variations while filtering out poor performers:
The key insight: prompts have two dimensions that need separate attention:
The pipeline refines these independently and combines them only at image generation. Odd iterations refine WHAT, even iterations refine HOW. This separation lets each dimension evolve without interfering with the other.
Each generated image gets scored on two axes:
The final score is a weighted combination (configurable alpha). This dual-objective approach ensures you don't just get images that match perfectly but look terrible, or vice versa.
βββββββββββββββ
β Web UI β Vanilla JavaScript + accessibility features
ββββββββ¬βββββββ
β
ββββββββΌβββββββ
β API Server β Express + WebSocket for real-time updates
ββββββββ¬βββββββ
β
ββββββββΌβββββββββββββββββββββββ
β Pipeline Orchestrator β
β - Beam search algorithm β
β - Parallel async execution β
β - Prompt refinement logic β
β - Scoring & ranking β
ββββββββ¬βββββββββββββββββββββββ
β
ββββββββΌβββββββββββββββββββββββ
β Provider Layer β
β - LLM (GPT-4) β
β - Image Gen (DALL-E 3) β
β - Vision (GPT-4V) β
β - Mock providers for tests β
βββββββββββββββββββββββββββββββ
I built this using Claude Code with a test-driven workflow. If you're exploring similar tools, here's the setup:
# Start TDD cycle for a new feature
/tdd start "feature name"
# Check code health (linting, tests, dependencies)
/hygiene
# Make atomic commits with quality checks
/commit
# View and manage tasks
/todo list
See CLAUDE.md for the complete development workflow and AI-assisted practices.
The test suite was critical for learningβit forces you to think through edge cases and makes refactoring safe when you're still figuring out the architecture.
β Core pipeline complete - All components implemented, tested, and documented
| Component | Status | Notes |
|---|---|---|
| LLM Provider (OpenAI) | β | Expand, refine, combine prompts via GPT-4 |
| Image Provider (OpenAI) | β | DALL-E 3 with local storage |
| Vision Provider (OpenAI) | β | GPT-4V for alignment + aesthetic scoring |
| Beam Search Orchestrator | β | Streaming parallel implementation |
| API Server | β | Express + WebSocket with job management |
| Web Frontend | β | Accessible interface with live updates |
| Mock Providers | β | Fast testing without API costs |
This is primarily a learning project, but there are natural extensions if I keep exploring:
See GitHub Issues for detailed ideas.
| Layer | Technology | Why |
|---|---|---|
| Frontend | Vanilla JavaScript | Simple, no build step, fast iteration |
| Backend | Node.js + Express | Async-first, good LLM SDK support |
| Testing | Node.js built-in test runner | Simple, no extra dependencies |
| AI Services | OpenAI API | Mature, well-documented, easy to start |
| Documentation | MkDocs + Material | Clean, searchable, easy to maintain |
Detailed docs available in /docs:
Build and serve locally:
pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin
mkdocs serve
This is a ground-up rewrite of jflournoy/sdxl-prompt-gen-eval. The Python version was an initial exploration. This JavaScript version focuses on:
The core algorithm is the same, but the implementation is substantially different.
If this resonates with your own exploration, contributions are welcome. The project follows:
See CLAUDE.md for development guidelines and slash command reference.
MIT License - see LICENSE file for details.
A learning project built with Claude Code, TDD methodology, and curiosity about how ML concepts translate to real-world pipelines.
JavaScript
81.9%
Python
11.3%
HTML
5.6%
Shell
1.1%
Learning by building: applying ML concepts to smarter image generation pipelines
I'm a research methodologist getting curious about the tools developers are using. Claude Code, test-driven development workflows, LLM APIsβthese are reshaping how people build software, and I wanted to understand them from the inside.
This project is me figuring out how these pieces fit together: taking machine learning concepts I know (beam search, iterative refinement) and building a pipeline that actually uses them. It's a learning exercise that happens to produce something functional. I'm also starting to apply TDD to my analysis code, and working through this project has given me a much clearer sense of where these tools can make a difference in research workflows.
If you're thinking about similar explorationsβapplying computational ideas to new problems, getting comfortable with LLM APIs, or just seeing what Claude Code can doβthis might be useful as a working example.
This is a rewrite of my earlier Python SDXL prompt generator, now built in Node.js with a focus on iterative refinement. It uses OpenAI's APIs to:
The pipeline implements beam searchβa standard ML algorithm for exploring multiple promising paths simultaneously. I wanted to see how these concepts translate when you're working with LLMs and image generation APIs rather than traditional model architectures.
# Clone and install
npm install
# Set up your OpenAI key
cp .env.example .env
# Edit .env with your API key
# Run the interactive web demo
npm run dev
# Open http://localhost:5000/demo.html
# Or try a single-iteration CLI demo
node demo-single-iteration.js
npm run dev) - Interactive beam search with live progress updatesdemo-single-iteration.js) - Complete pipeline walkthroughdemo-prompt-fidelity.js) - Vision evaluation focusdemo.js --real) - Multi-provider comparisonThe algorithm maintains a "beam" of the top-k candidate prompts, exploring variations while filtering out poor performers:
The key insight: prompts have two dimensions that need separate attention:
The pipeline refines these independently and combines them only at image generation. Odd iterations refine WHAT, even iterations refine HOW. This separation lets each dimension evolve without interfering with the other.
Each generated image gets scored on two axes:
The final score is a weighted combination (configurable alpha). This dual-objective approach ensures you don't just get images that match perfectly but look terrible, or vice versa.
βββββββββββββββ
β Web UI β Vanilla JavaScript + accessibility features
ββββββββ¬βββββββ
β
ββββββββΌβββββββ
β API Server β Express + WebSocket for real-time updates
ββββββββ¬βββββββ
β
ββββββββΌβββββββββββββββββββββββ
β Pipeline Orchestrator β
β - Beam search algorithm β
β - Parallel async execution β
β - Prompt refinement logic β
β - Scoring & ranking β
ββββββββ¬βββββββββββββββββββββββ
β
ββββββββΌβββββββββββββββββββββββ
β Provider Layer β
β - LLM (GPT-4) β
β - Image Gen (DALL-E 3) β
β - Vision (GPT-4V) β
β - Mock providers for tests β
βββββββββββββββββββββββββββββββ
I built this using Claude Code with a test-driven workflow. If you're exploring similar tools, here's the setup:
# Start TDD cycle for a new feature
/tdd start "feature name"
# Check code health (linting, tests, dependencies)
/hygiene
# Make atomic commits with quality checks
/commit
# View and manage tasks
/todo list
See CLAUDE.md for the complete development workflow and AI-assisted practices.
The test suite was critical for learningβit forces you to think through edge cases and makes refactoring safe when you're still figuring out the architecture.
β Core pipeline complete - All components implemented, tested, and documented
| Component | Status | Notes |
|---|---|---|
| LLM Provider (OpenAI) | β | Expand, refine, combine prompts via GPT-4 |
| Image Provider (OpenAI) | β | DALL-E 3 with local storage |
| Vision Provider (OpenAI) | β | GPT-4V for alignment + aesthetic scoring |
| Beam Search Orchestrator | β | Streaming parallel implementation |
| API Server | β | Express + WebSocket with job management |
| Web Frontend | β | Accessible interface with live updates |
| Mock Providers | β | Fast testing without API costs |
This is primarily a learning project, but there are natural extensions if I keep exploring:
See GitHub Issues for detailed ideas.
| Layer | Technology | Why |
|---|---|---|
| Frontend | Vanilla JavaScript | Simple, no build step, fast iteration |
| Backend | Node.js + Express | Async-first, good LLM SDK support |
| Testing | Node.js built-in test runner | Simple, no extra dependencies |
| AI Services | OpenAI API | Mature, well-documented, easy to start |
| Documentation | MkDocs + Material | Clean, searchable, easy to maintain |
Detailed docs available in /docs:
Build and serve locally:
pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin
mkdocs serve
This is a ground-up rewrite of jflournoy/sdxl-prompt-gen-eval. The Python version was an initial exploration. This JavaScript version focuses on:
The core algorithm is the same, but the implementation is substantially different.
If this resonates with your own exploration, contributions are welcome. The project follows:
See CLAUDE.md for development guidelines and slash command reference.
MIT License - see LICENSE file for details.
A learning project built with Claude Code, TDD methodology, and curiosity about how ML concepts translate to real-world pipelines.
JavaScript
81.9%
Python
11.3%
HTML
5.6%
Shell
1.1%