Serving scientific inputs through prompt embeddings
The public crystal example maps CHGNet atom states into the same embedding space as GLM-5.3-Flash text tokens. Doing the projection on the client lets the stock vLLM service use its prompt_embeds interface. A new task can bring its own scientific representation and projector configuration while using the same language-model endpoint.
Build the prompt as the backbone expects it
The client renders the checkpoint’s native chat template with positions reserved for the scientific payload. It reads the required text embedding rows from the same backbone snapshot served by vLLM. Next it projects the scientific features, checks the row count against the reserved spans, and copies those rows into the text embedding matrix using its dtype. The client serializes the full matrix and sends it to /v1/completions, where vLLM continues generation.
This makes the model revision part of the interface. The tokenizer, text embedding rows, and prompt layout must agree with the checkpoint and the served backbone. The local client can read the necessary rows without loading the full language model.
Reuse model state across different payloads
GlmProjectorPrompt caches a fixed question and payload layout. The NEU06 example uses it for EEG segments with a common feature length. GlmProjectorSession reuses the projector and tokenizer across questions whose input lengths vary. It computes the spans for each prompt and retrieves the corresponding text rows.
For a multi-object prompt, the adapter takes feature rows in object order and receives a length for each object. The configuration can render numbered positions via atom_numbering, and the caller can supply grouped payload_labels. Optional discrete and side inputs follow the projector configuration. When the projector requires counts, the default is the list of per-object lengths. These details stay in the client adapter, with vLLM receiving the finished embedding matrix.
See the serving tutorial for startup flags and a working crystal command. Read the adapter source.