Skip to content

Discussion: engine-derived topology fingerprint for namespaces #344

Description

@xiaguan

Context

Since the seal-based registration contract (fix/mtp-layer-count), the engine derives the instance layer-id space from the layers workers actually register: sorted layer names → dense ids, slot ownership validated at seal time. Blocks are stored keyed by (namespace, hash) with a slot array of num_layers * tp_size entries.

The namespace is still entirely client-chosen. Two instances whose layer sets differ — the obvious case is the same model with MTP enabled vs disabled (num_nextn_predict_layers present in config, drafter layers registered or not) — can legally point at the same namespace. Their blocks are mutually unusable:

  • Different slot counts: load now fails loudly (stored block has N slots but instance expects M), which is correct but means a warm namespace keeps reporting hits that can never be served.
  • Same slot count, different layer sets or geometry: undetectable today. The block decodes "successfully" into the wrong layers.

We currently operate under the assumption that a namespace is only ever used by one KV layout (deployment discipline). This issue is about whether the engine should enforce that instead.

Proposal

At seal time the engine has everything that defines block layout compatibility:

fingerprint = hash(sorted (layer_name, bytes_per_block, segments))[:8]
namespace_final = f"{client_namespace}.{fingerprint}"

Appending the fingerprint server-side would make incompatible layouts land in disjoint namespaces by construction — MTP on/off, different quantization (bytes_per_block), different attention layouts all separate automatically, with zero client coordination.

Open questions:

  1. block_size (tokens per block) is part of compatibility but not visible to the engine at registration — it lives in the connector's hash computation. Include it in the register RPC so the fingerprint covers it?
  2. MetaServer entries and SSD index keys would inherit the final namespace; cross-node discovery then only matches truly compatible peers. Any migration concern for existing SSD/metaserver data?
  3. Should the fingerprint be part of the namespace string (observable, greppable in logs) or a separate validated field?

Related

pd_connector still rejects models whose config carries MTP fields even when MTP is disabled (PdConnector does not support MTP layout assertion keyed off num_nextn_predict_layers). Same family of bug as the one the seal contract fixed for the main connector: decisions keyed off config guesses instead of the actual runtime layer set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions