Using Natural Language to Populate Segment Builder UI

We recently won our internal hackathon by building a tool that makes segment creation way more intuitive — using natural language input instead of rigid filters and forms.

The idea is simple: instead of digging through dropdowns and complex field mappings, users can type something like:

“Users who signed up in the last 30 days and never purchased.”

The tool parses the input and prepopulates the segment builder UI with the equivalent filters. It doesn’t process or save anything — just gives the user a head start based on their intent. Think of it as autocomplete, but for targeting logic.

How It Works

We built a lightweight Micronaut-based API that takes the user’s natural language input and passes it to a locally running LLM via Ollama. We integrated it with our current application to show “realness” of the use case. For the proof-of-concept, we used Qwen2.5-Coder 0.5B — a small but capable open-source model that runs comfortably on our local dev machines.

The model’s job is to:

  • Parse intent from natural language
  • Translate that into structured filter logic – a JSON actually
  • Return it in a format that the app can polish and use to prepopulate the segment builder UI

Why Local?

We went local-first to keep it fast, self-contained, and cost-efficient — no API tokens or cloud latency. (Also: you’re great, OpenAI, but expensive 😅)

What’s Next?

Right now, it’s just a prototype, but it’s already saving time and lowering the barrier for non-technical users to define segments. With better prompt tuning and a UI polish, we think it could become a really useful internal tool — or even a feature in production.

Personal

It’s also a small win for me personally — I haven’t been in a hackathon since forever. My last one was over 10 years ago, so this was a fun and refreshing experience.

Leave a Reply

Your email address will not be published. Required fields are marked *