The problem with the original app
The first version of FlavorFuse had two separate searches, one by text and one by nutrition. They were never combined, and both used fixed settings: the top 6 results and a similarity threshold of 0.1.
Validation split, 1,000 queries. The original search compared nutrient proportions, not amounts, and sent blank fields as zero. Replacing it with constraint-based scoring raised nutrition-only NDCG from 0.130 to 0.697.
How FlavorFuse works
Ingredients and nutrition goals each become a score from 0 to 1 for how well a recipe satisfies that part of the request. One weight α trades them off:
score = α · S_ingredients + (1 − α) · S_nutrition
- Read the query. Free-text ingredients, plus optional limits on seven nutrients: a target (within ±20%), a maximum or a minimum.
- Score every recipe twice.
S_ingis TF-IDF matching over cleaned ingredient phrases.S_nutmeasures how well the recipe meets each limit. - Choose α for this query. Two gradient-boosted models read 18 features of the query (feasibility, ingredient-match strength, how the limits look). They predict the relevance and the limit violation each α would give. The system picks the α with the best predicted trade-off.
- Decide how many results to show. A classifier cuts the list where recipes stop being relevant, instead of always showing six.
- Explain the result. Each recipe shows which ingredients it uses and whether it meets each goal. When no recipe meets every goal, a banner says these are the closest matches.
How it was tested
Real users' queries were not available, so queries are simulated from recipes in a held-out split. Train data fits the models, validation data tunes settings, and the test split was run once per suite after every setting was frozen.
Query model
2 to 4 ingredients from a recipe (common staples like salt skipped), a noise ingredient in 20% of queries, and 1 to 3 nutrition limits taken from that recipe with random slack.
Relevance grades
2 for the source recipe. 1 for recipes covering at least 2/3 of the ingredients and meeting every limit. 0 for everything else.
Three suites
Mixed: the real mix of query types. Easy: a recipe meeting every limit exists. Over-constrained: at least one limit is stricter than the source recipe meets.
Statistics
95% bootstrap confidence intervals and paired Wilcoxon tests against each baseline, on the same queries.
Compare the systems
Final test split, 2,000 queries per suite, seed 42. Pick a suite and a metric. The best value in each view is highlighted.
Why adapt α for each query
A single α cannot suit every kind of query. These numbers come from the research README.
| Observation | Value | Split |
|---|---|---|
| Best fixed α on easy queries | 0.6 | validation |
| Best fixed α on over-constrained queries | 0.9 | validation |
| Gain from the best α for every query, chosen in hindsight (oracle) | +0.022 easy, +0.047 over-constrained NDCG | validation |
| Share of the oracle gain the learned α recovers | about a third | validation |
| α = 0.6 tuned on easy queries, scored on mixed / over-constrained | 0.528 / 0.174 | test |
| α = 0.7 tuned on mixed queries, scored on mixed / over-constrained | 0.569 / 0.288 | test |
| Learned α, no tuning to the mix | 0.601 / 0.364 | test |
Statistical comparisons on the test split
| Suite | Learned α compared with | NDCG@10 gain | p-value |
|---|---|---|---|
| Mixed | Fixed α tuned on the same data | +0.032 | 2e-5 |
| Mixed | Hard filter with fallback | +0.084 | 1e-14 |
| Mixed | Original app | +0.217 | 1e-119 |
| Over-constrained | Hard filter with fallback | +0.224 | 1e-125 |
| Over-constrained | Best fixed α | +0.077 | 7e-22 |
On mixed queries the learned α cuts mean constraint violation from 0.715 (original app) to 0.027.
Which query features matter
The learned α was retrained on subsets of its 18 features. The table shows NDCG gain over the best fixed α that is at least as compliant (validation split, 95% confidence interval).
| Features | Gain at λ = 1 | Gain at λ = 4 |
|---|---|---|
| All 18 | +0.034 [0.021, 0.046] | +0.048 [0.035, 0.061] |
| Without feasibility | +0.030 [0.018, 0.043] | +0.041 [0.028, 0.055] |
| Without ingredient features | +0.023 [0.011, 0.034] | +0.024 [0.012, 0.036] |
| Without nutrition features | +0.024 [0.014, 0.036] | +0.014 [0.002, 0.025] |
| Only feasibility (2) | +0.012 [0.006, 0.018] | +0.018 [0.007, 0.028] |
| No features (α only) | 0 | 0 |
No single group carries the gain. Feasibility alone gives little, which is why the model uses all three groups. Many intervals overlap, so this shows which parts matter, not a ranking.
Choosing how many recipes to show
On validation data (897 mixed queries with ingredients), the learned cutoff showed 0.5 to 0.8 more relevant recipes per query than the best fixed rule at the same number of irrelevant ones, at every cost setting tested (p < 1e-4). At a mid cost setting it showed 4.2 recipes on average, 2.2 of them relevant. This is a validation result and has not been run on the test split.
What the evidence supports
| Claim | Status |
|---|---|
| One unified ranking beats the two separate searches | Supported validation and test |
| Query-adaptive α beats fixed α | Supported test split, mixed and over-constrained suites |
| Adaptive list size | Supported validation only, not yet on test |
| Adaptive diversity re-ranking (MMR) | Not supported no better than a fixed weight |
| Gain on easy queries over hard filtering | Not supported tied: 0.701 vs 0.703 |
| Feasibility alone as the signal for α | Weak little gain without the other features |
| Results hold for real users | Not yet tested human study built, no results yet |
The app
The research ranker is live in the web app behind POST /recommend/hybrid.
Search
One box takes ingredients or a dish name. Nutrition goals are optional: pick a quick goal like low calorie or high protein, or set a limit per nutrient.
Explained results
Every recipe shows the ingredients you have, each goal with the recipe's value and whether it is met, and the α the search chose.
Saved recipes and accounts
Sign up, log in, and save recipes with the heart button. Accounts run on a separate Node and Express server.
Admin page
Add, edit, search and delete recipes and manage users. Changes reach the recommender within about 30 seconds without a restart.
| Part | Built with |
|---|---|
| Web app | React, Vite, Tailwind |
| Recipe API and recommender | FastAPI, scikit-learn, NumPy, SciPy |
| Account server | Node, Express |
| Data | MongoDB, 45,630 recipes |
Requests take about 0.1 s once the index is built, which takes about 25 s after the server starts.
Limits
- Queries are simulated from recipes, so they are more recipe-shaped than real user queries.
- Relevance labels use lexical ingredient matching, which favours lexical retrieval. Hit@10 and MRR on the source recipe are free of this bias.
- On over-constrained queries the learned α returns the dish the user asked for even when it breaks a limit. Compliance is lower than hard filtering (0.704 vs 0.936 compliant@10). The original app scores higher on NDCG there only because it ignores limits entirely (mean violation 0.716).
- One dataset of 45,630 recipes, with no comparison against collaborative or neural recommenders.
- The adaptive list size and the feature ablation are evaluated on validation data only.
- A human rating study is built to check the labels against real people. It has no results yet.
- Ingredient cleaning is rule-based and imperfect.
Reproduce it
Every number comes from fixed seeds and committed settings.
cd backend/research
pip install -r requirements.txt
python -m unittest discover tests # 47 tests
python run_experiments.py --split test --n 2000 --suite mixed # headline table
The full protocol, all 22 findings and the tuning procedure are in the research README. The source is on GitHub.




