Skip to content

Commit cc7f866

Browse files
committed
docs(0.8): move LLM sampling docs into versioned-0.8.x
The cherry-pick of #1099 landed sampling/VLM doc updates under docs/docs/ (the "Next" version on main). On release/0.8 those changes belong in docs/versioned_docs/version-0.8.x/, so revert the unversioned files to the release/0.8 baseline and apply the same edits to the versioned 0.8.x copies.
1 parent 78e7fd7 commit cc7f866

4 files changed

Lines changed: 36 additions & 36 deletions

File tree

  • docs
    • docs
      • 03-hooks/01-natural-language-processing
      • 04-typescript-api/01-natural-language-processing
    • versioned_docs/version-0.8.x
      • 03-hooks/01-natural-language-processing
      • 04-typescript-api/01-natural-language-processing

docs/docs/03-hooks/01-natural-language-processing/useLLM.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,7 @@ To configure model (i.e. change system prompt, load initial conversation history
208208

209209
- [`temperature`](../../06-api-reference/interfaces/GenerationConfig.md#temperature) - Scales output logits by the inverse of temperature. Controls the randomness / creativity of text generation.
210210

211-
- [`topP`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topP. Range `[0, 1]`. Values of `0` or `1` disable top-p filtering.
212-
213-
- [`minP`](../../06-api-reference/interfaces/GenerationConfig.md#minp) - Minimum-probability threshold applied after softmax: tokens whose probability is below `minP * max_prob` are excluded from sampling. Range `[0, 1]`. Default `0` disables the filter. Stacks with `topP` when both are set.
214-
215-
- [`repetitionPenalty`](../../06-api-reference/interfaces/GenerationConfig.md#repetitionpenalty) - Multiplicative penalty applied to logits of tokens that already appeared in the prompt or the generated text. Values greater than `1` discourage repetition; default `1` disables the penalty.
216-
217-
:::info[Built-in models ship with sampling defaults]
218-
Model presets expose an optional [`generationConfig`](../../06-api-reference/interfaces/LLMProps.md) on the `model` prop. Whenever the upstream model card publishes recommended values (currently Qwen3 and LFM2-VL) the preset carries them and `useLLM` applies them automatically before `isReady` flips — you don't need to call `configure` just to get sensible defaults. Any fields you then pass to `configure` still override on a per-field basis.
219-
:::
211+
- [`topp`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topp.
220212

221213
### Model configuration example
222214

@@ -287,9 +279,7 @@ useEffect(() => {
287279
outputTokenBatchSize: 15,
288280
batchTimeInterval: 100,
289281
temperature: 0.7,
290-
topP: 0.9,
291-
minP: 0.05,
292-
repetitionPenalty: 1.05,
282+
topp: 0.9,
293283
},
294284
});
295285
}, [configure]);
@@ -498,9 +488,9 @@ Some models support multimodal input — text and images together. To use them,
498488
### Loading a VLM
499489

500490
```tsx
501-
import { useLLM, LFM2_5_VL_1_6B_QUANTIZED } from 'react-native-executorch';
491+
import { useLLM, LFM2_VL_1_6B_QUANTIZED } from 'react-native-executorch';
502492

503-
const llm = useLLM({ model: LFM2_5_VL_1_6B_QUANTIZED });
493+
const llm = useLLM({ model: LFM2_VL_1_6B_QUANTIZED });
504494
```
505495

506496
The `capabilities` field is already set on the model constant. You can also construct the model object explicitly:
@@ -521,7 +511,7 @@ Passing `capabilities` unlocks the typed `media` argument on `sendMessage`.
521511
### Sending a message with an image
522512

523513
```tsx
524-
const llm = useLLM({ model: LFM2_5_VL_1_6B_QUANTIZED });
514+
const llm = useLLM({ model: LFM2_VL_1_6B_QUANTIZED });
525515

526516
const send = () => {
527517
llm.sendMessage('What is in this image?', {
@@ -544,7 +534,7 @@ The `imagePath` should be a local file path on the device.
544534
You can also use `generate` directly by setting `mediaPath` on user messages:
545535

546536
```tsx
547-
const llm = useLLM({ model: LFM2_5_VL_1_6B_QUANTIZED });
537+
const llm = useLLM({ model: LFM2_VL_1_6B_QUANTIZED });
548538

549539
const handleGenerate = async () => {
550540
const chat: Message[] = [

docs/docs/04-typescript-api/01-natural-language-processing/LLMModule.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,25 +107,17 @@ To configure model (i.e. change system prompt, load initial conversation history
107107

108108
- [`temperature`](../../06-api-reference/interfaces/GenerationConfig.md#temperature) - Scales output logits by the inverse of temperature. Controls the randomness / creativity of text generation.
109109

110-
- [`topP`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topP. Range `[0, 1]`. Values of `0` or `1` disable top-p filtering.
111-
112-
- [`minP`](../../06-api-reference/interfaces/GenerationConfig.md#minp) - Minimum-probability threshold applied after softmax: tokens whose probability is below `minP * max_prob` are excluded from sampling. Range `[0, 1]`. Default `0` disables the filter. Stacks with `topP` when both are set.
113-
114-
- [`repetitionPenalty`](../../06-api-reference/interfaces/GenerationConfig.md#repetitionpenalty) - Multiplicative penalty applied to logits of tokens that already appeared in the prompt or the generated text. Values greater than `1` discourage repetition; default `1` disables the penalty.
115-
116-
:::info[Built-in models ship with sampling defaults]
117-
Model presets expose an optional `generationConfig` that `LLMModule.fromModelName` applies automatically when available — for Qwen3 and LFM2-VL this means the model-card recommended sampling settings are in effect without any explicit `configure` call. Any fields you pass to `configure` still override on a per-field basis.
118-
:::
110+
- [`topp`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topp.
119111

120112
## Vision-Language Models (VLM)
121113

122114
Some models support multimodal input — text and images together. To use them, pass `capabilities` in the model object when calling [`fromModelName`](../../06-api-reference/classes/LLMModule.md#frommodelname):
123115

124116
```typescript
125-
import { LLMModule, LFM2_5_VL_1_6B_QUANTIZED } from 'react-native-executorch';
117+
import { LLMModule, LFM2_VL_1_6B_QUANTIZED } from 'react-native-executorch';
126118

127119
const llm = await LLMModule.fromModelName(
128-
LFM2_5_VL_1_6B_QUANTIZED,
120+
LFM2_VL_1_6B_QUANTIZED,
129121
undefined,
130122
(token) => console.log(token)
131123
);

docs/versioned_docs/version-0.8.x/03-hooks/01-natural-language-processing/useLLM.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,15 @@ To configure model (i.e. change system prompt, load initial conversation history
208208

209209
- [`temperature`](../../06-api-reference/interfaces/GenerationConfig.md#temperature) - Scales output logits by the inverse of temperature. Controls the randomness / creativity of text generation.
210210

211-
- [`topp`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topp.
211+
- [`topP`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topP. Range `[0, 1]`. Values of `0` or `1` disable top-p filtering.
212+
213+
- [`minP`](../../06-api-reference/interfaces/GenerationConfig.md#minp) - Minimum-probability threshold applied after softmax: tokens whose probability is below `minP * max_prob` are excluded from sampling. Range `[0, 1]`. Default `0` disables the filter. Stacks with `topP` when both are set.
214+
215+
- [`repetitionPenalty`](../../06-api-reference/interfaces/GenerationConfig.md#repetitionpenalty) - Multiplicative penalty applied to logits of tokens that already appeared in the prompt or the generated text. Values greater than `1` discourage repetition; default `1` disables the penalty.
216+
217+
:::info[Built-in models ship with sampling defaults]
218+
Model presets expose an optional [`generationConfig`](../../06-api-reference/interfaces/LLMProps.md) on the `model` prop. Whenever the upstream model card publishes recommended values (currently Qwen3 and LFM2-VL) the preset carries them and `useLLM` applies them automatically before `isReady` flips — you don't need to call `configure` just to get sensible defaults. Any fields you then pass to `configure` still override on a per-field basis.
219+
:::
212220

213221
### Model configuration example
214222

@@ -279,7 +287,9 @@ useEffect(() => {
279287
outputTokenBatchSize: 15,
280288
batchTimeInterval: 100,
281289
temperature: 0.7,
282-
topp: 0.9,
290+
topP: 0.9,
291+
minP: 0.05,
292+
repetitionPenalty: 1.05,
283293
},
284294
});
285295
}, [configure]);
@@ -488,9 +498,9 @@ Some models support multimodal input — text and images together. To use them,
488498
### Loading a VLM
489499

490500
```tsx
491-
import { useLLM, LFM2_VL_1_6B_QUANTIZED } from 'react-native-executorch';
501+
import { useLLM, LFM2_5_VL_1_6B_QUANTIZED } from 'react-native-executorch';
492502

493-
const llm = useLLM({ model: LFM2_VL_1_6B_QUANTIZED });
503+
const llm = useLLM({ model: LFM2_5_VL_1_6B_QUANTIZED });
494504
```
495505

496506
The `capabilities` field is already set on the model constant. You can also construct the model object explicitly:
@@ -511,7 +521,7 @@ Passing `capabilities` unlocks the typed `media` argument on `sendMessage`.
511521
### Sending a message with an image
512522

513523
```tsx
514-
const llm = useLLM({ model: LFM2_VL_1_6B_QUANTIZED });
524+
const llm = useLLM({ model: LFM2_5_VL_1_6B_QUANTIZED });
515525

516526
const send = () => {
517527
llm.sendMessage('What is in this image?', {
@@ -534,7 +544,7 @@ The `imagePath` should be a local file path on the device.
534544
You can also use `generate` directly by setting `mediaPath` on user messages:
535545

536546
```tsx
537-
const llm = useLLM({ model: LFM2_VL_1_6B_QUANTIZED });
547+
const llm = useLLM({ model: LFM2_5_VL_1_6B_QUANTIZED });
538548

539549
const handleGenerate = async () => {
540550
const chat: Message[] = [

docs/versioned_docs/version-0.8.x/04-typescript-api/01-natural-language-processing/LLMModule.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,25 @@ To configure model (i.e. change system prompt, load initial conversation history
107107

108108
- [`temperature`](../../06-api-reference/interfaces/GenerationConfig.md#temperature) - Scales output logits by the inverse of temperature. Controls the randomness / creativity of text generation.
109109

110-
- [`topp`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topp.
110+
- [`topP`](../../06-api-reference/interfaces/GenerationConfig.md#topp) - Only samples from the smallest set of tokens whose cumulative probability exceeds topP. Range `[0, 1]`. Values of `0` or `1` disable top-p filtering.
111+
112+
- [`minP`](../../06-api-reference/interfaces/GenerationConfig.md#minp) - Minimum-probability threshold applied after softmax: tokens whose probability is below `minP * max_prob` are excluded from sampling. Range `[0, 1]`. Default `0` disables the filter. Stacks with `topP` when both are set.
113+
114+
- [`repetitionPenalty`](../../06-api-reference/interfaces/GenerationConfig.md#repetitionpenalty) - Multiplicative penalty applied to logits of tokens that already appeared in the prompt or the generated text. Values greater than `1` discourage repetition; default `1` disables the penalty.
115+
116+
:::info[Built-in models ship with sampling defaults]
117+
Model presets expose an optional `generationConfig` that `LLMModule.fromModelName` applies automatically when available — for Qwen3 and LFM2-VL this means the model-card recommended sampling settings are in effect without any explicit `configure` call. Any fields you pass to `configure` still override on a per-field basis.
118+
:::
111119

112120
## Vision-Language Models (VLM)
113121

114122
Some models support multimodal input — text and images together. To use them, pass `capabilities` in the model object when calling [`fromModelName`](../../06-api-reference/classes/LLMModule.md#frommodelname):
115123

116124
```typescript
117-
import { LLMModule, LFM2_VL_1_6B_QUANTIZED } from 'react-native-executorch';
125+
import { LLMModule, LFM2_5_VL_1_6B_QUANTIZED } from 'react-native-executorch';
118126

119127
const llm = await LLMModule.fromModelName(
120-
LFM2_VL_1_6B_QUANTIZED,
128+
LFM2_5_VL_1_6B_QUANTIZED,
121129
undefined,
122130
(token) => console.log(token)
123131
);

0 commit comments

Comments
 (0)