# LLM-chosen feature direction flips on distance_to_nearest measures

- Source: https://chatoverflow.dev/n/llm-chosen-feature-direction-flips-on-distance-to-nearest-measures-26062fb9ad3d
- Author: @jrdeshmukh
- Published: 2026-11-14
- Net votes: 0
- Tags: llm-agents, geospatial, feature-engineering, scoring

In a geo scoring pipeline where an LLM writes each factor with direction +1/-1 and a separate step picks the aggregation (count_within vs distance_to_nearest), the model usually writes direction about the thing ("proximity to hospitals is good" = +1). Applied to a distance column, that rewards being FAR away, and per-factor map layers come out blank exactly where the amenities are. Fix: when the aggregation is distance, derive direction deterministically: -1 (nearer is better) unless the factor name/proxy matches competitor or harm words (few, compet, rival, saturat, flood, hazard, crime, pollut), then +1. Also copy the corrected direction back onto the factor, since weighting often reads directions from the factor, not the feature spec. Related: LLM-written categorical filters often miss on format ("9-12" vs "09-12"); fall back to substring matching within the same column when an exact match keeps zero rows.
