Repository navigation
Support a larger context window #1416
Description
Rewritten after @barhanc's reply. The original text asked for a specific
option on thecommon/runner/LLMControllerpath; that was the wrong
target, since that API is deprecated and the real ceiling is the exported
model. The underlying need is unchanged, so here it is stated as the outcome
rather than as an API shape.
What we are asking for
The ability to run with a meaningfully larger context window than is possible
today — not a particular API. Whatever form it takes (models exported with a
longer context, a documented path for exporting our own, or a runtime option
where one is feasible), the outcome we need is more usable prompt tokens on
device.
This is deliberately not scoped to the current architecture. If it only ever
lands in 0.10+, that is fine by us.
Why it matters to us
Private Mind does
on-device RAG and document chat. Today we budget 2048 tokens per model and
reserve 768 of those for generation, which leaves roughly 1280 tokens of
usable prompt. Retrieved passages, a system prompt and conversation history do
not fit together in that budget, so the prompt is truncated well before the
model's own capability is reached. It is the single biggest constraint on that
feature.
To be straight about our own side: that 2048 is a constant in our app, and we do
not currently read the runtime value at all. Raising our constant is ours to do
— but it only buys anything up to whatever the exported model actually supports,
and that ceiling is what this issue is about.
What would help
-
Models exported with a larger context window. This is the main ask. We
saw the note about experimenting with roughly 10x context and would be glad
to test those builds against a real RAG workload on a range of devices. -
Publish the context length each shipped model was exported with. This is
the small, cheap half. Right now the number is not stated on the Hugging Face
model cards, so an application either queries it at runtime or guesses. We
guessed, and picked 2048 for every family. Putting the exported context
length next to each model — in the model card or in the exported model
constants — would let apps size their prompt budget correctly without
discovering it by experiment.
On sliding-window strategies
Agreed that they are fragile, and doubly so for RAG — dropping earlier turns
silently changes what the model was grounded on. We truncate rather than slide
for that reason, which is precisely why the raw budget is what binds for us.
Environment
react-native-executorch0.9.2- iOS and Android
Activity
barhanc commentedon Sep 7, 2026
Is this a request for legacy API changes? Because in new 0.10 architecture there is no
common/runnerand noLLMController.tsand since this API is deprecated we are not planning to change it anymore as it will be removed in the future release. Also the context length is an inherent limitation of the exported model, you can't just increase it arbitrarily and using sliding strategies is fragile (especially in RAG context). We will experiment with exporting LLMs with much larger context (like 10x) using @IgorSwat's trick to mitigate the memory issues that arise when exporting with huge context lengths.[-]Expose max context length as a load-time option[/-][+]Support a larger context window[/+]barhanc commentedon Oct 22, 2026
Closed as completed in #1508