Skip to content

The base created at registration installs an ontology no local model can hold #519

Description

@Kmanley1

The General base installs schema.org at registration (#325, f539e1a, in v0.1.0-rc5). That
pack projects to 915 entity types and 1,625 relation types, and extraction inlines the whole
vocabulary into the system prompt of every chunk. On a fresh install pointed at a local
OpenAI-compatible endpoint, every extraction call fails and the graph stays empty.

Measured

A 9 KB markdown file, 10 chunks, against LM Studio serving openai/gpt-oss-20b:

System prompt 483,102 chars ≈ 104,890 tokens
User message (the chunk) ~250 tokens — 0.24 % of the request
Per document (10 chunks) ~1,051,400 tokens
Document content ~2,304 tokens
Overhead ~456×

The upstream error is explicit:

400 {"error":{"code":400,"message":"request (105140 tokens) exceeds the available
context size (32768 tokens)","type":"exceed_context_size_error",
"n_prompt_tokens":105140,"n_ctx":32768}}

Dividing prompt by vocabulary gives a constant that makes this planable:
~190 chars ≈ 48 tokens per ontology term.

Loaded context Ontology terms that fit
8,192 ~155
32,768 ~620
131,072 ~2,481
schema.org = 2,540 terms ≈121k tokens — fits none of them

schema.org does not fit even at 131,072, which is gpt-oss-20b's maximum. Raising the context
cannot fix it. Loading the model at the full 131,072 was tried: it loads (7,794/8,188 MiB VRAM plus
RAM spill) and drives the GPU to 100 %, but a single chunk ran 671 s without completing before
being aborted. Ten chunks is upward of two hours for a 9 KB file, when it works at all.

Reproduce

  1. Fresh docker compose --profile app up -d on 0.1.0-rc5.
  2. Register (creates General with schema.org).
  3. Administration → Models → any OpenAI-compatible local endpoint with a context ≤ 131,072.
    Test connection passes — it sends ~74 tokens.
  4. Upload any document. Chunking and embedding succeed; every chunk fails extraction.

Two things that make this hard to diagnose

  • Test connection passing is misleading. It exercises a trivial completion, so it certifies an
    endpoint that cannot run a single extraction.
  • The error is swallowed. The upstream body above is precise, but it surfaces as
    LLM request failed (400 Bad Request): unknown error and the job log says only that 10 of 10
    chunks failed. Nothing names the ontology, the prompt, or the context. Diagnosing it required
    putting a logging proxy between the app and the endpoint. Forwarding the upstream error body
    would turn a multi-hour investigation into a one-line answer.

Why it went unnoticed

It is invisible against a hosted model with a large context window — there it is merely expensive,
and nothing reports the cost. It only fails against a small-context endpoint, i.e. the offline
deployment the README foregrounds ("It deploys offline… on hardware it controls"). #322 weighed
installing schema.org against asking at registration and reasonably chose the former; the
consequence for local endpoints does not appear to have been considered.

Related

Possible directions

Not a request for any particular one:

  1. Select a relevant ontology subset per chunk rather than sending all of it — the only option
    that scales with vocabulary rather than against it.
  2. Default the registration base to a smaller pack. Gzipped: schema-org 207.0 KB, iof-core
    59.3 KB, w3c-org 24.2 KB, prov-o 16.9 KB, foaf 5.7 KB. schema.org is 3.5× the next largest.
  3. Warn at KB creation and at model configuration when projected terms × 48 tokens exceeds the
    endpoint's context.
  4. Forward the upstream error body instead of unknown error (worth doing regardless).

Not established here

Whether a smaller pack actually fixes it end to end — the arithmetic says a pack under ~155 terms
fits an 8k window, but that was not run. Only one model and one pack were tested.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions