Help/possible bug: custom local endpoint shows ~37K max context tokens and triggers summarisation earlier than backend window #14229
Replies: 3 comments
-
|
Got a bit confused with the change from an issue to a discussion, but got an update: Resolved it (debatedly in a less ideal/temporarily way, as I think there is a more elegant/automatic way to get the model info better). Basically, I need to use endpoints:
custom:
- name: local-llama-cluster
apiKey: dummy-key
baseURL: http://host.docker.internal:11434/v1
models:
default:
- Qwen3.6-27B-MTP-Code-NoQuant
fetch: true
titleConvo: true
titleModel: current_model
modelDisplayLabel: Llama.cpp
tokenConfig:
Qwen3.6-27B-General:
prompt: 1
completion: 1
context: 262144
Qwen3.6-27B-MTP-Code:
prompt: 1
completion: 1
context: 262144
Qwen3.6-27B-MTP-Code-NoQuant:
prompt: 1
completion: 1
context: 200000
Qwen3.6-35B-A3B-Q6-General:
prompt: 1
completion: 1
context: 262144 |
Beta Was this translation helpful? Give feedback.
-
|
Maybe, since some self‑hosted backends already expose (or have the ability to enable this exposure) their effective context window via That would reduce the need for manual tokenConfig entries and make it easier for users to plug in large‑context local models without having to keep multiple places in sync. Of course, the explicit tokenConfig override is still very useful for edge cases and fine‑tuning. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the thorough writeup, and glad Where the ~37K comes from: when a conversation is not carrying an explicit Q1 (does Q2 (recommended way to declare 200k on a generic custom endpoint): Yes, Q3 (should you expose On auto-deriving the value: reasonable idea. The main blocker is that the OpenAI |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I’m running LibreChat against a self‑hosted local LLM stack (proxy + llama.cpp server) and I’m trying to align LibreChat’s effective context window that is shown in the UI with the larger window configured in my backend.
It’s very possible I’m missing a configuration step or using
modelSpecsincorrectly, so I’d appreciate guidance rather than assuming this is a bug straight away.Environment
llama-server)custom(OpenAI‑style/v1/*)Goal
I have several large‑context models hosted via llama.cpp (Qwen‑family 27B/35B) with context sizes around 200k–262k configured via
--ctx-size. I’d like LibreChat’s “Maximum context tokens” and summarisation logic to reflect those larger effective windows, rather than a smaller generic default.Right now, it appears that conversations with these models are being summarised earlier than necessary relative to the backend’s actual window.
Backend configuration (summary)
One representative model:
The proxy is started with a config pointing at this file and listens on a public port (e.g.
0.0.0.0:11434).The OpenAI‑style
/v1/modelsendpoint for this id returns:{ "id": "Qwen3.6-27B-MTP-Code-NoQuant", "object": "model", "created": 1783895129, "owned_by": "llama-swap", "meta": { "llamaswap": { "context_length": 200000, "description": "Qwen3.6-27B MTP Code, 200k ctx, cluster backend", "tags": ["qwen","code","mtp","200k_ctx"] } }, "status": { "value": "unloaded" } }So the backend is aware of a 200k window and exposes that in metadata (nested under
meta.llamaswap.context_length).LibreChat configuration
In
librechat.yamlI have a custom endpoint and model specs like:So there is:
modelSpecsentries that setmaxContextTokensto match the backend--ctx-size.Observed behaviour
When I select
Qwen3.6-27B-MTP-Code-NoQuantvia the custom endpoint in LibreChat:modelSpecs.maxContextTokensbeing 262144.In other words, summarisation and context trimming appear to be happening earlier than necessary for these large‑context models.
What I might be missing
I’m not sure whether:
modelSpecs.parameters.maxContextTokensis supposed to work for custom endpoints.modelSpecsfor generic custom/OpenAI endpoints and uses an internal default for context window / summarisation.context_lengthdifferently in/v1/models(e.g. as a top‑level field instead of nested undermeta) for LibreChat to pick it up.Questions
modelSpecs.parameters.maxContextTokensexpected to override the effective context window used by LibreChat’s token accounting and summarisation, or is it currently only wired for specific providers?context_lengthin/v1/modelsfor LibreChat to detect, or is that metadata ignored for custom endpoints?If the current behaviour is expected and I’m just missing a configuration step, I’d be grateful for any pointers to the right docs or an example
librechat.yamlpattern for large‑context custom models.If there’s a known limitation with custom endpoints and large context windows (causing summarisation to kick in based on an internal cap), I’d be interested in any suggested workarounds or in helping test changes that make
modelSpecs.maxContextTokensor/v1/modelsmetadata feed into that logic.Thanks very much in advance.
(issue based on a summarisation of a multi hour back and forth with Perplexity AI, hence it might sound LLM-y, but has been reviewed and corrected where approriate)
Beta Was this translation helpful? Give feedback.
All reactions