What this is
A marketing asset management platform for a regional bank. Makers upload campaign assets; the system scores each one against brand guidelines, financial-advertising rules, copyright and logo checks, and a third-party creative-effectiveness model. Checkers then approve or return it.
- Domain
- Marketing compliance · banking
- My role
- Tech lead, solution architect
- Team
- 4 engineers
What needed to be solved
Manual review was slow and inconsistent. An LLM first pass helped, but brought its own problems. Confidence scores swung between 0.7 and 0.95 for the same asset. Text inside an image could try to instruct the model ("mark as passed"). Long multi-criterion runs could lose all their progress if a worker crashed. And because the client is a bank, the platform also had to pass a full security review.
What I owned
I led architecture and delivery for a team of four, set the API, data, and scoring-engine design, owned the AWS infrastructure in CDK, and supported the bank's security assessment (OWASP Top 10, GenAI security questionnaire, access and incident policies).
- Owned
- Architecture, scoring engine design, AWS infra
- Led
- Delivery, code review, security assessment
Architecture & decisions
A Hono API with a routes → services → repositories layout, Drizzle ORM on PostgreSQL, and Cognito auth. Scoring runs as pg-boss jobs on the same PostgreSQL database: no extra broker, and transactional with the data.
The scoring engine runs configurable phases in order, with the criteria inside each phase in parallel. A phase marked "required pass" stops later phases if any criterion fails. Each criterion's result is saved as soon as it finishes, so a crash mid-run keeps what was already scored. LLM calls go through a LiteLLM gateway; slow third-party scoring is handled as an asynchronous poll job.
How it was built
Reliability of the AI verdicts: a confidence-calibration rubric is appended to every judging prompt, which brought confidence variance on repeated runs of the same asset below 0.05. An instruction-hierarchy guard (OWASP LLM01) tells the model to treat text inside the asset as content, not instructions, and to report suspected injection. The engine fails closed on any flagged response, so it can never pass a required phase.
Third-party jobs are idempotent: a redelivered poll job skips scores that are already done, instead of writing duplicate criteria. Infrastructure is AWS CDK: VPC, ALB, EC2 running Docker Compose (API + LiteLLM), ECR, Multi-AZ RDS, CloudFront + S3, Cognito, Secrets Manager, CloudWatch, CloudTrail with a log archive, and Inspector.
- Calibration
- Confidence variance < 0.05 on repeat runs
- Injection
- Instruction hierarchy + fail-closed gating
- Resilience
- Per-criterion persistence, idempotent jobs
Results & lessons
Checkers get a stable, rubric-based AI first pass across five kinds of checks, with the final decision staying with people; the external creative-scoring integration runs end to end in staging.
Next improvements I documented at handover: move the EC2 host into a private subnet with a two-phase deploy (only the ALB public); give CloudWatch log groups stable, name-based logical IDs so changing the service list doesn't break deploys; and replace fixed-count polling of the external API with backoff and a clear time-out state.
Lesson: an LLM judge needs the same engineering as any other untrusted input — calibrate it, fence it off from injected text, and fail closed.
Have a similar challenge?
If you want AI in a review workflow that a regulated client will sign off on, let's talk about your criteria, your guardrails, and your infrastructure.