DEV Community

Divyakush Punjabi
Divyakush Punjabi

Posted on

Keeping an LLM app responsive with async and Celery

LLM apps have a UX problem nobody warns you about: the model is slow, and a frozen interface makes users think your app is broken. The fix isn't a faster model — it's an architecture that never makes the user wait on the slow part. That was a core challenge in GovernAI Studio.

Why LLM apps feel sluggish

An inference call can take seconds. If you run it inline — request comes in, block on the model, return the response — the whole experience stalls. The user stares at a spinner, the connection risks timing out, and one slow call can back up everything behind it. In a training simulator where people are working through scenarios, that dead air breaks immersion completely.

The model's latency is fixed. What you control is whether the user's experience is held hostage by it.

Async and Celery to the rescue

GovernAI Studio runs on Django with Celery and a hybrid RAG + LLM inference pipeline. The key move is pushing the heavy, slow work off the request path:

  • Celery for background processing. The expensive inference and retrieval work runs as asynchronous tasks in the background, not inline with the user's request. The web layer stays free to respond.
  • A responsive front end regardless of model speed. Because the slow work is decoupled, the interface stays interactive while the pipeline does its job — the user keeps moving instead of watching a frozen screen.
  • RAG grounding, done off the hot path. Retrieval keeps the scenarios anchored in real governance material, and running it asynchronously means grounding quality doesn't cost you responsiveness.

The general pattern

This isn't specific to LLMs — it's the oldest trick in responsive-system design: get slow, variable-latency work off the path the user is waiting on. Image processing, report generation, third-party API calls, model inference — anything that takes unpredictable time belongs in a background worker with the result delivered when it's ready, not blocking the click that started it.

LLM apps just make the lesson urgent, because the slow part is now central to the product. Building GovernAI Studio drove home that a great AI product is as much about when the work happens as what the model outputs. The full architecture is on the project page.

👉 See the simulator: www.divyakush.com/projects/governai-studio


Divyakush Punjabi — Full-Stack & AI Systems Engineer

🌐 https://www.divyakush.com · 💼 LinkedIn · 💻 GitHub

Top comments (0)