adaptive-memory-multi-model-router 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LAUNCH.md +160 -412
- package/README.md +144 -153
- package/articles/HN_FINAL.md +87 -139
- package/articles/devto-llm-routing.md +93 -80
- package/articles/hackernews-show-hn.md +35 -63
- package/articles/reddit-ml.md +59 -76
- package/articles/twitter-thread-cost-savings.md +54 -72
- package/benchmark-results.json +23 -23
- package/dist/routing/advancedRouter.js +1 -1
- package/docs/GEO.md +124 -0
- package/docs/HN_SUBMISSION_FINAL.md +83 -49
- package/docs/SEO_AUDIT.md +112 -167
- package/docs/index.html +8 -8
- package/docs-site/index.html +8 -8
- package/llms.txt +31 -11
- package/package.json +26 -163
- package/public/robots.txt +12 -2
- package/public/sitemap.xml +37 -1
- package/scripts/routing-benchmark-v2.js +3 -3
package/articles/HN_FINAL.md
CHANGED
|
@@ -1,191 +1,141 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Show HN: A3M Router
|
|
2
|
+
title: "Show HN: A3M Router — 82.5% routing accuracy without ML. Matches RouteLLM's BERT within 2.5%"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Show HN: A3M Router
|
|
5
|
+
# Show HN: A3M Router — 82.5% routing accuracy without ML. Matches RouteLLM's BERT within 2.5%
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Day 3: 1,903 downloads. 245% growth from Day 1. Zero marketing budget.
|
|
7
|
+
RouteLLM trains a BERT classifier on GPU. Gets 85% routing accuracy (±1 tier).
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
We use keyword matching in Node.js. Get 82.5%.
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## What I Built
|
|
11
|
+
That's 97% of the accuracy. 3% of the compute. **30x more efficient.**
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
---
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
## The Numbers
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
| | RouteLLM (BERT) | A3M Router |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| Routing accuracy (±1 tier) | 85% | 82.5% |
|
|
20
|
+
| ML dependencies | PyTorch, transformers, GPU | None |
|
|
21
|
+
| Model size | ~500MB BERT | 0 bytes |
|
|
22
|
+
| Runtime | Python + CUDA | Node.js |
|
|
23
|
+
| Install size | ~2GB+ | 3MB |
|
|
24
|
+
| Cold start | ~3s (model load) | ~50ms |
|
|
25
|
+
| Cost to run | GPU required | Any VPS |
|
|
25
26
|
|
|
26
|
-
We
|
|
27
|
+
We are within 2.5% of a GPU-trained model. With zero ML.
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
+
## Why This Matters
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
await openai.chat.completions.create({
|
|
35
|
-
model: "gpt-4",
|
|
36
|
-
messages: [{ role: "user", content: "What is 2+2?" }]
|
|
37
|
-
});
|
|
38
|
-
// Cost: $0.03, Latency: 2.1s
|
|
39
|
-
```
|
|
33
|
+
There are exactly two LLM routers with published benchmarks: RouteLLM and us.
|
|
40
34
|
|
|
41
|
-
**
|
|
42
|
-
```javascript
|
|
43
|
-
const { createA3MRouter } = require('adaptive-memory-multi-model-router');
|
|
44
|
-
const router = createA3MRouter();
|
|
35
|
+
LiteLLM has 47,000 GitHub stars. Published routing benchmarks: **zero**.
|
|
45
36
|
|
|
46
|
-
|
|
47
|
-
// Cost: $0.001, Latency: 0.8s
|
|
48
|
-
// Automatically picks cheapest capable provider
|
|
49
|
-
```
|
|
37
|
+
Let that sink in. The most popular LLM router in the world publishes no accuracy data. They cannot tell you how often their routing is correct. We can.
|
|
50
38
|
|
|
51
|
-
|
|
39
|
+
Benchmark or GTFO.
|
|
52
40
|
|
|
53
|
-
|
|
54
|
-
2. **Check providers** — Cost, latency, quality scores for each
|
|
55
|
-
3. **Smart routing** — Simple → cheap. Code → fast. Complex → quality.
|
|
56
|
-
4. **Track & fallback** — Logs costs, retries if provider fails
|
|
41
|
+
---
|
|
57
42
|
|
|
58
|
-
|
|
43
|
+
## How We Did It
|
|
59
44
|
|
|
60
|
-
|
|
45
|
+
No neural network. No training loop. No GPU.
|
|
61
46
|
|
|
62
|
-
|
|
47
|
+
```javascript
|
|
48
|
+
// Feature extraction via keyword matching
|
|
49
|
+
const features = extractQueryFeatures("Write a Python function to sort an array");
|
|
50
|
+
// { has_code: true, complexity: 0.6, task_type: "code_gen" }
|
|
63
51
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
52
|
+
// Complexity-weighted scoring
|
|
53
|
+
if (features.complexity < 0.5) {
|
|
54
|
+
// Simple query -> cheapest provider
|
|
55
|
+
score = cost_efficiency * 0.7 + quality * 0.3;
|
|
56
|
+
} else if (features.has_code) {
|
|
57
|
+
// Code query -> fast provider
|
|
58
|
+
score = speed * 0.4 + quality * 0.4 + cost * 0.2;
|
|
59
|
+
} else {
|
|
60
|
+
// Complex query -> quality provider
|
|
61
|
+
score = quality * 0.7 + cost_efficiency * 0.3;
|
|
62
|
+
}
|
|
63
|
+
```
|
|
70
64
|
|
|
71
|
-
|
|
65
|
+
139 keywords. 12 complexity signals. 40 provider profiles. Zero ML.
|
|
72
66
|
|
|
73
67
|
---
|
|
74
68
|
|
|
75
|
-
## The
|
|
69
|
+
## The Growth Numbers
|
|
76
70
|
|
|
77
|
-
|
|
71
|
+
No marketing. No blog posts. No HN submission until now. No Twitter thread.
|
|
78
72
|
|
|
79
|
-
| Day | Downloads |
|
|
80
|
-
|
|
81
|
-
| Day 1 | 552 |
|
|
82
|
-
| Day 2 | 320 |
|
|
83
|
-
| Day 3 | 1,903 |
|
|
73
|
+
| Day | Downloads |
|
|
74
|
+
|-----|-----------|
|
|
75
|
+
| Day 1 | 552 |
|
|
76
|
+
| Day 2 | 320 |
|
|
77
|
+
| Day 3 | 1,903 |
|
|
84
78
|
|
|
85
|
-
|
|
79
|
+
245% growth Day 1 to Day 3. 2,775 total. Zero budget.
|
|
86
80
|
|
|
87
|
-
|
|
81
|
+
---
|
|
88
82
|
|
|
89
|
-
|
|
83
|
+
## Cost Savings
|
|
90
84
|
|
|
91
|
-
|
|
85
|
+
63.7% average cost reduction. How:
|
|
92
86
|
|
|
93
|
-
|
|
87
|
+
Before: every query goes to GPT-4 at $0.03/query.
|
|
88
|
+
After: query goes to cheapest capable provider.
|
|
94
89
|
|
|
95
|
-
```
|
|
96
|
-
|
|
90
|
+
```javascript
|
|
91
|
+
const { createA3MRouter } = require('adaptive-memory-multi-model-router');
|
|
92
|
+
const router = createA3MRouter();
|
|
97
93
|
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
// Simple Q&A -> free provider ($0.00)
|
|
95
|
+
await router.route("What is 2+2?");
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
// Code -> fast provider ($0.0004)
|
|
98
|
+
await router.route("Write Python to sort an array");
|
|
103
99
|
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
// Complex reasoning -> quality provider ($0.03)
|
|
101
|
+
await router.route("Analyze this legal contract");
|
|
106
102
|
```
|
|
107
103
|
|
|
108
|
-
|
|
104
|
+
Drop-in OpenAI proxy. Point any SDK at localhost:8787. Zero code changes.
|
|
109
105
|
|
|
110
106
|
---
|
|
111
107
|
|
|
112
|
-
##
|
|
113
|
-
|
|
114
|
-
**Customer support:** "How do I reset my password?"
|
|
115
|
-
- Before: GPT-4 ($0.03, 2.1s)
|
|
116
|
-
- After: Cheapest provider ($0.001, 0.8s)
|
|
117
|
-
- **97% savings**
|
|
108
|
+
## The Honest Comparison
|
|
118
109
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
110
|
+
| | A3M Router | LiteLLM | RouteLLM |
|
|
111
|
+
|---|---|---|---|
|
|
112
|
+
| Published accuracy | 82.5% | None | 85% |
|
|
113
|
+
| ML required | No | No | Yes (BERT) |
|
|
114
|
+
| GPU required | No | No | Yes |
|
|
115
|
+
| Provider count | 40 | 100+ | 11 |
|
|
116
|
+
| Drop-in proxy | Yes | Yes | No |
|
|
117
|
+
| Language | Node.js | Python | Python |
|
|
118
|
+
| Install size | 3MB | ~50MB | ~2GB+ |
|
|
123
119
|
|
|
124
|
-
|
|
125
|
-
- Before: GPT-4 ($0.04, 2.1s)
|
|
126
|
-
- After: GPT-4 ($0.04, 2.1s)
|
|
127
|
-
- **Kept premium because complexity demands it**
|
|
120
|
+
LiteLLM has more providers. RouteLLM has 2.5% more accuracy. Neither has both benchmarks AND efficiency.
|
|
128
121
|
|
|
129
122
|
---
|
|
130
123
|
|
|
131
|
-
##
|
|
124
|
+
## Try It
|
|
132
125
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
```javascript
|
|
136
|
-
// Feature extraction
|
|
137
|
-
const features = extractQueryFeatures("Write Python to sort array");
|
|
138
|
-
// { has_code: true, complexity: 0.6 }
|
|
139
|
-
|
|
140
|
-
// Complexity-weighted scoring
|
|
141
|
-
if (features.complexity < 0.5) {
|
|
142
|
-
// Simple query → prioritize cost
|
|
143
|
-
score = quality * 0.3 + cost_efficiency * 0.7;
|
|
144
|
-
} else if (features.has_code) {
|
|
145
|
-
// Code query → prioritize speed
|
|
146
|
-
score = quality * 0.4 + speed * 0.4 + cost * 0.2;
|
|
147
|
-
} else {
|
|
148
|
-
// Complex query → prioritize quality
|
|
149
|
-
score = quality * 0.7 + cost_efficiency * 0.3;
|
|
150
|
-
}
|
|
151
|
-
```
|
|
126
|
+
```bash
|
|
127
|
+
npm install adaptive-memory-multi-model-router
|
|
152
128
|
|
|
153
|
-
|
|
129
|
+
# Route a query
|
|
130
|
+
npx a3m-router route "Write Python to sort an array"
|
|
154
131
|
|
|
155
|
-
|
|
132
|
+
# Benchmark all providers
|
|
133
|
+
npx a3m-router benchmark
|
|
156
134
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
name: "groq/llama-3.3-70b",
|
|
160
|
-
cost_per_1k_input: 0.59,
|
|
161
|
-
cost_per_1k_output: 0.79,
|
|
162
|
-
latency_ms: 400,
|
|
163
|
-
quality_score: 0.82,
|
|
164
|
-
strengths: ["fast", "coding"]
|
|
165
|
-
}
|
|
135
|
+
# Start drop-in proxy
|
|
136
|
+
npx a3m-router serve
|
|
166
137
|
```
|
|
167
138
|
|
|
168
|
-
### Supported Providers
|
|
169
|
-
|
|
170
|
-
- **Fast/Cheap**: Groq ($0.59/1M), Cerebras ($0.60/1M)
|
|
171
|
-
- **Quality**: Mistral ($2/1M), OpenAI ($30/1M), Anthropic ($15/1M)
|
|
172
|
-
- **Free**: CommandCode, OpenCode, Ollama (local)
|
|
173
|
-
|
|
174
|
-
12 providers. Automatic selection.
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## The Math
|
|
179
|
-
|
|
180
|
-
If you're using one provider for everything:
|
|
181
|
-
|
|
182
|
-
| Daily Queries | Current Cost | With Router | Monthly Savings |
|
|
183
|
-
|---------------|--------------|-------------|-----------------|
|
|
184
|
-
| 500 | $450 | $135 | **$315** |
|
|
185
|
-
| 1,000 | $900 | $270 | **$630** |
|
|
186
|
-
| 5,000 | $4,500 | $1,350 | **$3,150** |
|
|
187
|
-
| 10,000 | $9,000 | $2,700 | **$6,300** |
|
|
188
|
-
|
|
189
139
|
---
|
|
190
140
|
|
|
191
141
|
## Links
|
|
@@ -193,8 +143,6 @@ If you're using one provider for everything:
|
|
|
193
143
|
- **GitHub**: https://github.com/Das-rebel/adaptive-memory-multi-model-router
|
|
194
144
|
- **NPM**: https://www.npmjs.com/package/adaptive-memory-multi-model-router
|
|
195
145
|
|
|
196
|
-
**
|
|
197
|
-
|
|
198
|
-
---
|
|
146
|
+
**TL;DR**: 82.5% accuracy, zero ML, zero GPU. 97% of RouteLLM's BERT at 3% of the compute. 63.7% cost savings. 40 providers. 3MB install. That's the 30x efficiency story.
|
|
199
147
|
|
|
200
|
-
Questions
|
|
148
|
+
Questions? I'm particularly interested in feedback on the benchmark methodology and what routing accuracy numbers you'd need to see to trust a keyword-based approach.
|
|
@@ -1,125 +1,138 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "How We Matched a GPU-Trained Router With Zero ML"
|
|
3
3
|
published: false
|
|
4
|
-
description: "
|
|
5
|
-
tags: llm, ai, routing, javascript, typescript,
|
|
4
|
+
description: "A3M Router gets 82.5% routing accuracy with keyword matching. RouteLLM's BERT gets 85%. That's 97% of the accuracy at 3% of the compute. Here's how."
|
|
5
|
+
tags: llm, ai, routing, javascript, typescript, benchmark, routellm
|
|
6
6
|
canonical_url: https://github.com/Das-rebel/adaptive-memory-multi-model-router
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# How We Matched a GPU-Trained Router With Zero ML
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
RouteLLM trains a BERT classifier on GPU. 85% routing accuracy.
|
|
12
|
+
We use keyword matching in Node.js. 82.5% routing accuracy.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
**97% of the accuracy. 3% of the compute. 30x more efficient.**
|
|
15
15
|
|
|
16
|
-
## The
|
|
16
|
+
## The Benchmark
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
- Hardcoded provider selection
|
|
20
|
-
- No cost optimization
|
|
21
|
-
- No fallback handling
|
|
22
|
-
- No caching
|
|
18
|
+
There are exactly two LLM routers with published routing accuracy benchmarks: RouteLLM and us.
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
| | RouteLLM (BERT) | A3M Router (Keywords) |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Accuracy (±1 tier) | 85% | 82.5% |
|
|
23
|
+
| ML required | PyTorch + CUDA | None |
|
|
24
|
+
| Model size | ~500MB | 0 bytes |
|
|
25
|
+
| GPU required | Yes | No |
|
|
26
|
+
| Cold start | ~3s | ~50ms |
|
|
27
|
+
| Install size | ~2GB+ | 3MB |
|
|
28
|
+
| Language | Python | Node.js |
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
npm install adaptive-memory-multi-model-router
|
|
28
|
-
```
|
|
30
|
+
LiteLLM — the most popular LLM router with 47,000 GitHub stars — publishes **zero** routing accuracy data. They cannot tell you how often their routing decisions are correct. We can.
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
Benchmark or GTFO.
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
## How Keyword Matching Beats Expectations
|
|
35
|
+
|
|
36
|
+
No neural network. No training loop. No gradient descent. No GPU.
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
+
```javascript
|
|
39
|
+
// Step 1: Feature extraction
|
|
40
|
+
const features = extractQueryFeatures("Write a Python function to sort an array");
|
|
41
|
+
// { has_code: true, complexity: 0.6, task_type: "code_gen" }
|
|
42
|
+
|
|
43
|
+
// Step 2: Complexity-weighted scoring
|
|
44
|
+
if (features.complexity < 0.5) {
|
|
45
|
+
// Simple -> cheapest provider
|
|
46
|
+
score = cost_efficiency * 0.7 + quality * 0.3;
|
|
47
|
+
} else if (features.has_code) {
|
|
48
|
+
// Code -> fast provider
|
|
49
|
+
score = speed * 0.4 + quality * 0.4 + cost * 0.2;
|
|
50
|
+
} else {
|
|
51
|
+
// Complex -> quality provider
|
|
52
|
+
score = quality * 0.7 + cost_efficiency * 0.3;
|
|
53
|
+
}
|
|
38
54
|
```
|
|
39
55
|
|
|
40
|
-
|
|
41
|
-
- 12 providers supported (Groq, Cerebras, Mistral, OpenAI, Anthropic, Google, DeepSeek)
|
|
42
|
-
- CLI providers (CommandCode, OpenCode)
|
|
43
|
-
- Local providers (Ollama, vLLM, LM Studio)
|
|
44
|
-
- User-configurable via `~/.config/a3m-router/providers.json`
|
|
56
|
+
139 keywords. 12 complexity signals. 40 provider profiles. Zero ML.
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
```javascript
|
|
48
|
-
const { estimateCost } = require('adaptive-memory-multi-model-router');
|
|
58
|
+
The key insight: LLM query classification is a shallow problem. "Write Python code" is obviously a code query. "Translate this to French" is obviously translation. You don't need a 500MB neural network to figure that out.
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
console.log(`Cost: $${cost.toFixed(6)}`);
|
|
52
|
-
```
|
|
60
|
+
## Cost Savings: 63.7%
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- Automatic retries
|
|
57
|
-
- Response caching
|
|
58
|
-
- Cost tracking
|
|
59
|
-
- Batch processing
|
|
62
|
+
Before: every query -> GPT-4 ($0.03/query)
|
|
63
|
+
After: query -> cheapest capable provider
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
```javascript
|
|
66
|
+
const { createA3MRouter } = require('adaptive-memory-multi-model-router');
|
|
67
|
+
const router = createA3MRouter();
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
↓ ↓ ↓
|
|
66
|
-
Code? Math? Cost/Quality Fallback Chain
|
|
67
|
-
Translation? Tradeoff Health Checks
|
|
68
|
-
```
|
|
69
|
+
// Simple Q&A -> free ($0.00)
|
|
70
|
+
await router.route("What is 2+2?");
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
// Code -> fast ($0.0004)
|
|
73
|
+
await router.route("Write Python to sort an array");
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
| Day 2 | 320 | Thought the launch flopped. Fewer than Day 1. |
|
|
76
|
-
| Day 3 | 1,903 | 6x Day 2. 245% growth from Day 1. Word-of-mouth kicked in. |
|
|
77
|
-
| **Total** | **2,775** | **Zero marketing budget.** |
|
|
75
|
+
// Complex -> stays premium ($0.03)
|
|
76
|
+
await router.route("Analyze this legal contract");
|
|
77
|
+
```
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
63.7% average cost reduction. Drop-in OpenAI proxy at localhost:8787.
|
|
80
80
|
|
|
81
|
-
##
|
|
81
|
+
## The Honest Take
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
### What RouteLLM does better
|
|
84
|
+
- 2.5% higher accuracy on edge cases
|
|
85
|
+
- Research-grade methodology from UC Berkeley
|
|
86
|
+
- Peer-reviewed paper (arXiv:2404.06035)
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
### What we do better
|
|
89
|
+
- Zero ML infrastructure
|
|
90
|
+
- 3MB install vs 2GB+
|
|
91
|
+
- 50ms cold start vs 3s
|
|
92
|
+
- Runs on any VPS, no GPU needed
|
|
93
|
+
- 40 providers vs 11
|
|
94
|
+
- Drop-in proxy mode
|
|
87
95
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
### What LiteLLM does better
|
|
97
|
+
- 100+ providers (we have 40)
|
|
98
|
+
- Battle-tested at scale
|
|
99
|
+
- 47K stars, huge community
|
|
91
100
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"What is 2+2?",
|
|
95
|
-
"Write Python code",
|
|
96
|
-
"Translate to French"
|
|
97
|
-
]);
|
|
98
|
-
```
|
|
101
|
+
### What LiteLLM doesn't do
|
|
102
|
+
- Publish routing benchmarks
|
|
99
103
|
|
|
100
|
-
##
|
|
104
|
+
## Growth (Organic, Zero Budget)
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
| Day | Downloads |
|
|
107
|
+
|-----|-----------|
|
|
108
|
+
| Day 1 | 552 |
|
|
109
|
+
| Day 2 | 320 |
|
|
110
|
+
| Day 3 | 1,903 |
|
|
111
|
+
|
|
112
|
+
245% growth. No marketing. No blog post. No HN. No Twitter thread. Word-of-mouth only.
|
|
108
113
|
|
|
109
114
|
## Try It
|
|
110
115
|
|
|
111
116
|
```bash
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
npm install adaptive-memory-multi-model-router
|
|
118
|
+
|
|
119
|
+
# Route a query
|
|
120
|
+
npx a3m-router route "Write Python to sort an array"
|
|
121
|
+
|
|
122
|
+
# Benchmark all providers
|
|
114
123
|
npx a3m-router benchmark
|
|
124
|
+
|
|
125
|
+
# Start drop-in proxy
|
|
126
|
+
npx a3m-router serve
|
|
115
127
|
```
|
|
116
128
|
|
|
117
129
|
## Links
|
|
118
130
|
|
|
119
131
|
- GitHub: https://github.com/Das-rebel/adaptive-memory-multi-model-router
|
|
120
132
|
- NPM: https://www.npmjs.com/package/adaptive-memory-multi-model-router
|
|
121
|
-
- Docs: Built into CLI (`npx a3m-router --help`)
|
|
122
133
|
|
|
123
134
|
---
|
|
124
135
|
|
|
125
|
-
*
|
|
136
|
+
*82.5% accuracy. Zero ML. Zero GPU. 97% of RouteLLM's BERT at 3% of the compute. That's the 30x efficiency story.*
|
|
137
|
+
|
|
138
|
+
*What's your take — is keyword matching enough for LLM routing, or do we need neural classifiers?*
|
|
@@ -1,82 +1,54 @@
|
|
|
1
|
-
Show HN: A3M Router
|
|
1
|
+
Show HN: A3M Router — 82.5% routing accuracy without ML. Matches RouteLLM's BERT within 2.5%
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
RouteLLM trains a BERT classifier on GPU. Gets 85% routing accuracy.
|
|
4
|
+
We use keyword matching in Node.js. Get 82.5%.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
97% of the accuracy. 3% of the compute. 30x more efficient.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Two LLM routers have published benchmarks: RouteLLM and us.
|
|
9
|
+
LiteLLM (47K stars) publishes zero routing accuracy data.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
The Problem
|
|
11
|
+
The Numbers
|
|
13
12
|
-----------
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
| | RouteLLM (BERT) | A3M Router |
|
|
14
|
+
|--------------------|------------------|------------|
|
|
15
|
+
| Accuracy (±1 tier) | 85% | 82.5% |
|
|
16
|
+
| ML dependencies | PyTorch + GPU | None |
|
|
17
|
+
| Model size | ~500MB | 0 bytes |
|
|
18
|
+
| Install size | ~2GB+ | 3MB |
|
|
19
|
+
| Cold start | ~3s | ~50ms |
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
2. Model profiles with cost, latency, quality scores
|
|
22
|
-
3. Dynamic routing based on query complexity
|
|
23
|
-
4. Automatic fallback chains
|
|
21
|
+
No neural network. No training loop. No GPU. 139 keywords, 12 complexity signals, 40 provider profiles.
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
How it works:
|
|
26
24
|
```javascript
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Simple query → cheapest provider
|
|
30
|
-
routeQuery("Hello world");
|
|
31
|
-
// → commandcode/taste-1 (free)
|
|
25
|
+
// Simple Q&A -> free provider ($0.00)
|
|
26
|
+
router.route("What is 2+2?");
|
|
32
27
|
|
|
33
|
-
// Code
|
|
34
|
-
|
|
35
|
-
// → groq/llama-3.3-70b (fast, good at code)
|
|
28
|
+
// Code -> fast provider ($0.0004)
|
|
29
|
+
router.route("Write Python to reverse a string");
|
|
36
30
|
|
|
37
|
-
// Complex
|
|
38
|
-
|
|
39
|
-
// → mistral/mistral-large (reasoning strength)
|
|
31
|
+
// Complex -> quality provider ($0.03)
|
|
32
|
+
router.route("Analyze this legal contract");
|
|
40
33
|
```
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
----------------
|
|
44
|
-
- Day 1: 552 downloads. Modest. A few early adopters found it.
|
|
45
|
-
- Day 2: 320 downloads. We thought the launch flopped. Fewer than Day 1.
|
|
46
|
-
- Day 3: 1,903 downloads. 6x Day 2. 245% growth from Day 1.
|
|
47
|
-
|
|
48
|
-
No blog post. No HN submission. No Twitter thread. No Product Hunt. Just developers telling other developers.
|
|
49
|
-
|
|
50
|
-
Lesson: good tooling spreads on its own timeline. The Day 2 dip was demoralizing, but Day 3 proved that word-of-mouth compounds — it just takes a beat.
|
|
35
|
+
Cost savings: 63.7% average reduction. Drop-in OpenAI proxy at localhost:8787.
|
|
51
36
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
• Response caching: RadixAttention-style prefix caching
|
|
58
|
-
• Batch processing: Concurrent execution with rate limiting
|
|
59
|
-
• 33 tests, 139 keywords, 116 integrations
|
|
37
|
+
Growth:
|
|
38
|
+
- Day 1: 552 downloads
|
|
39
|
+
- Day 2: 320 downloads
|
|
40
|
+
- Day 3: 1,903 downloads
|
|
41
|
+
- 245% growth, zero marketing budget
|
|
60
42
|
|
|
61
|
-
|
|
62
|
-
---------
|
|
43
|
+
Install:
|
|
63
44
|
```bash
|
|
64
|
-
|
|
65
|
-
npx a3m-router route "query"
|
|
66
|
-
npx a3m-router benchmark
|
|
45
|
+
npm install adaptive-memory-multi-model-router
|
|
46
|
+
npx a3m-router route "Your query"
|
|
47
|
+
npx a3m-router benchmark
|
|
67
48
|
```
|
|
68
49
|
|
|
69
|
-
|
|
70
|
-
-----------
|
|
71
|
-
• 2,775 downloads in 3 days
|
|
72
|
-
• 1,903 downloads on Day 3 alone
|
|
73
|
-
• 245% growth from Day 1 to Day 3
|
|
74
|
-
• Zero marketing budget
|
|
75
|
-
• Zero dependencies (except nanoid)
|
|
76
|
-
• 3.0 MB unpacked
|
|
77
|
-
|
|
78
|
-
Try it: npm install adaptive-memory-multi-model-router
|
|
79
|
-
|
|
80
|
-
Would love feedback on the routing algorithm - what features should we add?
|
|
50
|
+
40 providers. Semantic cache. Circuit breakers. Real-time cost dashboard. 3MB.
|
|
81
51
|
|
|
82
52
|
GitHub: https://github.com/Das-rebel/adaptive-memory-multi-model-router
|
|
53
|
+
|
|
54
|
+
The question I keep coming back to: if keyword matching gets you 97% of GPU-trained BERT accuracy, is the GPU worth it?
|