Stop Using an LLM Hammer
for a Thumbtack Problem
Defaulting to 70B+ parameter generative LLMs for entity extraction, string distance, graph routing, or click prediction wastes millions in API bills, adds seconds of latency, and introduces hallucination risks. Master the targeted, specialized, and classical algorithms that execute in 2ms, cost $0, and run deterministically.
Pillars
P99 SLA
API Overhead
Deterministic
PageRank
Iterative Random Walk Stationary Distribution for Graph Node Centrality
Prompting an LLM with raw JSON graph edge lists to determine the top authoritative nodes in a 50,000-node network.
Dijkstra's Algorithm
Optimal Single-Source Shortest Path for Non-Negative Weighted Graphs
Asking an LLM agent to find the lowest-latency API hop sequence or shortest road network delivery route across 2,000 nodes.
A* Search Algorithm
Heuristic-Guided Optimal Pathfinding with Admissible Evaluation Functions
Using an LLM to navigate a 2D/3D robotics spatial grid to plan obstacle-avoidance trajectory.
Bellman-Ford Algorithm
Shortest Paths with Negative Edge Weights & Negative Cycle Detection
Prompting an LLM to scan a currency exchange FX table to detect triangular arbitrage opportunities.
Cosine Similarity & Angular Distance
Orientation-Invariant Proximity for High-Dimensional Sparse & Dense Vectors
Sending pairs of document embeddings or text paragraphs to an LLM asking: "Rate how semantically similar these two passages are from 0 to 1".
Euclidean (L2) & Manhattan (L1) Distance
Geometric Norms, Minkowski Generalization & The Curse of Dimensionality
Asking an LLM to cluster or find the nearest physical warehouse to a customer coordinate.
Levenshtein & Edit Distance
Dynamic Programming Matrix for String Alignment, Typo Tolerance & Spell Correction
Calling an LLM API to check if a user input "anand" matches database entry "annand" or "anandm".
Jaccard Index & Hamming Distance
Set Overlap & Bitwise XOR Proximity for Categorical & Binary Vectors
Sending pairs of article scraped text to an LLM to check if one is a duplicate or scraped copy of the other.
Mahalanobis Distance
Covariance-Adjusted Distance Metric for Multimodal & Correlated Feature Spaces
Feeding multivariate telemetry data (CPU, memory, IOPS) to an LLM to detect if an incoming server metric is an anomalous outlier.
Logistic Regression
Probabilistic Classification with Logit Link Function & Maximum Likelihood
Calling an LLM with a 1,000-token prompt to output a binary "YES" or "NO" label for click-through rate (CTR) prediction on 10 million ad impressions per day.
Linear Regression & Regularization (Ridge, Lasso, ElasticNet)
Ordinary Least Squares, Feature Selection via L1 Sparsity, and L2 Variance Shrinkage
Asking an LLM to predict housing prices, customer lifetime value (LTV), or financial quarterly revenue based on numerical tabular columns.
Decision Trees (CART)
Recursive Binary Partitioning with Gini Impurity, Entropy & Tree Pruning
Prompting an LLM to follow a 20-step conditional rulebook for insurance eligibility.
Random Forests
Ensemble Bagging with Feature Sub-sampling & Out-of-Bag Error Validation
Using an LLM to predict tabular fraud transactions from hundreds of dense user behavioral columns.
Gradient Boosted Decision Trees (XGBoost / LightGBM)
Sequential Gradient & Hessian Residual Fitting with Histogram Binning
Prompting an LLM to evaluate tabular risk or loan default probabilities on a dataset of 500,000 credit records.
Support Vector Machines (SVM)
Maximum Margin Hyperplanes, Soft Margins & The Dual Kernel Trick
Prompting an LLM to classify medical genomics vectors (e.g. 20,000 gene expressions on 200 patient samples).
Naive Bayes Classifier
Probabilistic Classification with Feature Conditional Independence & Laplace Smoothing
Routing inbound emails to "spam" vs "ham" using an LLM API at 10,000 emails per minute.
k-Nearest Neighbors (k-NN)
Instance-Based Non-Parametric Classification & Spatial Voronoi Tessellations
Asking an LLM to find the 5 most similar patient medical profiles from a database of 100,000 historical records.
Principal Component Analysis (PCA)
Orthogonal Variance Maximization via Covariance Eigendecomposition & SVD
Pasting 500 numerical tabular features into an LLM prompt to ask: "Summarize the 3 most important dimensions of variation in this customer data".
K-Means & K-Means++ Clustering
Expectation-Maximization Centroid Partitioning & Probabilistic Seeding
Pasting 20,000 customer transaction records into an LLM prompt and asking it to group them into 5 distinct behavioral personas.
DBSCAN & Density-Based Clustering
Density-Reachability, Core Points & Automatic Outlier / Noise Isolation
Asking an LLM to identify geometric GPS cluster hotspots and filter out random GPS noise pings from delivery drivers.
t-SNE & UMAP
Non-Linear Manifold Learning, Student-t Kernels & Fuzzy Simplicial Sets
Asking an LLM to explain why two high-dimensional text embeddings from different topics are clustered together in 2D space.
Matrix Factorization & SVD (ALS)
Latent Factor Decomposition with Alternating Least Squares & Implicit Feedback
Prompting an LLM with a user’s historical watch history of 500 movies and asking it to rank 100,000 catalog candidates.
Two-Tower Neural Recommenders
Dual-Encoder Query & Candidate Networks for Billions of Interactions
Deploying an LLM as a live recommendation ranking engine evaluating every candidate item sequentially with a prompt.
GLiNER (Generalist Lightweight NER)
Bidirectional Transformer Encoder with Span Representations for Zero-Shot Open Entity Extraction
Sending 5-page legal contracts to a 70B parameter LLM with a 500-token prompt: "Extract all companies, dates, and contract values in valid JSON with exact offsets".
TF-IDF (Term Frequency - Inverse Document Frequency)
Statistical Term Importance Weighting for Sparse Document Vectors & Keyword Extraction
Calling an LLM API to extract top 5 representative topic keywords from 100,000 blog articles.
Word2Vec (Skip-Gram & CBOW)
Distributed Dense Word Representations via Continuous Vector Embeddings & Negative Sampling
Calling an LLM API to fetch 1536-dimensional embeddings for 10 million single words in a vocabulary index.
VADER (Valence Aware Dictionary and sEntiment Reasoner)
Rule-Based Heuristic Sentiment Engine for Microblogs, Social Media & Punctuation Nuance
Calling an LLM API to classify the sentiment of 5 million incoming tweets or product reviews per day.
Okapi BM25
Probabilistic Information Retrieval with Term Saturation & Document Length Normalization
Prompting an LLM with 200 documents in context to answer: "Which of these documents best mentions model number XJ-9042 and SKU 8812?".
Cross-Encoder Re-Ranking
Deep Cross-Attention Interaction for High-Precision Top-K Re-Ranking
Calling GPT-4 with a 50-document context prompt asking: "Rank these 50 documents from most relevant to least relevant for the query".
Reciprocal Rank Fusion (RRF)
Parameter-Free Rank Merging for Lexical BM25 & Dense Semantic Search
Asking an LLM agent to merge two different search result lists and decide which document belongs at rank 1.
HNSW (Hierarchical Navigable Small World)
Multi-Layer Proximity Graphs for Sub-Millisecond Approximate Nearest Neighbor Search
Writing a linear brute-force scan or prompt to locate the nearest vector among 10 million 1536-dimensional embeddings.
Convolutional Neural Networks (CNNs) & ResNet
Spatial Translation Invariance, 2D Kernels, Receptive Fields & Residual Skip Connections
Calling a multimodal LLM API to detect whether an industrial manufacturing part on an assembly line has a physical crack defect.
Transformers & Scaled Dot-Product Self-Attention
Multi-Head Attention Mechanisms, Softmax Routing & Positional Encodings
Treating the Transformer as a mysterious black box and attempting to tune prompt temperatures rather than understanding context limits and attention patterns.
Transformer Archetypes: Encoder vs Decoder vs Seq2Seq
Structural Differences Between BERT, GPT & T5 for Task-Optimal Architecture Selection
Using an autoregressive decoder-only model (GPT) for document classification or dense vector embeddings.
Loss Functions: Cross-Entropy, MSE & Focal Loss
Mathematical Objectives for Optimization, Probability Calibration & Severe Class Imbalance
Evaluating classification quality using raw qualitative prompt outputs without computing formal statistical loss metrics.
Classification Metrics: ROC-AUC vs PR-AUC & F1
Threshold-Free Discrimination, Precision-Recall Curves & The Fallacy of Accuracy
Claiming an ML model is "99.9% accurate" when classifying rare credit card fraud where 99.9% of transactions are legitimate.
Model Quantization (FP16, INT8 & INT4)
Post-Training Quantization (PTQ) vs Quantization-Aware Training (QAT) for Edge Serving
Hosting full FP32 or FP16 unquantized neural models on expensive 80GB A100 GPUs for simple text classification or embedding tasks.
Data Drift vs Concept Drift Detection
Covariate Shift, Population Stability Index (PSI) & Kolmogorov-Smirnov Statistical Testing
Deploying an ML model to production and only monitoring infrastructure metrics (CPU, RAM, HTTP 200s) while ignoring feature distribution shifts.
The Principal ML Architect Decision Matrix
A rapid diagnostic guide for choosing between Generative LLMs and Right-Sized Models in production.
| Task Requirement | LLM Approach (Anti-Pattern) | Targeted / Specialized Model | Latency & Cost Advantage |
|---|---|---|---|
| Named Entity Recognition (NER) | Prompting 70B LLM with JSON schema | GLiNER (Zero-shot bi-encoder spans) | 15ms vs 2,500ms (150x faster, $0) |
| Graph Centrality & Authority | Pasting edge lists into LLM prompt | PageRank (Power iteration) | 5ms vs Timeout (100% Deterministic) |
| Keyword / Exact SKU Search | Vector search or LLM doc scanning | Okapi BM25 Inverted Index | 0.8ms vs 3,000ms (Exact Match) |
| String Deduplication / Typos | Asking LLM if strings match | Levenshtein DP or MinHash LSH | 0.02ms vs 1,400ms (Hardware POPCNT) |
| Tabular Risk / CTR Bidding | Passing row features to LLM | XGBoost / LightGBM or Logistic Reg | 0.05ms vs 1,800ms (Meets 10ms ad SLA) |