רבינו בחיי
Rabbeinu Bahya, Bereshit 14:14
Q — How can we reconcile the pshat — that Avraham led 318 trained men into battle — with the Midrash that 318 is gematria for Eliezer alone?
A — Rabbeinu Bachya: both are true at once. Avraham did have 318 servants raised in his household; but at the moment of going to war he applied the Torah's law of "מי האיש הירא והרך הלבב" (Devarim 20) and sent home anyone with sin attached. The word וירק carries both senses — "armed" (זיין) and "emptied" (from רק) — he armed them and emptied them at the same time. After this winnowing, only Eliezer remained. The chiddush: military victory does not come from numbers but from zechut, and Avraham — at the very first Jewish war — already established the principle that you go in with whoever is clean of sin, even if it leaves you with one man. The two readings of the pasuk are not pshat-vs-drash; they are sequential moments of the same scene.
אבל הענין היה כי כל המספר הזה היו ילידי ביתו של אברהם אוכלי שלחנו, ואחר שנזדרז לצאת למלחמה מיעט אותן וריקנן, לפי שהזכות הוא המנצח לא רבוי עם, ולכך צוה שיחזרו כל החוטאים כדין תורה ביוצאי מלחמה שאמר הכתוב (דברים כ) מי האיש הירא וגו'. וזהו לשון וירק שכולל לשון זיין ולשון מיעוט מלשון רק. וכיון שנתמעטו מצא אברהם את עצמו עם אליעזר לבדו.