Brownfield AI
How do you build an AI recommendation engine?
The most useful recommendation is often the missing piece, not more of the same.
Short answer
You build an AI recommendation engine by first defining what a good recommendation means for your users, then fixing the data so the signals that matter exist, then generating candidates, scoring them and re-ranking them from one shared index that also serves search. Measure every change against a labeled baseline. In most established products, the data work decides the result more than the choice of model.
On this page
01Define what a good recommendation is
Teams often start by choosing an algorithm. We start by asking what a user should do after seeing a recommendation, because that decides what good looks like. This is part of our larger guide, AI integration for SaaS: add AI without a rebuild.
On a collaboration product, the answer is often surprising. On a social music collaboration app with over a million users, musicians record multi-track songs and others add their own parts. Finding the right collaborators is the core loop, and the client tied search directly to retention. The most useful recommendation for a track that already has vocals and guitar is not another vocal track. It is a drummer. That is a complementary recommendation: it fills the missing role rather than repeating what is there.
Other products need different definitions:
- A marketplace may want items similar to what the user just viewed.
- A nutrition product may want foods that fit the user's plan and history.
- A B2B workflow product may want the next action that similar accounts took.
Write the definition down with an example of a good result and a bad one. It becomes the basis of your test set later.
02Fix the data before the model
Most recommendation problems in established products are data problems in disguise. On the music app, about a third of the example searches asked for an instrument or role, such as piano, drummer, guitar or vocalist, that no field in the data held. Declared genres were often wrong. No ranking model can recommend a drummer if nothing in the data says which tracks have drums.
So we treated it as a data problem first. Instead of tuning ranking on unreliable metadata, the prototype listened to the audio. A contrastive language-audio model, CLAP, places audio and text in the same space, so a phrase like solo piano can be scored against a track without training a separate classifier for each instrument. A signal processing library added cheap, explainable rhythm and energy features. On a sample of real tracks, the audio model recovered what tracks actually were where the declared genres were wrong.
The same principle held years earlier for a food discovery and nutrition startup we worked with. Menu items had branded names, recipe names were personalized, and ingredient lines mixed quantity, unit, item and preparation in one string. Nothing linked ingredients to recipes or recipes to menu items. We cleaned and normalized first, then linked the records, and only then built recommendations on top. Nutrition values came from the linked recipe and ingredient data, never from a model.
03Use one index for search and recommendations
A common mistake is to build recommendations as a separate system from search. The two then disagree: search says a track is piano, recommendations treat it as rock, and users stop trusting both.

The design we proposed for the music app writes every signal, from metadata and from audio, into one index that serves both search and recommendations. The complementary-role recommendation matches the missing role by sound, from the same index that answers a search for drummers, so the two never disagree. Personalization nudges the order of results but does not override intent: a drummer search still returns drummers.
Google's machine learning course on recommendation systems describes the usual structure in three stages, and it maps well onto a shared index.
| Stage | What it does | What to watch |
|---|---|---|
| Candidate generation | Pulls a few hundred plausible items from the index | Coverage: are good items reachable at all |
| Scoring | Ranks candidates by predicted usefulness | Whether the score reflects your definition of good |
| Re-ranking | Applies business rules, diversity and freshness | Rules that hide items users need |
| Shared index | Holds every signal used by search and recommendations | Consistency between search results and recommendations |
| Evaluation set | Labeled examples of good and bad results | Whether each change moves the metrics the right way |
For text and catalog data, hybrid search, which combines keyword matching with vector similarity, is a sensible base for candidate generation. Elastic's documentation describes running both in one request and merging the lists with reciprocal rank fusion.
04Build the AI recommendation engine in steps
This is the order we follow:

- 01
Write the definition of a good recommendation, with examples, and agree it with the product team.
- 02
Audit the data for the signals that definition needs. List which exist, which are unreliable and which are missing.
- 03
Create the missing signals, from content, behavior or both, and write them into the shared index.
- 04
Start with simple, testable rules for parsing what users ask for. A language model can take over messier input later and emit the same signals.
- 05
Build candidate generation, scoring and re-ranking on that index.
- 06
Label a baseline set and measure ranking quality, for example precision and nDCG at the top five results, before and after each change.
- 07
Release to a subset first, such as the most discoverable part of the catalog, and widen as the metrics hold.
On the food platform, recommendations combined two methods: collaborative filtering through matrix factorization, which learns from what similar users chose, and content-based filtering, which matches on the food itself. Running them on a graph database made it quick to explore relationships between users, foods and nutrition. Combining the two helps with new items and new users, where behavior data alone is thin.
05What we see in production
On the music collaboration app, the work was a paid test project on the client's real tracks, not a production launch. It produced a reference architecture, notebooks for metadata and audio analysis, and a live demo with prompt search, facets with counts, similarity search and a production design. That design kept everything inside the client's own cloud project, extended the existing GraphQL interface rather than forking it, and ran enrichment as another workload on the client's existing cluster. In an established product, the recommendation engine has to fit the stack that is already running, and the design work to make it fit is a large share of the effort.
That project also showed where the limits are. Detecting drums from full mixes is hard because the parts are not separated, so a visual pass over sampled video frames was proposed as a next step. Musical key was the one signal the open models did not replace cleanly. Being clear about those limits up front kept the plan honest.
The production plan also set a definition of done for the first search release: behind the existing API, with explicit filters, and a measured gain on a labeled query set, judged by precision and nDCG at five instead of a claimed improvement.
For an audience data company, our engineers worked inside the client's own team for about two years, supporting the weblog analytics stack that fed its recommendations: data streaming into Spark and written to Elasticsearch and other stores. The work fitted the environment the client already ran rather than replacing it. Recommendations are only as good as the pipelines that feed them, and those pipelines need steady care long after launch.
Across these projects, the pattern is the same. The model choice mattered less than the signals, the shared index and the test set. For the related question of keeping AI features affordable once usage grows, see how to reduce AI infrastructure cost in production.
Frequently asked questions
Which matters more for recommendations, the model or the data?
In most established products, the data work decides the result more than the choice of model. On a music collaboration app, about a third of example searches asked for an instrument or role that no field in the data held. No ranking model can recommend a drummer if nothing in the data says which tracks have drums.
Should search and recommendations use separate systems?
No. Built separately, the two disagree: search says a track is piano, recommendations treat it as rock, and users stop trusting both. Write every signal, from metadata and from audio, into one index that serves both. Personalization can nudge the order of results, but it should not override intent.
How do you know a change improved recommendations?
Label a baseline set of good and bad results, based on your written definition of a good recommendation. Measure ranking quality before and after each change, for example precision and nDCG at the top five results. Release to a subset first, such as the most discoverable part of the catalog, and widen as the metrics hold.
How do you handle new items and new users?
Combine methods. On a food platform, recommendations used collaborative filtering through matrix factorization, which learns from what similar users chose, together with content-based filtering, which matches on the food itself. Combining the two helps with new items and new users, where behavior data alone is thin.
How Datics helps
Datics specializes in brownfield AI: bringing production AI into the product you already operate, without forcing a rebuild.
Related work
Case studies from our projects on the same subject.
Social music collaboration app
Marketing & Media · Audio search and discovery
A prototype lets musicians search by instrument, read from the audio itself
No field held instruments, so search could not find a pianist or drummer; our prototype read real tracks and tagged what each one is.
Where Do You Nom
Healthcare & Wellness · Food search and recommendations
Restaurant dishes linked to their recipes, so nutrition comes from ingredient data
Branded dish names linked to nothing, so no dish showed nutrition. Now each menu item reaches its recipe and ingredients.
An audience data company
Data & Analytics · Weblog analytics pipeline
Website logs stream through Spark into Elasticsearch and MySQL, ready for recommendations
An audience data company had website logs streaming in but needed them analyzed and stored for recommendations. We did it on its own stack.
More on Brownfield AI
Brownfield AI
AI integration for SaaS: add AI without a rebuild
AI integration for an existing SaaS product: keep your core as the system of record, reuse your APIs and auth, and ship one AI workflow without a rebuild.
Brownfield AI
Is vibe coding enough for mature SaaS?
Vibe coding in SaaS is fast for prototypes. Mature products need server-side permissions, regression tests, evaluation and review before AI code ships.
Brownfield AI
Entity matching: how do you map supplier data to a catalog?
Entity matching for product data works when you agree on mapping rules first, normalize before you compare, and route uncertain matches to people.
Brownfield AI
AI data integration: connect AI without a new platform
AI data integration without a migration: leave customer data where it lives, give AI governed paths to it, and index only what retrieval really needs.
Brownfield AI
Brownfield vs greenfield: retrofit AI or start fresh?
Brownfield vs greenfield for AI: what a mature SaaS platform has that an AI startup lacks, where legacy code slows it down, and how to move just as fast.
Brownfield AI
AI product strategy: embed AI or launch a separate product?
An AI product strategy for an established SaaS: when to build AI into the product you have, when a separate AI product makes sense, and how to decide.
Your customers already expect AI from your product.
Let us make it real without rebuilding what already works.
