Application Workflow#
This page describes a proven workflow for developing research applications with LLMs — from initial idea to production-scale deployment — and walks through a concrete case study.
Development Cycle#
Identify dataset + task
↓
Engineer a prompt (use Playground)
↓
Evaluate on a small sample
├── Acceptable → Deploy at scale
└── Not acceptable → Prompt engineering / fine-tuning
Step 1: Identify Your Dataset and Task#
Be precise about what you want to extract or classify. Vague tasks produce vague results. Define:
What is the input? (a document, a paragraph, a sentence)
What exactly do you want to extract or infer?
What format should the output be in?
Step 2: Engineer Your Prompt#
Use the OpenAI Playground to develop prompts interactively before writing code. Tips:
Use a
systemmessage to set role and format expectationsUse structured output (JSON) when you need to parse results programmatically
Start simple; add constraints only when needed
See OpenAI’s Prompt Engineering Guide
Step 3: Evaluate on a Sample#
Test on 20–50 examples before running at scale:
If performance is unacceptable → revise the prompt
If prompt engineering isn’t enough → consider fine-tuning or a different model
Always validate against a known gold standard (see Validation and Rigor)
Step 4: Deploy at Scale#
Once satisfied with sample performance:
Structure your code into functions (source code) and scripts
Add logging and output files for reproducibility
Run the job on KLC — see Launching Jobs
Code Structure Best Practices#
project/
├── src/ ← Core functions (reusable, testable)
├── scripts/ ← Scripts that compose functions; include runtime tests
├── tests/ ← Unit tests
└── output/ ← Logs and results (never modify; treat as artifacts)
Keep functions in
src/; compose them in scriptsScripts should generate logs
All code goes in version control (git)
Save outputs; never modify them after the fact
Takeaways#
Selecting a model
Closed-source APIs are easiest and most capable; open-source gives privacy and reproducibility
Document the exact model version used (e.g.,
gpt-4o-2024-08-06)
Development workflow
Identify dataset → engineer prompt → evaluate sample → deploy at scale
Structuring and testing code
Separate source functions from scripts; add unit tests and logs
Put everything in version control