Research
Optimal Meal Schedule for a Local Nonprofit Using LLM-Aided Data Extraction
Overview Research area: Applied data science for social good — combining large language model (LLM) text embeddings, PDF data extraction, and binary integer programming to support a food-insecurity no
- arXiv
- 2511.18483
- Published
- 2025-11-23
- Authors
- Sergio Marin, Nhu Nguyen, Max, Zheng, Christina M. Weaver
AI summary
Overview
- Research area: Applied data science for social good — combining large language model (LLM) text embeddings, PDF data extraction, and binary integer programming to support a food-insecurity nonprofit's meal planning.
- Technical level: Intermediate. The individual components (sentence embeddings, cosine similarity, linear/integer programming) are accessible to readers with basic data-science exposure, but the paper moves quickly through the mathematical formulation.
- Scope (one sentence): The paper describes an end-to-end pipeline that digitized 157 recipes from the Power Packs Project (PPP), mapped their ingredients to a nutritional database using LLM embeddings, predicted recipe costs from historical invoices, and used binary integer programming to select a cost-minimizing 15-week recipe schedule, all delivered through a searchable web platform.
What This Paper Is About
The Power Packs Project is a Lancaster, Pennsylvania nonprofit that distributed an average of more than 14,000 meals per week in the 2024–25 academic year to families with school-aged children, but it operates with a small paid staff and a large volunteer base. Its recipe archive existed only as Microsoft Word and PDF documents, with no structured nutritional or cost information attached, and unpredictable donations plus inflation made it hard to anticipate what any given recipe would cost. The authors' goal was to build a pipeline that digitizes that archive, attaches nutrition and predicted cost data to every recipe, and then uses optimization to recommend a nutritionally adequate, low-cost schedule of recipes for the first half of an upcoming academic year.
Key Contributions
- A digitized recipe and nutrition database. The authors compiled 157 PPP recipes distributed from academic years 2019–2020 through 2024–2025, extracted 866 ingredient strings from Word and PDF sources (using OCR when PDFs were not selectable), and mapped them to nutritional values from the My Food Data (MFD) database.
- An LLM-based two-stage string-matching procedure. Using the all-MiniLM-L6-v2 model from the SentenceTransformers library, ingredient strings were encoded into a 384-dimensional vector space and compared to more than 13,000 MFD entries by cosine similarity, with human review at two decision points.
- A cost-prediction model built from real invoices. Historical pricing data from four vendors was used to estimate the probability an ingredient is purchased for free, its average historical unit price, and a category-specific inflation factor, producing a predicted cost for each recipe.
- An optimization model and deployed web platform. A binary integer program selected 15 recipes minimizing projected cost subject to protein, calcium, fat, and protein-category constraints, and the whole database was exposed through a searchable public web application.
Main Findings
- Ingredient matching worked well in one pass: 87% of the 866 ingredients received a valid match against MFD entries in the first string-matching stage; the remaining 13% required the second stage, and a small number required a manual search.
- Semantic similarity can mislead: in the illustrative example, "Goat Milk" had the highest cosine similarity (0.82) to the recipe ingredient "Milk," even though "Whole Milk" would be the better manual match. A second example, "Seasoning Mix Dry Sazon Coriander & Annatto," had a similarity score of 0.436 — the lowest of its top three candidates — yet was judged the best match for "Adobo Seasoning."
- Nutritional profiles differ systematically by protein category: beef recipes showed the highest median cholesterol and sodium, vegetarian recipes the lowest; vegetarian recipes showed the highest average carbohydrate content. A Macaroni and Cheese recipe appeared as an outlier in both the fat-versus-calories and protein-versus-calcium plots.
- Costs vary widely and unpredictably: canned salmon was consistently free, while white rice and pinto beans were frequently used but only occasionally free, and plantains were purchased only rarely. Beef recipes had the highest median predicted cost and variability, followed closely by seafood and poultry, with vegetarian meals cheapest.
- Inflation effects are projected to be mixed: the authors predict modest increases for most recipes, but with their current inflation estimates they expect prices for about 30% of recipes to decrease — largely because the vegetable inflation factor in their table is negative (-2.5).
- The optimized plan met all constraints: the 15-week schedule had a total estimated cost of $25.05 per 4-person family, with cumulative nutritional content of 512.5 g protein, 6518.3 mg calcium, and 385.5 g fat (mean values of 34.17 g, 434.55 mg, and 25.7 g per serving respectively). It included at least 3 and no more than 4 recipes from each of the four protein categories.
Methodology in Plain English
The team worked in Python 3.12.5 and RStudio 4.4.2 and proceeded in stages.
First, they read recipe text out of Word files and PDFs, falling back on optical character recognition when text was not selectable, and manually reviewed the extracted ingredient lists for errors. Each recipe was assigned to one of four categories based on its protein: beef, poultry, seafood, or vegetarian.
Second, they linked each ingredient string to the My Food Data nutritional database. A pretrained language model turned each string — both the PPP ingredient and each MFD entry — into a list of 384 numbers representing its meaning, and similarity between two strings was measured as the cosine of the angle between those vectors. Every ingredient was first matched to its highest-similarity MFD entry; if a human judged that match unsuitable, the next four best candidates were inspected, and if none of the five worked, a manual database search was performed. Because MFD reports nutrition per 100 g and recipes use household units like cups, ounces, and cans, the authors grouped similar ingredients and applied manual conversion factors, then summed per-ingredient values to get per-serving nutrition for each recipe. The specific nutrients tracked (calories, protein, fiber, carbohydrates, fat, saturated fat, calcium, iron, magnesium, vitamin C, zinc, cholesterol, sodium, folate, and vitamins B6 and B12) were chosen in consultation with a dietitian.
Third, they built a pricing database from historical vendor invoice PDFs from the Central Pennsylvania Food Bank, the Restaurant Store, and two local produce wholesalers — one year of data (2024–25) from all sources plus three additional years (2021–24) from the Central PA Food Bank. Each ingredient was matched by hand to pricing entries. Predicted cost for an ingredient combined three factors: the probability PPP actually buys it (times purchased divided by times ordered), its average historical unit price, and a category-specific inflation factor drawn from external sources.
Fourth, they framed recipe selection as a binary integer program: choose exactly 15 recipes (out of 157) that minimize total predicted cost while keeping average protein at or above 15 g and average calcium at or above 433.33 mg, keeping average fat at or below 30 g, and drawing 3 to 4 recipes from each protein category. The protein and calcium bounds correspond to one-third of the USDA daily intake recommendation for 14–18 year-olds, and the fat bound to half of 60 g. Finally, they deployed a searchable web application so PPP staff can browse recipes by ingredient or category or view the optimized plan.
Why This Matters
Impact on research. The paper is a case study in applying off-the-shelf LLM embeddings to messy, domain-specific text matching rather than training a bespoke model — the authors note their approach was much quicker than training their own language model. It also demonstrates that classical operations-research techniques like binary integer programming can be adapted from fixed institutional settings (schools, nursing homes) to a resource-constrained nonprofit where donation patterns make costs genuinely uncertain.
Real-world applications:
- Nonprofits and food banks with unstructured recipe or inventory archives can reuse the extraction-and-matching pipeline to attach nutrition and cost data to their own materials.
- School districts and senior meal programs with more stable inputs could apply the same optimization formulation to generate lower-cost menus.
- Community organizations can use the cost-prediction structure — purchase probability times average price times an inflation factor — as a lightweight way to forecast spend under donation uncertainty.
- The deployed web platform pattern (searchable recipe database plus an optimized plan view) is directly transferable to any small organization whose staff need fast answers rather than reports.
Industry relevance. Food manufacturers, grocery retailers, institutional food service, and meal-kit companies all face the same underlying problem: matching unstructured recipe or product text to standardized nutrition and pricing data, then optimizing selections under cost and nutrition constraints. The paper's emphasis on modularity — the pipeline is structured so new recipes or updated cost data can be dropped in — reflects a practical engineering mindset that matters more in production than peak benchmark performance.
Future Directions
- Regression-based price prediction. The authors explicitly note they did not use regression because the historical invoice record was too shallow; this becomes feasible as more years of data accumulate.
- Scenario and uncertainty modeling. Costs currently rely on general inflation estimates and are described as inherently uncertain. The authors propose incorporating plausible inflation scenarios into a Monte Carlo framework to produce better average cost estimates, including confidence intervals. Their model's dependence on a projected decline in vegetable prices is called out as a specific vulnerability.
- Retail-cost and preference-aware optimization. Future work could model the retail cost families would pay to prepare these meals themselves and optimize wholesale and retail costs jointly as a multi-objective problem, and could incorporate user meal-preference survey data into recipe selection.
- Deeper operational integration. The website is being expanded with dynamically generated nutritional summaries, estimated cost breakdowns, and interactive price-trend visualizations, with longer-term ambitions to incorporate real-time warehouse data such as product quantities, expiration dates, and unit costs.
- Open questions the paper leaves unaddressed. The paper does not report a comparison of the optimized schedule against PPP's existing recipe choices, any statistical evaluation of cost savings, any confidence intervals on the $25.05 figure, or any usability evaluation of the web platform with PPP staff.
Target Audience
This paper is most useful to applied data scientists and operations researchers interested in social-impact applications, nonprofit operations staff and food-bank administrators who want a concrete template for digitizing their own recipe and cost data, and instructors looking for a realistic end-to-end case study that combines LLM embeddings, PDF extraction, and integer programming in a single project. Readers seeking methodological novelty in either language modeling or optimization will find the individual techniques standard; the contribution lies in their integration and deployment in a live nonprofit workflow.
Authors’ abstract
We present a data-driven pipeline developed in collaboration with the Power Packs Project, a nonprofit addressing food insecurity in local communities. The system integrates data extraction from PDFs, large language models for ingredient standardization, and binary integer programming to generate a 15-week recipe schedule that minimizes projected wholesale costs while meeting nutritional constraints. All 157 recipes were mapped to a nutritional database and assigned estimated and predicted costs using historical invoice data and category-specific inflation adjustments. The model effectively handles real-world price volatility and is structured for easy updates as new recipes or cost data become available. Optimization results show that constraint-based selection yields nutritionally balanced and cost-efficient plans under uncertainty. To facilitate real-time decision-making, we deployed a searchable web platform that integrates analytical models into daily operations by enabling staff to explore recipes by ingredient, category, or through an optimized meal plan.