Skip to content

Read each model's trained context maximum from GGUF metadata #11

Description

@ssandys

README.md currently admits a limitation Colophon could remove:

num_ctx's ceiling in the editor is a fixed bound, not the model's own trained maximum. A model trained at a smaller context will still accept a larger window you set and quietly degrade rather than error — the real trained maximum lives in GGUF metadata the manifest tree doesn't carry, so Colophon has no way to know it and cannot warn you before you set one too high.

This is the one limitation a user can actually hurt themselves with: the write succeeds, nothing errors, and the model just gets worse.

It is knowable. The trained context length is in the GGUF header of the model's own weights blob. Reading it turns a fixed 131072 ceiling into a real per-model bound.

Feasible with what already exists. scripts/colophon_collect.py now has a bounded, O_NOFOLLOW/O_NONBLOCK, S_ISREG-checked reader and a digest whitelist (trap #42) — the right foundation for parsing a header out of an untrusted blob. The parser must read only the header, never the tensor data: these files are gigabytes.

Open question worth deciding first. Whether an over-max value should be refused, or allowed with a visible warning. Refusing is safer; allowing is honest about the fact that Ollama itself permits it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions