Code computing a daily feeding range of 8 to 9 oz for a 35 lb neutered adult dog, with a dog beside a food bowl

How Much to Feed a Dog: Why Our AI Computes It in Code

TL;DR: A healthy, neutered 35 lb adult dog needs about 780 to 890 kcal a day, roughly 8 to 9 ounces of typical dry food. Our AI assistant, EverWiz, now calculates that range in code instead of asking the language model to do the maths, because prompting alone either left the amount out or overfed by more than 50%.

When an owner asks EverWiz, our dog-care assistant, how much to feed their dog, the daily portion is now computed deterministically in code before the language model is ever called. The model’s sole responsibility is to explain that output clearly.

We moved calculation out of the prompt because prompt engineering could not make arithmetic reliable. Across 3 iterative prompt versions evaluated against a fixed benchmark, a neutered 35 lb adult dog (medium-sized by adult body weight), the assistant omitted a daily portion intermittently, and a stricter revision substituted a generic body-weight percentage heuristic that overfed the dog by more than 50%. Moving the calculation into application code removed that variance entirely, returning a consistent 8 to 9 ounces of dry food per day on every run.

The broader architectural lesson extends well beyond pet nutrition: any rule that must hold in production belongs in deterministic code, while the model is constrained to reasoning over and explaining verified facts.

The short version

  • Incomplete context. Onboarding captured a dog’s life-stage bracket, but that detail was never passed into the assistant’s context, leaving the model blind to age for most pets.
  • Deterministic computation. Resting energy and life-stage scaling are now calculated in code prior to inference, passing a bounded daily range into the prompt rather than asking the model to do math.
  • Explicit refusals. Missing critical inputs, such as unknown age, non-canine species, or clinical dietary conditions, cause the calculator to return nothing rather than risk a plausible-sounding wrong number.
  • Code-controlled state updates. When an owner supplies a fresh weight in conversation, deterministic parsers validate and persist it, and the model receives explicit confirmation of whether the write succeeded.

Why did EverWiz give inconsistent feeding answers?

Every EverWiz response begins with a structured profile summary injected into the prompt context, built the way we describe in dynamic prompt construction. When we audited why feeding guidance varied so widely, we found 2 foundational data gaps.

First, age was frequently absent. Our onboarding flow asks owners to select a life-stage bracket rather than enter an exact birth date, as many owners do not know their dog’s birthday. Although the bracket was persisted in our data layer, it was never mapped into the assistant’s runtime profile. We already derive life stages from birth dates elsewhere in the system; updating the profile builder to prioritize the explicit bracket and fall back to date-of-birth derivation resolved the blind spot immediately.

Second, neuter status, one of the primary drivers of canine metabolic demand, was omitted or ambiguous. We normalized the context contract so neuter status is passed strictly as a confirmed binary signal, omitting the field entirely when unknown rather than passing placeholder strings that invite model guesswork.

Why can’t prompt tuning fix LLM arithmetic?

Once the profile payload included age and neuter status, answers covering exercise, joint care and training improved immediately. Feeding quantities did not.

Testing successive prompt revisions against fixed scenarios on our production model exposed a fundamental limitation: language models generate tokens that resemble arithmetic rather than executing deterministic math. Tightening prompt instructions actually reduced consistency, and in one iteration the model abandoned metabolic scaling altogether in favor of a flat body-weight percentage rule. For a 35 lb neutered adult, that shortcut produced 8.5 to 14 ounces per day against an expected 8 to 9, overfeeding by more than 50% at the upper bound.

A plausible-looking number that fails silently is worse than no number at all when an owner measures it into a bowl twice a day. Just as structured outputs still require an external validation layer, domain calculations that carry real-world consequences cannot rely on prompt compliance. The same conclusion recurs across our posts on LLM engineering.

How we compute a dog’s daily portion in code

Rather than asking the model to apply veterinary energy equations, we compute the daily maintenance range ahead of inference using standard resting energy requirements scaled by life stage and neuter status, following the approach in the WSAVA Global Nutrition Guidelines and the Ohio State calorie calculator, converted into dry-food portions.

def compute_daily_feeding_range(weight_lb, life_stage, neutered, species):
    """Compute a bounded daily dry-food range before LLM inference."""
    if species != "dog" or not weight_lb or weight_lb <= 0 or not life_stage:
        return None  # Refuse rather than guess a missing critical input
    rer_kcal = calculate_resting_energy(weight_lb)
    low_factor, high_factor = get_metabolic_factors(life_stage, neutered)
    return format_portion_range(
        min_kcal=rer_kcal * low_factor,
        max_kcal=rer_kcal * high_factor,
    )

For a 35 lb neutered adult, resting energy is roughly 557 kcal. Multiplied by a neutered-adult factor of 1.4 to 1.6, that gives a daily maintenance requirement of 780 to 890 kcal, or 8 to 9 ounces of typical dry food at about 3.5 kcal per gram. Returning a bounded range rather than a single point estimate is deliberate: activity levels and kibble caloric density vary across brands, and a single figure would imply false precision.

Just as critical as the formula is deciding when the system must refuse to answer:

  • Unknown life stage. Returns nothing. Because growing puppies require substantially more energy per pound than adults, guessing an adult baseline risks severe underfeeding.
  • Non-canine species. Returns nothing. Canine metabolic scaling factors do not transfer safely to other species.
  • Clinical or weight-management cases. Defers entirely to a veterinarian. Maintenance equations apply only to healthy dogs, and presenting a baseline calculation as a therapeutic diet is a safety failure.
Three cases where the feeding calculator refuses: age unknown returns nothing, not a dog returns nothing, and ill, pregnant or on a weight plan defers to the vet

The same thinking runs through the anatomy of an LLM guardrail: decide in code what the model is never allowed to say.

With the range pre-computed, the prompt’s responsibility narrows cleanly: state the daily range, clarify that it is split across meals, note the baseline energy-density assumption, and direct the owner to verify against their specific food packaging. This is the same split we described in lessons from building personalized LLM experiences: facts are resolved in code, and the model writes around them.

Summary card: a neutered 35 lb adult gets 8 to 9 oz per day, the same range every run, computed from resting energy times a life-stage factor

Guarding against stale inputs in fast-changing states

A calculation is only as trustworthy as the freshness of its inputs. For an adult dog, a weight recorded some months earlier remains serviceable; for a growing puppy, a weight of similar age is dangerously obsolete.

Our initial attempt delegated staleness judgment to the prompt by passing both the weight and its recorded timestamp alongside instructions to withhold portions if the reading was old. Whenever a pre-computed range was present in context, the model surfaced it anyway.

We moved staleness enforcement into code. When a puppy’s weight exceeds our freshness threshold or lacks a valid timestamp, the calculator withholds the standard daily range and instead surfaces a staleness flag alongside a conservative baseline floor. The assistant then asks the owner for a current weight, suggesting a simple home scale method, and falls back to the conservative baseline only if the owner cannot weigh the dog immediately.

Implementing this cleanly also surfaced a data-ownership bug during code review: weight values lived on the pet record while timestamps were tracked on a separate health record, allowing newly onboarded weights to remain undated or inherit stale timestamps. Co-locating the timestamp directly on the weight mutation path ensured every reading carries its own authoritative date.

Deterministic state mutations from conversation

When the assistant asks an owner for a current weight, the reply represents the freshest data we have. Allowing an LLM to interpret free-form chat and mutate profile state directly, however, introduces silent corruption, especially when users reply with historical weights, combined human-plus-pet scale readings, or unitless numbers.

All conversational weight extraction now runs through strict, deterministic parsing rules outside the model:

  • Turn-scoped intent. Extraction triggers only when the immediately preceding assistant turn explicitly requested a weight.
  • Explicit units and single-value clarity. Messages must contain a single numeric value paired with an explicit unit, eliminating unit-ambiguity errors.
  • Temporal and plausibility guards. Historical phrasing and out-of-bounds readings, including unsubtracted human-and-pet scale totals, are rejected before persistence.

The specific bounds stay out of this post on purpose. A validation rule that rejects implausible input is only useful while the people supplying that input do not know exactly where the edges sit.

Equally important, the persistence outcome is passed back into the model’s context on the subsequent turn. During testing, when an owner replied “I can’t weigh her right now,” the ungrounded model occasionally produced “Got it, I’ve saved her updated weight.” Passing an explicit save status removed those false confirmations and ensured chat and the pet profile read from a single source of truth. We verify behaviors like these with synthetic conversations as regression tests before each prompt change ships.

What this means for EverBowl

EverBowl™ learns what a dog actually eats, meal by meal. A daily range derived from that dog’s own weight, life stage and neuter status gives the record a reference point that fits the animal rather than a generic figure from a breed chart, and it means conversational guidance and the meals EverBowl recognizes reason from the same dated, validated profile. Our post on the post-meal window as a health signal shows why that record matters, and how we turn a day of bowl events into one trustworthy paragraph shows how it reaches owners.

The honest limit: the baseline assumes a typical dry kibble energy density and applies strictly to healthy maintenance, so the chart on the bag is the final check and medical or weight-loss nutrition belongs with a veterinarian. EverBowl does not diagnose; the value is the record.

Practical limits and takeaways

Three engineering principles from this work apply to any production LLM system.

  • Keep invariants in code. Never ask a probabilistic model to perform arithmetic, enforce freshness thresholds, or apply safety exclusions that can be expressed deterministically.
  • Design refusals explicitly. A calculator that always returns a number has no way to signal missing context; returning nothing on ambiguous inputs prevents confident errors.
  • Ground state mutations in both directions. Validate user inputs outside the model before writing to storage, and feed the exact persistence result back into context so the model cannot claim a side effect that did not happen.

FAQs

How much should I feed my dog per day?

A healthy, neutered 35 lb adult dog needs about 780 to 890 kcal a day, roughly 8 to 9 ounces of typical dry food. Veterinary nutrition guidelines typically start from resting energy requirements, published as 70 times body weight in kilograms to the power 0.75, multiplied by a life-stage and neuter-status factor, then divided by your food’s caloric density. Because kibble formulations and activity levels vary, treat any baseline calculation as a starting range and confirm portions with your food bag’s feeding chart and your veterinarian.

Why not let the AI model calculate the feeding amount?

In our benchmarks, prompt-based arithmetic was inconsistent across versions and occasionally substituted rough body-weight percentages that overfed by more than 50%. Computing the range in code guarantees deterministic accuracy on every run while letting the language model focus on clear explanation.

How often should I reweigh a puppy?

Puppies grow rapidly enough that weights become outdated within weeks. Reweighing regularly, such as stepping on a home scale while holding your puppy and subtracting your own weight, ensures feeding estimates reflect current growth rather than an outdated baseline.

Why does EverWiz refuse to give an amount when it does not know my dog’s age?

Growing puppies require significantly more energy per pound than adult dogs. Without a confirmed life stage or birth date, providing an adult baseline risks underfeeding a puppy, so the assistant asks for the missing profile detail first.

References