@mlx-node/trl 0.0.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/dist/data/dataset.d.ts +22 -0
- package/dist/data/dataset.d.ts.map +1 -0
- package/dist/data/dataset.js +142 -0
- package/dist/data/sft-dataset.d.ts +156 -0
- package/dist/data/sft-dataset.d.ts.map +1 -0
- package/dist/data/sft-dataset.js +415 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/trainers/grpo-config.d.ts +42 -0
- package/dist/trainers/grpo-config.d.ts.map +1 -0
- package/dist/trainers/grpo-config.js +220 -0
- package/dist/trainers/grpo-entropy.d.ts +33 -0
- package/dist/trainers/grpo-entropy.d.ts.map +1 -0
- package/dist/trainers/grpo-entropy.js +18 -0
- package/dist/trainers/grpo-trainer.d.ts +602 -0
- package/dist/trainers/grpo-trainer.d.ts.map +1 -0
- package/dist/trainers/grpo-trainer.js +1439 -0
- package/dist/trainers/sft-config.d.ts +32 -0
- package/dist/trainers/sft-config.d.ts.map +1 -0
- package/dist/trainers/sft-config.js +186 -0
- package/dist/trainers/sft-trainer.d.ts +141 -0
- package/dist/trainers/sft-trainer.d.ts.map +1 -0
- package/dist/trainers/sft-trainer.js +502 -0
- package/dist/trainers/training-logger.d.ts +375 -0
- package/dist/trainers/training-logger.d.ts.map +1 -0
- package/dist/trainers/training-logger.js +542 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/path-security.d.ts +51 -0
- package/dist/utils/path-security.d.ts.map +1 -0
- package/dist/utils/path-security.js +69 -0
- package/dist/utils/xml-parser.d.ts +6 -0
- package/dist/utils/xml-parser.d.ts.map +1 -0
- package/dist/utils/xml-parser.js +184 -0
- package/package.json +29 -0
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GRPO Training Engine - Rust-Native Training
|
|
3
|
+
*
|
|
4
|
+
* This module provides a Rust-native GRPO training engine that minimizes
|
|
5
|
+
* FFI overhead by keeping the training loop entirely in Rust.
|
|
6
|
+
*
|
|
7
|
+
* ## Key Features
|
|
8
|
+
* - Training loop runs in Rust (eliminates FFI overhead)
|
|
9
|
+
* - Built-in reward functions (tool use, XML format, length, JSON schema)
|
|
10
|
+
* - Custom JS rewards via callback pattern
|
|
11
|
+
* - Gradient accumulation and memory management in Rust
|
|
12
|
+
* - High-level train() method for full training runs
|
|
13
|
+
* - Low-level trainStep() for custom training loops
|
|
14
|
+
*
|
|
15
|
+
* ## High-Level Usage (train with dataset)
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const trainer = await GRPOTrainer.create({
|
|
18
|
+
* modelPath: './model',
|
|
19
|
+
* modelName: 'qwen3-0.6b',
|
|
20
|
+
* rewardFunction: (prompts, completions) => [...scores],
|
|
21
|
+
* });
|
|
22
|
+
* await trainer.train(dataset);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ## Low-Level Usage (step-by-step)
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const model = await Qwen3Model.loadPretrained(modelPath);
|
|
28
|
+
* const trainer = new GRPOTrainer(model, config);
|
|
29
|
+
*
|
|
30
|
+
* trainer.registerBuiltinReward({
|
|
31
|
+
* rewardType: 'ToolUse',
|
|
32
|
+
* allowedTools: ['search', 'calculate'],
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* for (const batch of dataset) {
|
|
36
|
+
* const completions = await trainer.generateBatch(batch.prompts);
|
|
37
|
+
* const rewards = await myRewardFunction(batch.prompts, completions);
|
|
38
|
+
* const metrics = await trainer.trainStep(batch.prompts, rewards);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
import { GrpoTrainingEngine, NativeRewardRegistry, Qwen3Model, OutputStore, type EngineEpochMetrics, type BuiltinRewardConfig, type GenerateBatchResult as NativeGenerateBatchResult, type ToolDefinition } from '@mlx-node/core';
|
|
43
|
+
import type { ChatMessage, DatasetExample, RewardFunction } from '../types';
|
|
44
|
+
import { type TrainingLogger } from './training-logger';
|
|
45
|
+
export { GrpoTrainingEngine, NativeRewardRegistry, OutputStore } from '@mlx-node/core';
|
|
46
|
+
export type { GrpoEngineConfig, EngineStepMetrics, EngineEpochMetrics, BuiltinRewardConfig, TrainStepResult, TrainStepResultWithOutputs, RewardOutput, OutputStoreConfig, } from '@mlx-node/core';
|
|
47
|
+
/**
|
|
48
|
+
* Configuration for GRPOTrainer
|
|
49
|
+
*/
|
|
50
|
+
export interface GRPOTrainerConfig<T = unknown> {
|
|
51
|
+
modelPath?: string;
|
|
52
|
+
modelName?: string;
|
|
53
|
+
learningRate?: number;
|
|
54
|
+
gradientAccumulationSteps?: number;
|
|
55
|
+
gradientClipNorm?: number;
|
|
56
|
+
weightDecay?: number;
|
|
57
|
+
numEpochs?: number;
|
|
58
|
+
batchSize?: number;
|
|
59
|
+
groupSize?: number;
|
|
60
|
+
clipEpsilon?: number;
|
|
61
|
+
klCoef?: number;
|
|
62
|
+
lossType?: 'grpo' | 'dapo' | 'dr_grpo' | 'bnpo';
|
|
63
|
+
advantageNormalization?: boolean;
|
|
64
|
+
/** Maximum completion length for both generation and training (default: 256).
|
|
65
|
+
* Matches Python TRL's max_completion_length config. */
|
|
66
|
+
maxCompletionLength?: number;
|
|
67
|
+
temperature?: number;
|
|
68
|
+
topP?: number;
|
|
69
|
+
topK?: number;
|
|
70
|
+
repetitionPenalty?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Tool definitions for function calling.
|
|
73
|
+
* When provided, tools are included in the chat template so the model
|
|
74
|
+
* can generate tool calls. Essential for tool-use training.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* import { createToolDefinition } from '@mlx-node/lm';
|
|
79
|
+
*
|
|
80
|
+
* const config: GRPOTrainerConfig = {
|
|
81
|
+
* tools: [
|
|
82
|
+
* createToolDefinition('lsp', 'Query API docs', { method: { type: 'string' } }, ['method']),
|
|
83
|
+
* createToolDefinition('run_js', 'Execute code', { code: { type: 'string' } }, ['code']),
|
|
84
|
+
* ],
|
|
85
|
+
* };
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
tools?: ToolDefinition[];
|
|
89
|
+
/** Enable thinking mode for Qwen3 models (default: true).
|
|
90
|
+
* When false, adds empty <think></think> tags to disable model thinking.
|
|
91
|
+
* This is useful for tool-use training where you want direct outputs. */
|
|
92
|
+
enableThinking?: boolean;
|
|
93
|
+
rewardType?: 'function' | 'builtin' | 'model';
|
|
94
|
+
rewardFunction?: RewardFunction<T>;
|
|
95
|
+
rewardModelPath?: string;
|
|
96
|
+
gradientClipValue?: number;
|
|
97
|
+
logInterval?: number;
|
|
98
|
+
saveInterval?: number;
|
|
99
|
+
evalInterval?: number;
|
|
100
|
+
outputDir?: string;
|
|
101
|
+
logConsole?: boolean;
|
|
102
|
+
logJsonl?: boolean;
|
|
103
|
+
runName?: string;
|
|
104
|
+
/** Maximum number of checkpoints to keep (default: 3). Set to 0 for unlimited. */
|
|
105
|
+
maxCheckpoints?: number;
|
|
106
|
+
device?: string;
|
|
107
|
+
/** Resume training from a checkpoint directory, or 'latest' to auto-find */
|
|
108
|
+
resumeFromCheckpoint?: 'latest' | string;
|
|
109
|
+
/** Enable TUI mode - outputs structured JSONL to stdout and listens for commands on stdin */
|
|
110
|
+
tuiMode?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Timeout for the reward function callback in milliseconds.
|
|
113
|
+
*
|
|
114
|
+
* If your reward function calls external APIs or performs expensive
|
|
115
|
+
* computations, you may need to increase this value.
|
|
116
|
+
*
|
|
117
|
+
* Set to 0 to disable timeout (not recommended for production).
|
|
118
|
+
*
|
|
119
|
+
* @default 60000 (60 seconds)
|
|
120
|
+
*/
|
|
121
|
+
rewardTimeout?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Batch chunk size for LM head computation (memory optimization).
|
|
124
|
+
* When set, the LM head (hidden_states -> logits) is computed in chunks
|
|
125
|
+
* of this size to reduce peak memory usage.
|
|
126
|
+
* Default: undefined (no chunking, full batch at once)
|
|
127
|
+
* Recommended: 2 for batch_size >= 4 with large vocabularies (e.g., Qwen3 with 151936 vocab)
|
|
128
|
+
* This reduces peak memory from ~1.2GB to ~300MB for Qwen3.
|
|
129
|
+
*/
|
|
130
|
+
lmHeadChunkSize?: number;
|
|
131
|
+
/**
|
|
132
|
+
* Batch chunk size for transformer forward pass (memory optimization).
|
|
133
|
+
* When set, the transformer layers process the batch in chunks of this size,
|
|
134
|
+
* reducing peak memory from O(batch × heads × seq²) for attention.
|
|
135
|
+
* Default: undefined (no chunking, full batch at once)
|
|
136
|
+
* Recommended: 4 for batch_size >= 4 with groupSize >= 4
|
|
137
|
+
* Memory savings: ~70-80% for batch=4, groupSize=4 (16 sequences → 4 at a time)
|
|
138
|
+
*/
|
|
139
|
+
forwardChunkSize?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Enable true parallel batch generation (default: false).
|
|
142
|
+
* When true, all N*G sequences are processed in parallel using batched FFI
|
|
143
|
+
* with per-sequence RoPE offsets. This provides 2-4x speedup for GRPO training.
|
|
144
|
+
* When false, uses sequential generation (process one prompt at a time,
|
|
145
|
+
* then expand KV cache for G completions).
|
|
146
|
+
*/
|
|
147
|
+
useParallelBatchGeneration?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Chunk size for vocabulary dimension in cross-entropy computation.
|
|
150
|
+
* When computing logsumexp over large vocabularies (e.g., Qwen3's 151,936 tokens),
|
|
151
|
+
* the computation is split into chunks of this size to reduce peak memory usage.
|
|
152
|
+
*
|
|
153
|
+
* Default: 65536 (2^16)
|
|
154
|
+
*
|
|
155
|
+
* Memory impact for Qwen3 (vocab=151936):
|
|
156
|
+
* - Standard: Full [B, T, 151936] intermediate tensor
|
|
157
|
+
* - Chunked (65536): 3 chunks, ~2.3x lower peak memory
|
|
158
|
+
*
|
|
159
|
+
* Set to a larger value (e.g., 262144) to reduce chunking overhead,
|
|
160
|
+
* or smaller value (e.g., 32768) for tighter memory constraints.
|
|
161
|
+
*/
|
|
162
|
+
vocabChunkSize?: number;
|
|
163
|
+
/** Output recording configuration (records all generations for debugging/research) */
|
|
164
|
+
outputStore?: {
|
|
165
|
+
/** Enable output recording (default: false) */
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
/** Local database path (default: "{outputDir}/outputs.db") */
|
|
168
|
+
localPath?: string;
|
|
169
|
+
/** Remote Turso URL for cloud sync (optional) */
|
|
170
|
+
remoteUrl?: string;
|
|
171
|
+
/** Turso auth token (required if remoteUrl is set) */
|
|
172
|
+
authToken?: string;
|
|
173
|
+
/** Sync interval in seconds (default: 60, only for embedded replica mode) */
|
|
174
|
+
syncInterval?: number;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Dataset metadata for resume validation
|
|
179
|
+
*
|
|
180
|
+
* Stored in checkpoints to validate that the same dataset is used on resume.
|
|
181
|
+
* Prevents issues where batch indices don't align due to dataset changes.
|
|
182
|
+
*/
|
|
183
|
+
export interface DatasetMetadata {
|
|
184
|
+
/** Total number of examples in the dataset */
|
|
185
|
+
size: number;
|
|
186
|
+
/** Hash of first N example prompts for identity check */
|
|
187
|
+
contentHash: string;
|
|
188
|
+
/** Shuffle seed if deterministic shuffling was used */
|
|
189
|
+
shuffleSeed?: number;
|
|
190
|
+
/** Indices of batches already processed in current epoch */
|
|
191
|
+
processedBatchIndices?: number[];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Training state saved with checkpoints for resumption
|
|
195
|
+
*/
|
|
196
|
+
export interface TrainingState {
|
|
197
|
+
step: number;
|
|
198
|
+
epoch: number;
|
|
199
|
+
timestamp: string;
|
|
200
|
+
/** Dataset information for resume validation */
|
|
201
|
+
dataset?: DatasetMetadata;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Result from generateBatch with detailed information
|
|
205
|
+
*/
|
|
206
|
+
export interface GenerateBatchResult {
|
|
207
|
+
/** Generated completion texts */
|
|
208
|
+
completionTexts: string[];
|
|
209
|
+
/** Native generation result for passing to trainStepWithGenerations */
|
|
210
|
+
nativeResult: NativeGenerateBatchResult;
|
|
211
|
+
/** Completion token counts (derived from nativeResult) */
|
|
212
|
+
tokenCounts: number[];
|
|
213
|
+
/** Finish reasons for each completion ("eos", "length", or "repetition") */
|
|
214
|
+
finishReasons: string[];
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Default configuration
|
|
218
|
+
*/
|
|
219
|
+
export declare const DEFAULT_GRPO_CONFIG: GRPOTrainerConfig;
|
|
220
|
+
/**
|
|
221
|
+
* Training step metrics (compatible with both old and new APIs)
|
|
222
|
+
*/
|
|
223
|
+
export interface TrainStepMetrics {
|
|
224
|
+
/** Current step number */
|
|
225
|
+
step: number;
|
|
226
|
+
/** GRPO loss value */
|
|
227
|
+
loss: number;
|
|
228
|
+
/** Mean reward across completions */
|
|
229
|
+
meanReward: number;
|
|
230
|
+
/** Standard deviation of rewards */
|
|
231
|
+
stdReward: number;
|
|
232
|
+
/** Mean advantage value */
|
|
233
|
+
meanAdvantage: number;
|
|
234
|
+
/** Std of advantages - indicates reward variance within groups */
|
|
235
|
+
stdAdvantage: number;
|
|
236
|
+
/** Total tokens generated this step */
|
|
237
|
+
totalTokens: number;
|
|
238
|
+
/** Whether gradients were applied */
|
|
239
|
+
gradientsApplied?: boolean;
|
|
240
|
+
/** Time for generation (ms) */
|
|
241
|
+
generationTimeMs?: number;
|
|
242
|
+
/** Time for training (ms) */
|
|
243
|
+
trainingTimeMs?: number;
|
|
244
|
+
/** Current epoch (for high-level API) */
|
|
245
|
+
epoch?: number;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Legacy type alias for backward compatibility
|
|
249
|
+
*/
|
|
250
|
+
export type TrainingMetrics = TrainStepMetrics;
|
|
251
|
+
/**
|
|
252
|
+
* Compute a hash of dataset content for identity checking on resume.
|
|
253
|
+
*
|
|
254
|
+
* Hashes the first N examples to create a fingerprint that can detect
|
|
255
|
+
* if the dataset has been modified between training runs.
|
|
256
|
+
*
|
|
257
|
+
* @param dataset - Array of dataset examples
|
|
258
|
+
* @param sampleSize - Number of examples to hash (default: 10)
|
|
259
|
+
* @returns 16-character hex hash string
|
|
260
|
+
*/
|
|
261
|
+
export declare function computeDatasetHash(dataset: DatasetExample[], sampleSize?: number): string;
|
|
262
|
+
/**
|
|
263
|
+
* Error thrown when a reward function times out.
|
|
264
|
+
*/
|
|
265
|
+
export declare class RewardTimeoutError extends Error {
|
|
266
|
+
readonly timeoutMs: number;
|
|
267
|
+
constructor(message: string, timeoutMs: number);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* GRPO Trainer - Rust-Native Training Engine
|
|
271
|
+
*
|
|
272
|
+
* Provides a TypeScript-friendly interface to the Rust training engine.
|
|
273
|
+
* Supports both high-level training (train()) and low-level step-by-step (trainStep()).
|
|
274
|
+
*/
|
|
275
|
+
export declare class GRPOTrainer<T = unknown> {
|
|
276
|
+
private engine;
|
|
277
|
+
private model;
|
|
278
|
+
private config;
|
|
279
|
+
private rewardFn?;
|
|
280
|
+
private currentEpoch;
|
|
281
|
+
private currentStep;
|
|
282
|
+
/** Original model path (for tokenizer files when saving checkpoints) */
|
|
283
|
+
private originalModelPath?;
|
|
284
|
+
private paused;
|
|
285
|
+
private stopRequested;
|
|
286
|
+
private stdinInterface?;
|
|
287
|
+
private logger;
|
|
288
|
+
private sampleDisplayMode;
|
|
289
|
+
private outputStore?;
|
|
290
|
+
private outputStoreInitPromise?;
|
|
291
|
+
private outputStoreRunId?;
|
|
292
|
+
private outputStorePath?;
|
|
293
|
+
private lastCheckpointStep;
|
|
294
|
+
private signalHandlersInstalled;
|
|
295
|
+
private lastGoodCheckpointPath;
|
|
296
|
+
private lastGoodCheckpointStep;
|
|
297
|
+
private datasetMetadata?;
|
|
298
|
+
private processedBatchIndices;
|
|
299
|
+
/**
|
|
300
|
+
* Create a new GRPO trainer from a model
|
|
301
|
+
*
|
|
302
|
+
* @param model - Pre-loaded Qwen3 model
|
|
303
|
+
* @param config - Training configuration
|
|
304
|
+
*/
|
|
305
|
+
constructor(model: Qwen3Model, config?: Partial<GRPOTrainerConfig<T>>, logger?: TrainingLogger);
|
|
306
|
+
/**
|
|
307
|
+
* Setup stdin handler for TUI control commands
|
|
308
|
+
*/
|
|
309
|
+
private setupStdinHandler;
|
|
310
|
+
/**
|
|
311
|
+
* Setup OS signal handlers for graceful shutdown on crash/interrupt
|
|
312
|
+
*
|
|
313
|
+
* Catches SIGTERM, SIGINT, and uncaught exceptions to:
|
|
314
|
+
* - Save emergency checkpoint (if > 10 steps since last)
|
|
315
|
+
* - Finalize OutputStore with 'crashed' status
|
|
316
|
+
* - Exit cleanly
|
|
317
|
+
*/
|
|
318
|
+
private setupSignalHandlers;
|
|
319
|
+
/**
|
|
320
|
+
* Initialize the output store for recording training outputs
|
|
321
|
+
*/
|
|
322
|
+
private initOutputStore;
|
|
323
|
+
/**
|
|
324
|
+
* Send minimal resume state to TUI for UI display only (no historical data)
|
|
325
|
+
*
|
|
326
|
+
* Used when resuming from checkpoint without a matching database run.
|
|
327
|
+
* Ensures TUI shows correct epoch/batch progress.
|
|
328
|
+
*/
|
|
329
|
+
private sendResumeStateUiOnly;
|
|
330
|
+
/**
|
|
331
|
+
* Send resume state to TUI for restoring sparklines and aggregates
|
|
332
|
+
*
|
|
333
|
+
* Queries the database for historical metrics and aggregates, then sends
|
|
334
|
+
* to TUI via the resumeState message.
|
|
335
|
+
*
|
|
336
|
+
* @param runId - Database run ID
|
|
337
|
+
* @param actualStepsPerEpoch - Actual steps per epoch from dataset (if known)
|
|
338
|
+
*/
|
|
339
|
+
private sendResumeState;
|
|
340
|
+
/**
|
|
341
|
+
* Ensure output store is initialized (lazy initialization for low-level API users)
|
|
342
|
+
* Uses promise mutex to prevent race conditions from concurrent calls.
|
|
343
|
+
*
|
|
344
|
+
* Call this method from custom training loops before starting training
|
|
345
|
+
* to enable database recording and TUI database tab.
|
|
346
|
+
*/
|
|
347
|
+
ensureOutputStoreInitialized(): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* Get the output store (for querying recorded data)
|
|
350
|
+
*/
|
|
351
|
+
getOutputStore(): OutputStore | undefined;
|
|
352
|
+
/**
|
|
353
|
+
* Handle a command received from stdin
|
|
354
|
+
*/
|
|
355
|
+
private handleStdinCommand;
|
|
356
|
+
/**
|
|
357
|
+
* Wait for resume if paused, with polling
|
|
358
|
+
*/
|
|
359
|
+
private waitForResume;
|
|
360
|
+
/**
|
|
361
|
+
* Create a trainer by loading a model from disk
|
|
362
|
+
*
|
|
363
|
+
* This is the recommended way to create a trainer for training runs.
|
|
364
|
+
* If resumeFromCheckpoint is set, loads from checkpoint instead of modelPath.
|
|
365
|
+
*
|
|
366
|
+
* @param config - Configuration including modelPath
|
|
367
|
+
* @returns Promise<GRPOTrainer>
|
|
368
|
+
*/
|
|
369
|
+
static create<U>(config: GRPOTrainerConfig<U>): Promise<GRPOTrainer<U>>;
|
|
370
|
+
/**
|
|
371
|
+
* Find the latest checkpoint in the output directory
|
|
372
|
+
*/
|
|
373
|
+
static findLatestCheckpoint(outputDir?: string): string | null;
|
|
374
|
+
/**
|
|
375
|
+
* Register a built-in reward function
|
|
376
|
+
*
|
|
377
|
+
* Built-in rewards run entirely in Rust with no FFI overhead.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```typescript
|
|
381
|
+
* // Tool use validation
|
|
382
|
+
* trainer.registerBuiltinReward({
|
|
383
|
+
* rewardType: 'ToolUse',
|
|
384
|
+
* allowedTools: ['search', 'calculate'],
|
|
385
|
+
* required: true,
|
|
386
|
+
* weight: 1.0,
|
|
387
|
+
* });
|
|
388
|
+
*
|
|
389
|
+
* // XML format validation
|
|
390
|
+
* trainer.registerBuiltinReward({
|
|
391
|
+
* rewardType: 'XmlFormat',
|
|
392
|
+
* requiredTags: ['thinking', 'answer'],
|
|
393
|
+
* weight: 0.5,
|
|
394
|
+
* });
|
|
395
|
+
*
|
|
396
|
+
* // Length-based reward
|
|
397
|
+
* trainer.registerBuiltinReward({
|
|
398
|
+
* rewardType: 'Length',
|
|
399
|
+
* minLength: 100,
|
|
400
|
+
* maxLength: 500,
|
|
401
|
+
* useChars: true,
|
|
402
|
+
* });
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
registerBuiltinReward(config: BuiltinRewardConfig): void;
|
|
406
|
+
/**
|
|
407
|
+
* Set a custom JavaScript reward function
|
|
408
|
+
*
|
|
409
|
+
* The function will be called after generation to compute rewards.
|
|
410
|
+
*
|
|
411
|
+
* @param fn - Reward function that takes prompts and completions
|
|
412
|
+
*/
|
|
413
|
+
setRewardFunction(fn: RewardFunction<T>): void;
|
|
414
|
+
/**
|
|
415
|
+
* Generate completions for prompts
|
|
416
|
+
*
|
|
417
|
+
* Generates `groupSize` completions per prompt.
|
|
418
|
+
* Returns all data needed for training, including tokens and log probabilities.
|
|
419
|
+
*
|
|
420
|
+
* @param prompts - Array of chat conversations
|
|
421
|
+
* @returns GenerateBatchResult with completion texts and native generation data
|
|
422
|
+
*/
|
|
423
|
+
generateBatch(prompts: ChatMessage[][]): Promise<GenerateBatchResult>;
|
|
424
|
+
/**
|
|
425
|
+
* Score completions using built-in rewards
|
|
426
|
+
*
|
|
427
|
+
* @param prompts - Prompt texts (one per completion)
|
|
428
|
+
* @param completions - Completion texts
|
|
429
|
+
* @returns Array of reward scores
|
|
430
|
+
*/
|
|
431
|
+
scoreCompletions(prompts: string[], completions: string[]): number[];
|
|
432
|
+
/**
|
|
433
|
+
* Score generations using the configured reward function.
|
|
434
|
+
*
|
|
435
|
+
* Builds RewardOutput array with structured completion data and passes to reward function.
|
|
436
|
+
*
|
|
437
|
+
* @param prompts - Array of chat conversations
|
|
438
|
+
* @param completions - Generated completion texts
|
|
439
|
+
* @param context - Context for the reward function
|
|
440
|
+
* @param groupSize - Number of completions per prompt (optional, defaults to config.groupSize)
|
|
441
|
+
* @param tokenCounts - Token counts for each completion (optional, defaults to 0s)
|
|
442
|
+
* @param finishReasons - Finish reasons from generation (optional, e.g. "eos", "length", "repetition")
|
|
443
|
+
* @returns Promise<Float32Array> of reward scores
|
|
444
|
+
*/
|
|
445
|
+
scoreGenerations(prompts: ChatMessage[][], completions: string[], context: T, groupSize?: number, tokenCounts?: number[], finishReasons?: string[]): Promise<Float32Array>;
|
|
446
|
+
/**
|
|
447
|
+
* Run a training step
|
|
448
|
+
*
|
|
449
|
+
* This method:
|
|
450
|
+
* 1. Generates completions with tokens and log probabilities
|
|
451
|
+
* 2. Computes rewards using the configured reward function
|
|
452
|
+
* 3. Trains using the SAME completions that were scored (no double-generation)
|
|
453
|
+
*
|
|
454
|
+
* @param prompts - Array of chat conversations
|
|
455
|
+
* @returns Training step metrics
|
|
456
|
+
*/
|
|
457
|
+
trainStep(prompts: ChatMessage[][], context?: T): Promise<TrainStepMetrics>;
|
|
458
|
+
/**
|
|
459
|
+
* Run a complete training step with automatic reward computation
|
|
460
|
+
*
|
|
461
|
+
* This method combines generation, reward scoring, and training into a single
|
|
462
|
+
* Rust call, eliminating FFI overhead by keeping token data in Rust memory.
|
|
463
|
+
*
|
|
464
|
+
* 1. Generates completions with full token/logprob data (stays in Rust)
|
|
465
|
+
* 2. Calls JS reward function with RewardOutput[]
|
|
466
|
+
* 3. Performs training update using the in-memory data
|
|
467
|
+
*
|
|
468
|
+
* @param prompts - Array of chat conversations
|
|
469
|
+
* @param context - Context for the reward function
|
|
470
|
+
* @returns Training metrics and generated completions
|
|
471
|
+
*/
|
|
472
|
+
trainStepAuto(prompts: ChatMessage[][], context?: T): Promise<{
|
|
473
|
+
metrics: TrainStepMetrics;
|
|
474
|
+
completions: string[];
|
|
475
|
+
rewards: number[];
|
|
476
|
+
completionLengths: number[];
|
|
477
|
+
}>;
|
|
478
|
+
/**
|
|
479
|
+
* Increment the step counter (for custom training loops)
|
|
480
|
+
*
|
|
481
|
+
* Call this after each training step when using low-level APIs like
|
|
482
|
+
* engine.trainStepWithGenerations() instead of trainer.trainStepAuto().
|
|
483
|
+
*/
|
|
484
|
+
incrementStep(): void;
|
|
485
|
+
/**
|
|
486
|
+
* Get the current step number
|
|
487
|
+
*/
|
|
488
|
+
getStep(): number;
|
|
489
|
+
/**
|
|
490
|
+
* Get the current epoch number
|
|
491
|
+
*/
|
|
492
|
+
getEpoch(): number;
|
|
493
|
+
/**
|
|
494
|
+
* Record a training step to the output store database (for custom training loops)
|
|
495
|
+
*
|
|
496
|
+
* Use this when building custom training loops with engine.trainStepWithGenerations().
|
|
497
|
+
* The step number should be the value after incrementStep() was called.
|
|
498
|
+
*
|
|
499
|
+
* @param step - Step number
|
|
500
|
+
* @param metrics - Step metrics from the engine
|
|
501
|
+
* @param completions - Generated completion texts
|
|
502
|
+
* @param rewards - Reward values for each completion
|
|
503
|
+
* @param prompts - Prompt messages for each completion
|
|
504
|
+
*/
|
|
505
|
+
recordStepToDatabase(step: number, metrics: {
|
|
506
|
+
loss: number;
|
|
507
|
+
meanReward: number;
|
|
508
|
+
stdReward: number;
|
|
509
|
+
meanAdvantage: number;
|
|
510
|
+
stdAdvantage: number;
|
|
511
|
+
totalTokens: number;
|
|
512
|
+
}, completions: string[], rewards: number[], prompts: string[]): Promise<void>;
|
|
513
|
+
/**
|
|
514
|
+
* Run a full training loop over a dataset
|
|
515
|
+
*
|
|
516
|
+
* This is the high-level training API that handles:
|
|
517
|
+
* - Epoch iteration
|
|
518
|
+
* - Batching
|
|
519
|
+
* - Generation and reward computation
|
|
520
|
+
* - Logging (if configured)
|
|
521
|
+
* - Checkpoint saving and resumption
|
|
522
|
+
* - TUI mode support (pause/resume, sample reporting)
|
|
523
|
+
*
|
|
524
|
+
* @param dataset - Array of DatasetExample items
|
|
525
|
+
*/
|
|
526
|
+
train(dataset: DatasetExample[]): Promise<void>;
|
|
527
|
+
/**
|
|
528
|
+
* Save a checkpoint with model weights and training state
|
|
529
|
+
*
|
|
530
|
+
* Regular checkpoints (non-emergency) are tracked as "last known good" checkpoints.
|
|
531
|
+
* When NaN gradients occur, the emergency save logic can restore from the last good checkpoint.
|
|
532
|
+
*
|
|
533
|
+
* @param name - Checkpoint name (default: "checkpoint-{step}")
|
|
534
|
+
* @param options - Optional settings for checkpoint save behavior
|
|
535
|
+
* @param options.isEmergency - If true, this is an emergency checkpoint (debug state, not "good")
|
|
536
|
+
* @returns Path to saved checkpoint, or empty string if save was skipped due to corruption
|
|
537
|
+
*/
|
|
538
|
+
saveCheckpoint(name?: string, options?: {
|
|
539
|
+
isEmergency?: boolean;
|
|
540
|
+
}): Promise<string>;
|
|
541
|
+
/**
|
|
542
|
+
* Remove old checkpoints, keeping only the most recent ones
|
|
543
|
+
* Preserves 'final' and 'emergency-*' checkpoints
|
|
544
|
+
*/
|
|
545
|
+
private cleanupOldCheckpoints;
|
|
546
|
+
/**
|
|
547
|
+
* Start a new training epoch
|
|
548
|
+
*/
|
|
549
|
+
startEpoch(): void;
|
|
550
|
+
/**
|
|
551
|
+
* End the current epoch and get metrics
|
|
552
|
+
*
|
|
553
|
+
* @param epochTimeSecs - Duration of the epoch in seconds
|
|
554
|
+
*/
|
|
555
|
+
endEpoch(epochTimeSecs: number): EngineEpochMetrics;
|
|
556
|
+
/**
|
|
557
|
+
* Reset the trainer for a new training run
|
|
558
|
+
*/
|
|
559
|
+
reset(): void;
|
|
560
|
+
/**
|
|
561
|
+
* Get current training step
|
|
562
|
+
*/
|
|
563
|
+
get step(): number;
|
|
564
|
+
/**
|
|
565
|
+
* Get current epoch
|
|
566
|
+
*/
|
|
567
|
+
get epoch(): number;
|
|
568
|
+
/**
|
|
569
|
+
* Get current micro-step within gradient accumulation
|
|
570
|
+
*/
|
|
571
|
+
get microStep(): number;
|
|
572
|
+
/**
|
|
573
|
+
* Check if built-in rewards are configured
|
|
574
|
+
*/
|
|
575
|
+
get hasBuiltinRewards(): boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Get names of registered reward functions
|
|
578
|
+
*/
|
|
579
|
+
get rewardNames(): string[];
|
|
580
|
+
/**
|
|
581
|
+
* Get the underlying native engine
|
|
582
|
+
*
|
|
583
|
+
* For advanced use cases that need direct access.
|
|
584
|
+
*/
|
|
585
|
+
getNativeEngine(): GrpoTrainingEngine;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Create a standalone reward registry for testing rewards
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```typescript
|
|
592
|
+
* const registry = createRewardRegistry();
|
|
593
|
+
* registry.register({
|
|
594
|
+
* rewardType: 'ToolUse',
|
|
595
|
+
* allowedTools: ['search'],
|
|
596
|
+
* });
|
|
597
|
+
*
|
|
598
|
+
* const score = registry.score('prompt', 'completion with <tool_call>...</tool_call>');
|
|
599
|
+
* ```
|
|
600
|
+
*/
|
|
601
|
+
export declare function createRewardRegistry(): NativeRewardRegistry;
|
|
602
|
+
//# sourceMappingURL=grpo-trainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpo-trainer.d.ts","sourceRoot":"","sources":["../../src/trainers/grpo-trainer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAiBH,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,WAAW,EAGX,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,IAAI,yBAAyB,EAGrD,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvF,YAAY,EACV,gBAAgB,EAChB,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