@ruvector/ruvllm 2.4.1 → 2.5.0
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/README.md +158 -398
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/intelligence.d.ts +136 -0
- package/dist/cjs/intelligence.d.ts.map +1 -0
- package/dist/cjs/intelligence.js +162 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/intelligence.d.ts +136 -0
- package/dist/esm/intelligence.d.ts.map +1 -0
- package/dist/esm/intelligence.js +157 -0
- package/package.json +3 -7
- package/scripts/training/validation-results.json +1 -1
- package/dist/cjs/rlm/controller.d.ts +0 -245
- package/dist/cjs/rlm/controller.d.ts.map +0 -1
- package/dist/cjs/rlm/controller.js +0 -554
- package/dist/cjs/rlm/index.d.ts +0 -62
- package/dist/cjs/rlm/index.d.ts.map +0 -1
- package/dist/cjs/rlm/index.js +0 -97
- package/dist/cjs/rlm/training.d.ts +0 -333
- package/dist/cjs/rlm/training.d.ts.map +0 -1
- package/dist/cjs/rlm/training.js +0 -680
- package/dist/cjs/rlm/types.d.ts +0 -189
- package/dist/cjs/rlm/types.d.ts.map +0 -1
- package/dist/cjs/rlm/types.js +0 -10
- package/dist/esm/rlm/controller.d.ts +0 -245
- package/dist/esm/rlm/controller.d.ts.map +0 -1
- package/dist/esm/rlm/controller.js +0 -550
- package/dist/esm/rlm/index.d.ts +0 -62
- package/dist/esm/rlm/index.d.ts.map +0 -1
- package/dist/esm/rlm/index.js +0 -71
- package/dist/esm/rlm/training.d.ts +0 -333
- package/dist/esm/rlm/training.d.ts.map +0 -1
- package/dist/esm/rlm/training.js +0 -672
- package/dist/esm/rlm/types.d.ts +0 -189
- package/dist/esm/rlm/types.d.ts.map +0 -1
- package/dist/esm/rlm/types.js +0 -9
- package/scripts/training/rlm-dataset.js +0 -671
package/README.md
CHANGED
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# @ruvector/ruvllm v2.3
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
### The First Purpose-Built LLM Runtime for Claude Code Agent Orchestration
|
|
6
|
-
|
|
7
|
-
**100% Routing Accuracy | Sub-Millisecond Inference | Self-Learning**
|
|
8
|
-
|
|
9
|
-
[](https://www.npmjs.com/package/@ruvector/ruvllm)
|
|
10
|
-
[](https://www.npmjs.com/package/@ruvector/ruvllm)
|
|
11
|
-
[](LICENSE)
|
|
12
|
-
[](./test)
|
|
13
|
-
|
|
14
|
-
[Quick Start](#quick-start) | [RLM](#rlm-recursive-language-model) | [Training](#training) | [Models](#models) | [API](#api-reference)
|
|
15
|
-
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## What is @ruvector/ruvllm?
|
|
21
|
-
|
|
22
|
-
**@ruvector/ruvllm** is a TypeScript/JavaScript SDK for intelligent LLM orchestration, specifically designed for **Claude Code** and multi-agent systems. It provides:
|
|
23
|
-
|
|
24
|
-
- **RLM (Recursive Language Model)** - Break complex queries into sub-queries, synthesize coherent answers
|
|
25
|
-
- **100% Routing Accuracy** - Hybrid keyword + embedding strategy for perfect agent selection
|
|
26
|
-
- **SONA Self-Learning** - Model improves with every successful interaction
|
|
27
|
-
- **SIMD Acceleration** - AVX2/NEON optimized inference
|
|
28
|
-
|
|
29
|
-
### Why @ruvector/ruvllm?
|
|
30
|
-
|
|
31
|
-
| Challenge | Traditional Approach | @ruvector/ruvllm Solution |
|
|
32
|
-
|-----------|---------------------|---------------------------|
|
|
33
|
-
| Agent selection | Manual or keyword-based | Semantic + keyword hybrid = **100%** |
|
|
34
|
-
| Complex queries | Single-shot RAG | Recursive decomposition + synthesis |
|
|
35
|
-
| Response latency | 2-5 seconds | **<1ms** cache, 50-200ms full |
|
|
36
|
-
| Learning | Static models | **Self-improving** (SONA) |
|
|
37
|
-
| Cost per route | $0.01+ (API call) | **$0** (local inference) |
|
|
38
|
-
|
|
39
|
-
---
|
|
3
|
+
Self-learning LLM orchestration with SONA adaptive learning, HNSW memory, and SIMD inference for Node.js.
|
|
40
4
|
|
|
41
5
|
## Installation
|
|
42
6
|
|
|
@@ -47,444 +11,240 @@ npm install @ruvector/ruvllm
|
|
|
47
11
|
## Quick Start
|
|
48
12
|
|
|
49
13
|
```typescript
|
|
50
|
-
import { RuvLLM,
|
|
14
|
+
import { RuvLLM, RuvLLMConfig } from '@ruvector/ruvllm';
|
|
15
|
+
|
|
16
|
+
// Initialize with default configuration
|
|
17
|
+
const llm = new RuvLLM();
|
|
51
18
|
|
|
52
|
-
//
|
|
19
|
+
// Or with custom configuration
|
|
53
20
|
const llm = new RuvLLM({
|
|
54
|
-
modelPath: '
|
|
21
|
+
modelPath: './models/ruvltra-small-q4km.gguf',
|
|
55
22
|
sonaEnabled: true,
|
|
23
|
+
flashAttention: true,
|
|
24
|
+
maxTokens: 256,
|
|
56
25
|
});
|
|
57
26
|
|
|
27
|
+
// Generate text
|
|
58
28
|
const response = await llm.query('Explain quantum computing');
|
|
59
29
|
console.log(response.text);
|
|
60
30
|
|
|
61
|
-
//
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
31
|
+
// Stream generation
|
|
32
|
+
for await (const token of llm.stream('Write a haiku about Rust')) {
|
|
33
|
+
process.stdout.write(token);
|
|
34
|
+
}
|
|
65
35
|
```
|
|
66
36
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Core Features
|
|
70
|
-
|
|
71
|
-
### 1. Claude Code Native Routing
|
|
72
|
-
|
|
73
|
-
Built **by** Claude Code, **for** Claude Code. Routes tasks to 60+ agent types:
|
|
37
|
+
## What's New in v2.3
|
|
74
38
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// Multi-agent teams for complex tasks
|
|
87
|
-
const team = await llm.routeComplex('build full-stack app with auth');
|
|
88
|
-
// Returns: [system-architect, backend-dev, coder, security-architect, tester]
|
|
89
|
-
```
|
|
39
|
+
| Feature | Description |
|
|
40
|
+
|---------|-------------|
|
|
41
|
+
| **RuvLTRA Models** | Purpose-built 0.5B & 3B models for Claude Flow |
|
|
42
|
+
| **Task-Specific LoRA** | 5 pre-trained adapters (coder, researcher, security, architect, reviewer) |
|
|
43
|
+
| **HuggingFace Hub** | Download/upload models directly |
|
|
44
|
+
| **Adapter Merging** | TIES, DARE, SLERP strategies |
|
|
45
|
+
| **HNSW Routing** | 150x faster semantic matching |
|
|
46
|
+
| **Evaluation Harness** | SWE-Bench testing with 5 ablation modes |
|
|
47
|
+
| **Auto-Dimension** | HNSW auto-detects model embedding size |
|
|
48
|
+
| **mistral-rs Backend** | Production serving with PagedAttention, X-LoRA, ISQ (5-10x concurrent users) |
|
|
90
49
|
|
|
91
|
-
|
|
50
|
+
## CLI Usage
|
|
92
51
|
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
└─────────────────────┬───────────────────────────────────┘
|
|
97
|
-
↓
|
|
98
|
-
[RuvLTRA Routing]
|
|
99
|
-
↓
|
|
100
|
-
┌─────────────┼─────────────┐
|
|
101
|
-
↓ ↓ ↓
|
|
102
|
-
┌───────────┐ ┌───────────┐ ┌───────────┐
|
|
103
|
-
│ Tier 1 │ │ Tier 2 │ │ Tier 3 │
|
|
104
|
-
│ Booster │ │ Haiku │ │ Opus │
|
|
105
|
-
│ <1ms │ │ ~500ms │ │ 2-5s │
|
|
106
|
-
│ $0 │ │ $0.0002 │ │ $0.015 │
|
|
107
|
-
└───────────┘ └───────────┘ └───────────┘
|
|
108
|
-
```
|
|
52
|
+
```bash
|
|
53
|
+
# Query a model
|
|
54
|
+
ruvllm query "What is machine learning?"
|
|
109
55
|
|
|
110
|
-
|
|
56
|
+
# Stream output
|
|
57
|
+
ruvllm query --stream "Write a poem"
|
|
111
58
|
|
|
112
|
-
|
|
59
|
+
# Download a model
|
|
60
|
+
ruvllm download ruvector/ruvltra-small-q4km
|
|
113
61
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
llm.route('implement OAuth2') → security-architect (97%)
|
|
62
|
+
# Benchmark
|
|
63
|
+
ruvllm bench ./models/model.gguf
|
|
117
64
|
|
|
118
|
-
|
|
119
|
-
|
|
65
|
+
# Run evaluation (SWE-Bench)
|
|
66
|
+
ruvllm eval --model ./models/model.gguf --subset lite --max-tasks 50
|
|
120
67
|
```
|
|
121
68
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## RLM (Recursive Language Model)
|
|
125
|
-
|
|
126
|
-
RLM provides **recursive query decomposition** - unlike traditional RAG that retrieves once, RLM breaks complex questions into sub-queries and synthesizes coherent answers.
|
|
127
|
-
|
|
128
|
-
### How It Works
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
Query: "What are the causes AND solutions for slow API responses?"
|
|
132
|
-
↓
|
|
133
|
-
[Decomposition]
|
|
134
|
-
/ \
|
|
135
|
-
"Causes of slow API?" "Solutions for slow API?"
|
|
136
|
-
↓ ↓
|
|
137
|
-
[Sub-answers] [Sub-answers]
|
|
138
|
-
\ /
|
|
139
|
-
[Synthesis]
|
|
140
|
-
↓
|
|
141
|
-
Coherent combined answer with sources
|
|
142
|
-
```
|
|
69
|
+
## API Reference
|
|
143
70
|
|
|
144
|
-
###
|
|
71
|
+
### RuvLLM Class
|
|
145
72
|
|
|
146
73
|
```typescript
|
|
147
|
-
|
|
74
|
+
class RuvLLM {
|
|
75
|
+
constructor(config?: RuvLLMConfig);
|
|
148
76
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
retrievalTopK: 10,
|
|
152
|
-
enableCache: true,
|
|
153
|
-
});
|
|
77
|
+
// Generate text
|
|
78
|
+
query(prompt: string, params?: GenerateParams): Promise<Response>;
|
|
154
79
|
|
|
155
|
-
//
|
|
156
|
-
|
|
157
|
-
await rlm.addMemory('React is a library for building user interfaces.');
|
|
80
|
+
// Stream generation
|
|
81
|
+
stream(prompt: string, params?: GenerateParams): AsyncIterable<string>;
|
|
158
82
|
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
console.log(answer.text); // Comprehensive synthesized answer
|
|
162
|
-
console.log(answer.sources); // Source attributions
|
|
163
|
-
console.log(answer.qualityScore); // 0.0-1.0
|
|
164
|
-
console.log(answer.confidence); // Routing confidence
|
|
165
|
-
```
|
|
83
|
+
// Load a model
|
|
84
|
+
loadModel(path: string): Promise<void>;
|
|
166
85
|
|
|
167
|
-
|
|
86
|
+
// Get SONA learning stats
|
|
87
|
+
sonaStats(): SonaStats | null;
|
|
168
88
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (event.type === 'token') {
|
|
172
|
-
process.stdout.write(event.text);
|
|
173
|
-
} else {
|
|
174
|
-
console.log('\n\nQuality:', event.answer.qualityScore);
|
|
175
|
-
}
|
|
89
|
+
// Adapt on feedback
|
|
90
|
+
adapt(input: Float32Array, quality: number): void;
|
|
176
91
|
}
|
|
177
92
|
```
|
|
178
93
|
|
|
179
|
-
###
|
|
180
|
-
|
|
181
|
-
```typescript
|
|
182
|
-
const rlm = new RlmController({
|
|
183
|
-
enableReflection: true,
|
|
184
|
-
maxReflectionIterations: 2,
|
|
185
|
-
minQualityScore: 0.8,
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
// Answers are iteratively refined until quality >= 0.8
|
|
189
|
-
const answer = await rlm.query('Complex multi-part technical question...');
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### RLM Configuration
|
|
94
|
+
### Configuration
|
|
193
95
|
|
|
194
96
|
```typescript
|
|
195
|
-
interface
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
minQualityScore?: number; // Min quality threshold (default: 0.7)
|
|
203
|
-
enableReflection?: boolean; // Enable self-reflection (default: false)
|
|
204
|
-
maxReflectionIterations?: number; // Max reflection loops (default: 2)
|
|
97
|
+
interface RuvLLMConfig {
|
|
98
|
+
modelPath?: string; // Path to GGUF model
|
|
99
|
+
sonaEnabled?: boolean; // Enable SONA learning (default: true)
|
|
100
|
+
flashAttention?: boolean; // Use Flash Attention 2 (default: true)
|
|
101
|
+
maxTokens?: number; // Max generation tokens (default: 256)
|
|
102
|
+
temperature?: number; // Sampling temperature (default: 0.7)
|
|
103
|
+
topP?: number; // Top-p sampling (default: 0.9)
|
|
205
104
|
}
|
|
206
105
|
```
|
|
207
106
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
## Unique Capabilities
|
|
211
|
-
|
|
212
|
-
### 1. Memory-Augmented Routing
|
|
213
|
-
|
|
214
|
-
Every successful routing is stored in HNSW-indexed memory for instant recall:
|
|
107
|
+
### Generate Parameters
|
|
215
108
|
|
|
216
109
|
```typescript
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
110
|
+
interface GenerateParams {
|
|
111
|
+
maxTokens?: number;
|
|
112
|
+
temperature?: number;
|
|
113
|
+
topP?: number;
|
|
114
|
+
topK?: number;
|
|
115
|
+
repetitionPenalty?: number;
|
|
116
|
+
stopSequences?: string[];
|
|
117
|
+
}
|
|
222
118
|
```
|
|
223
119
|
|
|
224
|
-
|
|
120
|
+
## SIMD Module
|
|
225
121
|
|
|
226
|
-
|
|
227
|
-
// Low confidence automatically escalates
|
|
228
|
-
Confidence > 0.9 → Use recommended agent
|
|
229
|
-
Confidence 0.7-0.9 → Use with human confirmation
|
|
230
|
-
Confidence < 0.7 → Escalate to higher tier
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### 3. Batch SIMD Operations
|
|
122
|
+
For direct access to optimized SIMD kernels:
|
|
234
123
|
|
|
235
124
|
```typescript
|
|
236
125
|
import { simd } from '@ruvector/ruvllm/simd';
|
|
237
126
|
|
|
238
|
-
//
|
|
239
|
-
const
|
|
240
|
-
const attended = simd.flashAttention(q, k, v, scale);
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### 4. Zero-Copy Caching
|
|
244
|
-
|
|
245
|
-
Arc-based string interning for 100-1000x faster cache hits on large responses.
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## Performance
|
|
250
|
-
|
|
251
|
-
### Benchmarks (M4 Pro)
|
|
252
|
-
|
|
253
|
-
| Operation | Latency | Throughput |
|
|
254
|
-
|-----------|---------|------------|
|
|
255
|
-
| Query decomposition | 340 ns | 2.9M/s |
|
|
256
|
-
| Cache lookup | 23.5 ns | 42.5M/s |
|
|
257
|
-
| Embedding (384d) | 293 ns | 3.4M/s |
|
|
258
|
-
| Memory search (10k) | 0.4 ms | 2.5K/s |
|
|
259
|
-
| End-to-end routing | <1 ms | 1K+/s |
|
|
260
|
-
| Full RLM query | 50-200 ms | 5-20/s |
|
|
261
|
-
|
|
262
|
-
### Routing Accuracy
|
|
263
|
-
|
|
264
|
-
| Strategy | RuvLTRA | Qwen Base | OpenAI |
|
|
265
|
-
|----------|---------|-----------|--------|
|
|
266
|
-
| Embedding Only | 45% | 40% | 52% |
|
|
267
|
-
| Keyword Only | 78% | 78% | N/A |
|
|
268
|
-
| **Hybrid** | **100%** | 95% | N/A |
|
|
127
|
+
// Dot product
|
|
128
|
+
const result = simd.dotProduct(vecA, vecB);
|
|
269
129
|
|
|
270
|
-
|
|
130
|
+
// Matrix multiplication
|
|
131
|
+
const output = simd.matmul(matrix, vector);
|
|
271
132
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
- RLM Controller: 24 tests
|
|
275
|
-
- Routing Accuracy: 18 tests
|
|
276
|
-
- Contrastive Training: 15 tests
|
|
277
|
-
- SIMD Operations: 22 tests
|
|
278
|
-
- SONA Learning: 19 tests
|
|
279
|
-
- Memory/HNSW: 21 tests
|
|
280
|
-
- Benchmarks: 26 tests
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
## Models
|
|
286
|
-
|
|
287
|
-
### HuggingFace Repository
|
|
288
|
-
|
|
289
|
-
**URL**: [https://huggingface.co/ruv/ruvltra](https://huggingface.co/ruv/ruvltra)
|
|
290
|
-
|
|
291
|
-
### Available Models
|
|
292
|
-
|
|
293
|
-
| Model | Size | Purpose | Accuracy |
|
|
294
|
-
|-------|------|---------|----------|
|
|
295
|
-
| **ruvltra-claude-code-0.5b-q4_k_m** | 398 MB | Agent routing | **100%** (hybrid) |
|
|
296
|
-
| ruvltra-small-0.5b-q4_k_m | ~400 MB | Embeddings | - |
|
|
297
|
-
| ruvltra-medium-1.1b-q4_k_m | ~1 GB | Full inference | - |
|
|
298
|
-
|
|
299
|
-
### Download Models
|
|
133
|
+
// Flash Attention
|
|
134
|
+
const attended = simd.flashAttention(query, key, value, scale);
|
|
300
135
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
import { downloadModel } from '@ruvector/ruvllm';
|
|
304
|
-
await downloadModel('ruv/ruvltra', { quantization: 'q4_k_m' });
|
|
305
|
-
|
|
306
|
-
// CLI
|
|
307
|
-
ruvllm download ruv/ruvltra
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Auto-Download
|
|
311
|
-
|
|
312
|
-
Models are automatically downloaded on first use:
|
|
313
|
-
|
|
314
|
-
```typescript
|
|
315
|
-
const llm = new RuvLLM({ model: 'ruv/ruvltra' });
|
|
316
|
-
// Downloads to ~/.ruvllm/models/ if not present
|
|
136
|
+
// RMS Normalization
|
|
137
|
+
simd.rmsNorm(hidden, weights, epsilon);
|
|
317
138
|
```
|
|
318
139
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
## Training
|
|
140
|
+
## Performance (M4 Pro)
|
|
322
141
|
|
|
323
|
-
|
|
142
|
+
| Operation | Performance |
|
|
143
|
+
|-----------|-------------|
|
|
144
|
+
| Inference | 88-135 tok/s |
|
|
145
|
+
| Flash Attention | 320µs (seq=2048) |
|
|
146
|
+
| HNSW Search | 17-62µs |
|
|
147
|
+
| SONA Adapt | <1ms |
|
|
148
|
+
| Evaluation | 5 ablation modes |
|
|
324
149
|
|
|
325
|
-
|
|
326
|
-
node scripts/training/routing-dataset.js
|
|
327
|
-
# Output: 381 examples, 793 contrastive pairs, 156 hard negatives
|
|
328
|
-
```
|
|
150
|
+
## Evaluation Harness
|
|
329
151
|
|
|
330
|
-
|
|
152
|
+
Run model evaluations with SWE-Bench integration:
|
|
331
153
|
|
|
332
154
|
```typescript
|
|
333
|
-
import {
|
|
155
|
+
import { RuvLLM, EvaluationHarness, AblationMode } from '@ruvector/ruvllm';
|
|
334
156
|
|
|
335
|
-
const
|
|
336
|
-
modelPath: './models/
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
learningRate: 1e-4,
|
|
157
|
+
const harness = new EvaluationHarness({
|
|
158
|
+
modelPath: './models/model.gguf',
|
|
159
|
+
enableHnsw: true,
|
|
160
|
+
enableSona: true,
|
|
340
161
|
});
|
|
341
162
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
await trainer.save('./adapters/routing-lora');
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
### Training Scripts
|
|
352
|
-
|
|
353
|
-
| Script | Description |
|
|
354
|
-
|--------|-------------|
|
|
355
|
-
| `routing-dataset.js` | Generate 381 routing examples |
|
|
356
|
-
| `claude-code-synth.js` | Synthetic data generation |
|
|
357
|
-
| `contrastive-finetune.js` | LoRA fine-tuning pipeline |
|
|
358
|
-
| `rlm-dataset.js` | RLM training data (500 examples) |
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## API Reference
|
|
363
|
-
|
|
364
|
-
### RuvLLM Class
|
|
365
|
-
|
|
366
|
-
```typescript
|
|
367
|
-
class RuvLLM {
|
|
368
|
-
constructor(config?: RuvLLMConfig);
|
|
369
|
-
|
|
370
|
-
query(prompt: string, params?: GenerateParams): Promise<Response>;
|
|
371
|
-
stream(prompt: string, params?: GenerateParams): AsyncIterable<string>;
|
|
372
|
-
route(task: string): Promise<RoutingResult>;
|
|
373
|
-
routeComplex(task: string): Promise<AgentTeam[]>;
|
|
374
|
-
|
|
375
|
-
loadModel(path: string): Promise<void>;
|
|
376
|
-
addMemory(text: string, metadata?: object): number;
|
|
377
|
-
searchMemory(query: string, topK?: number): MemoryResult[];
|
|
163
|
+
// Run single evaluation
|
|
164
|
+
const result = await harness.evaluate(
|
|
165
|
+
'Fix the null pointer exception',
|
|
166
|
+
'def process(data): return data.split()',
|
|
167
|
+
AblationMode.Full
|
|
168
|
+
);
|
|
378
169
|
|
|
379
|
-
|
|
380
|
-
adapt(input: Float32Array, quality: number): void;
|
|
381
|
-
}
|
|
382
|
-
```
|
|
170
|
+
console.log(`Success: ${result.success}, Quality: ${result.qualityScore}`);
|
|
383
171
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
constructor(config?: RlmConfig, engine?: RuvLLM);
|
|
389
|
-
|
|
390
|
-
query(input: string): Promise<RlmAnswer>;
|
|
391
|
-
queryStream(input: string): AsyncGenerator<StreamToken>;
|
|
392
|
-
|
|
393
|
-
addMemory(text: string, metadata?: object): Promise<string>;
|
|
394
|
-
searchMemory(query: string, topK?: number): Promise<MemorySpan[]>;
|
|
395
|
-
|
|
396
|
-
clearCache(): void;
|
|
397
|
-
getCacheStats(): { size: number; entries: number };
|
|
398
|
-
|
|
399
|
-
updateConfig(config: Partial<RlmConfig>): void;
|
|
400
|
-
getConfig(): Required<RlmConfig>;
|
|
172
|
+
// Run ablation study (Baseline, RetrievalOnly, AdaptersOnly, R+A, Full)
|
|
173
|
+
const report = await harness.runAblationStudy(tasks);
|
|
174
|
+
for (const [mode, metrics] of Object.entries(report.modeMetrics)) {
|
|
175
|
+
console.log(`${mode}: ${metrics.successRate * 100}% success`);
|
|
401
176
|
}
|
|
402
177
|
```
|
|
403
178
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
179
|
+
## mistral-rs Backend (Production Serving)
|
|
180
|
+
|
|
181
|
+
For production deployments with 10-100+ concurrent users, use the mistral-rs backend:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
import { RuvLLM, MistralBackend, PagedAttentionConfig } from '@ruvector/ruvllm';
|
|
185
|
+
|
|
186
|
+
// Configure for production serving
|
|
187
|
+
const backend = new MistralBackend({
|
|
188
|
+
// PagedAttention: 5-10x more concurrent users
|
|
189
|
+
pagedAttention: {
|
|
190
|
+
blockSize: 16,
|
|
191
|
+
maxBlocks: 4096,
|
|
192
|
+
gpuMemoryFraction: 0.9,
|
|
193
|
+
prefixCaching: true,
|
|
194
|
+
},
|
|
195
|
+
// X-LoRA: Per-token adapter routing
|
|
196
|
+
xlora: {
|
|
197
|
+
adapters: ['./adapters/coder', './adapters/researcher'],
|
|
198
|
+
topK: 2,
|
|
199
|
+
},
|
|
200
|
+
// ISQ: Runtime quantization
|
|
201
|
+
isq: {
|
|
202
|
+
bits: 4,
|
|
203
|
+
method: 'awq',
|
|
204
|
+
},
|
|
205
|
+
});
|
|
420
206
|
|
|
421
|
-
|
|
422
|
-
|
|
207
|
+
const llm = new RuvLLM({ backend });
|
|
208
|
+
await llm.loadModel('mistralai/Mistral-7B-Instruct-v0.2');
|
|
423
209
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
} from '@ruvector/ruvllm';
|
|
210
|
+
// Serve multiple concurrent requests
|
|
211
|
+
const response = await llm.query('Write production code');
|
|
427
212
|
```
|
|
428
213
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
## CLI
|
|
432
|
-
|
|
433
|
-
```bash
|
|
434
|
-
# Route a task
|
|
435
|
-
ruvllm route "add unit tests for auth module"
|
|
436
|
-
# → Agent: tester | Confidence: 0.96 | Tier: 2
|
|
214
|
+
> **Note**: mistral-rs features require the Rust backend with `mistral-rs` feature enabled. Native bindings will use mistral-rs when available.
|
|
437
215
|
|
|
438
|
-
|
|
439
|
-
ruvllm query --stream "Explain machine learning"
|
|
216
|
+
## Supported Models
|
|
440
217
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
ruvllm eval --model ./models/model.gguf --subset lite
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
---
|
|
218
|
+
- **RuvLTRA-Small** (494M) - Q4K, Q5K, Q8
|
|
219
|
+
- **RuvLTRA-Medium** (3B) - Q4K, Q5K, Q8
|
|
220
|
+
- **Qwen 2.5** (0.5B-72B)
|
|
221
|
+
- **Llama 3.x** (8B-70B)
|
|
222
|
+
- **Mistral** (7B-22B)
|
|
223
|
+
- **Phi-3** (3.8B-14B)
|
|
224
|
+
- **Gemma-2** (2B-27B)
|
|
452
225
|
|
|
453
226
|
## Platform Support
|
|
454
227
|
|
|
455
228
|
| Platform | Architecture | Status |
|
|
456
229
|
|----------|--------------|--------|
|
|
457
|
-
| macOS | arm64 (M1-M4) | Full support |
|
|
458
|
-
| macOS | x64 | Supported |
|
|
459
|
-
| Linux | x64 | Supported |
|
|
460
|
-
| Linux | arm64 | Supported |
|
|
461
|
-
| Windows | x64 | Supported |
|
|
230
|
+
| macOS | arm64 (M1-M4) | ✅ Full support |
|
|
231
|
+
| macOS | x64 | ✅ Supported |
|
|
232
|
+
| Linux | x64 | ✅ Supported |
|
|
233
|
+
| Linux | arm64 | ✅ Supported |
|
|
234
|
+
| Windows | x64 | ✅ Supported |
|
|
462
235
|
|
|
463
|
-
|
|
236
|
+
## Related Packages
|
|
464
237
|
|
|
465
|
-
|
|
238
|
+
- [@ruvector/core](https://www.npmjs.com/package/@ruvector/core) - Vector operations
|
|
239
|
+
- [@ruvector/sona](https://www.npmjs.com/package/@ruvector/sona) - SONA learning engine
|
|
240
|
+
- [@ruvector/ruvector](https://www.npmjs.com/package/@ruvector/ruvector) - Full Ruvector SDK
|
|
466
241
|
|
|
467
|
-
|
|
468
|
-
|----------|-----|
|
|
469
|
-
| **npm** | [npmjs.com/package/@ruvector/ruvllm](https://www.npmjs.com/package/@ruvector/ruvllm) |
|
|
470
|
-
| **HuggingFace** | [huggingface.co/ruv/ruvltra](https://huggingface.co/ruv/ruvltra) |
|
|
471
|
-
| **Crate (Rust)** | [crates.io/crates/ruvllm](https://crates.io/crates/ruvllm) |
|
|
472
|
-
| **Documentation** | [docs.rs/ruvllm](https://docs.rs/ruvllm) |
|
|
473
|
-
| **GitHub** | [github.com/ruvnet/ruvector](https://github.com/ruvnet/ruvector) |
|
|
474
|
-
| **Claude Flow** | [github.com/ruvnet/claude-flow](https://github.com/ruvnet/claude-flow) |
|
|
242
|
+
## Links
|
|
475
243
|
|
|
476
|
-
|
|
244
|
+
- [GitHub Repository](https://github.com/ruvnet/ruvector)
|
|
245
|
+
- [API Documentation](https://docs.rs/ruvllm)
|
|
246
|
+
- [Crate (Rust)](https://crates.io/crates/ruvllm)
|
|
477
247
|
|
|
478
248
|
## License
|
|
479
249
|
|
|
480
250
|
MIT OR Apache-2.0
|
|
481
|
-
|
|
482
|
-
---
|
|
483
|
-
|
|
484
|
-
<div align="center">
|
|
485
|
-
|
|
486
|
-
**Built for Claude Code. Optimized for agents. Designed for speed.**
|
|
487
|
-
|
|
488
|
-
[Get Started](#quick-start) | [View on GitHub](https://github.com/ruvnet/ruvector)
|
|
489
|
-
|
|
490
|
-
</div>
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export * from './training';
|
|
|
62
62
|
export * from './contrastive';
|
|
63
63
|
export * from './models';
|
|
64
64
|
export * from './benchmarks';
|
|
65
|
-
export * from './
|
|
65
|
+
export * from './intelligence';
|
|
66
66
|
export { version, hasSimdSupport } from './native';
|
|
67
67
|
export { RuvLLM as default } from './engine';
|
|
68
68
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC;AAGzB,cAAc,QAAQ,CAAC;AAGvB,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAGvB,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,UAAU,CAAC;AAGzB,cAAc,cAAc,CAAC;AAG7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC;AAGzB,cAAc,QAAQ,CAAC;AAGvB,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAGvB,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,UAAU,CAAC;AAGzB,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC"}
|