n_ctx_train - the model's trained ceiling
nctxtrain is the maximum context length the model was trained on.
Short answer
n_ctx_train is the maximum context length the model was trained on. It’s the hard upper limit - pushing beyond it produces garbage output. Read from the GGUF header on model add.
Detailed explanation
Models learn to handle sequences up to a specific length during training. Llama 3.1 8B was trained on 128K. Qwen 2.5 3B: 32K. DeepSeek R1: 164K. Older models like Llama 2 7B: only 4K.
This ceiling is baked into the model architecture - positional embeddings, RoPE frequency, attention patterns are all tuned for that length. Ask a 4K-trained model to work with 8K of input and the output degrades sharply: repetition, loss of coherence, hallucinated content.
Abliteration reads n_ctx_train directly from the GGUF header ({architecture}.context_length metadata key). This is the actual value from the model’s training config, not a guess based on the model family.
Why it matters vs the context you set:
n_ctx_train is the maximum possible. Your setting can be anywhere from ~512 up to n_ctx_train. Common reasons to set lower:
- Save RAM (KV cache grows with context)
- Faster prefill (less to process on each turn)
- Match your actual use case (no point allocating 128K for short chats)
Common reasons to push higher:
- Long documents
- Multi-model Council chats with lots of history
- Reasoning models that generate huge
<think>blocks
Why it matters
Two 7B models can have very different practical context - one trained on 4K, one on 128K. Same file size, same speed, but the 128K one can hold a whole book while the 4K one loses track after a few pages. When picking a model, n_ctx_train is as important as parameter count for anything document-heavy.
In Abliteration specifically
Shown in the Model info tooltip alongside current allocated context: Working memory: 8192 tokens · Model's full capacity: 32,768 tokens.
Shown on the Models tab row subtitle: Context: 16K (of 32K max) - pairs your current allocated context with the model’s n_ctx_train.
The context slider in Edit dialog is capped at min(n_ctx_train, 131072) - the app won’t let you allocate more than the model was trained for (that would produce garbage), and it enforces a hard 128K practical ceiling for RAM reasons.
If a GGUF header is malformed and n_ctx_train can’t be read, Abliteration silently falls back to a conservative default (8192). There is no user-facing warning in this case - the fallback happens transparently.
Related
- Context length - the practical concept
- Context slider - the UI for setting your value
- GGUF format - where n_ctx_train is read from