bitgpu 0.7.0 → 0.9.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.
@@ -122,6 +122,26 @@ interface GenerateOptions {
122
122
  ngramSize?: number;
123
123
  maxDraft?: number;
124
124
  };
125
+ /** Per-token TRUE logprobs (log-softmax over the full vocabulary, after penalties): set to N
126
+ * (1..32) to receive the emitted token's logprob plus the top-N alternatives each step in
127
+ * {@link GenerateResult.logprobs}. Exact, not a top-K approximation - the normalizer is a GPU
128
+ * log-sum-exp over all logits (one extra f32 readback per step). Routes greedy turns through
129
+ * the per-step sampler path and disables `promptLookup` (a verified draft step has no
130
+ * per-token candidate readback); sampled turns pay nothing extra. Use it to expose model
131
+ * confidence: a low top-1 logprob or a flat top-N is the model guessing. Default off. */
132
+ logprobs?: number;
133
+ }
134
+ /** One emitted token's logprob record (see {@link GenerateOptions.logprobs}). */
135
+ interface TokenLogprobs {
136
+ /** The emitted token's logprob (log-softmax over the full vocab, post-penalty). Under a
137
+ * candidateFilter this is the logprob of the token actually chosen, which the filter may
138
+ * have forced far below the top alternatives. */
139
+ logprob: number;
140
+ /** The top-N (id, logprob) pairs in descending order, independent of what was emitted. */
141
+ top: {
142
+ id: number;
143
+ logprob: number;
144
+ }[];
125
145
  }
126
146
  /** Result of a {@link Engine.generate} call. */
127
147
  interface GenerateResult {
@@ -150,6 +170,9 @@ interface GenerateResult {
150
170
  accepted: number;
151
171
  bailed?: boolean;
152
172
  };
173
+ /** Present when {@link GenerateOptions.logprobs} was set: one record per emitted token,
174
+ * aligned with `tokens`. */
175
+ logprobs?: TokenLogprobs[];
153
176
  }
154
177
  /** Diagnostic result of {@link Engine.forward}: hidden states + logits for a single forward pass. */
155
178
  interface ForwardResult {
@@ -208,5 +231,5 @@ interface Engine {
208
231
  dispose(): void;
209
232
  }
210
233
  //#endregion
211
- export { ForwardResult as a, LoadProgress as c, EngineOptions as i, Engine as n, GenerateOptions as o, EngineCapabilities as r, GenerateResult as s, DeviceLostInfo as t };
212
- //# sourceMappingURL=types-CsoJYJlG.d.ts.map
234
+ export { ForwardResult as a, LoadProgress as c, EngineOptions as i, TokenLogprobs as l, Engine as n, GenerateOptions as o, EngineCapabilities as r, GenerateResult as s, DeviceLostInfo as t };
235
+ //# sourceMappingURL=types-C5f2IKgm.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitgpu",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Fast WebGPU runtime for 1-bit (binary-weight) LLMs in the browser. Bit-exact, zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "license": "MIT",