Skip to content

This is the multi-page printable view of this section.

Return to the regular view of this page

Docs

Load a projector, look up each released task, and find the guides and technical references.

Sage Sci Perception maps scientific encoder states, spectral patches, and scientific readouts into a language model’s input embeddings. Each released projector serves one task.

I want to…Read
Check that a projector loads on my machineGet started
See which tasks are released and how they scoreTasks
Generate answers through vLLMInference with vLLM
Train a projectorTraining a projector
Score saved predictionsEvaluation
Understand how the pieces fitFramework
Look up config.json, Python/CLI APIs, or licenseReference
Download weights and configurationsHugging Face

1 - Get started

Download a task-specific projector and verify it on CPU.

This first step needs no language-model download or GPU.

  1. Download a projector by its task ID.
  2. Load it on CPU.
  3. Compare the printed values with the expected output.

Download a projector

git clone https://github.com/InternLM/Sage-SciPerception.git
cd Sage-SciPerception
python -m pip install -r requirements.txt
python load_projector.py glm-5.3-flash/cif/jarvis --local-dir ./checkpoints

The selected checkpoint, task configuration, and repository index are saved under checkpoints/.

Another task or language-model version

Use its ID from the HF component index. The download tool also exposes download_projector(...) for Python workflows.

Verify on CPU

Run this from the repository directory:

from load_projector import load_projector

projector, config = load_projector(
    "checkpoints/projectors/glm-5.3-flash/cif/jarvis", device="cpu"
)
print(config["task"])
print(sum(p.numel() for p in projector.parameters()))
print(config["output_dim"])

Expected output:

cif/jarvis
4314304
4096

Next steps

  • Tasks — Released projectors with metrics, scores, and checkpoint files.
  • Inference with vLLM — Send projected scientific vectors to a language-model service.
Note

Scientific feature extraction and task-adapted scientific models are separate dependencies; some adapted scientific weights are not yet included in the release. Match each task’s scientific_inputs before preparing predictions.

2 - Tasks

Released projectors with their metrics, scores, and checkpoint files.

Scores come from generated answers using selected task-specific checkpoints. Each checkpoint corresponds to its own task and input representation.

Benchmark / taskMetric ↑ScoreCheckpointEvalKit
JARVIS-DFT
Formation energy
MAD/MAE15.03Filesllm4mat-jarvis
MPBind
PPI interface sites
Per-protein F1 (%)61.12Filesmpbind-ba1
QM9S
Molecular structure identification
Acc@1 (%)49.75Filesqm9s-allspectra
SciTS PHU01
ECG classification
Macro-F1 (%)71.53Filesscits-phu01
GUE splice
Splice-site classification
MCC (%)87.87Filesgue-splice
SciTS NEU06
Sleep staging
Macro-F1 (%)72.01Filesscits-neu06
BEACON ncRNA
RNA family classification
Accuracy (%)97.35Filesbeacon-ncrna
SimXRD OL
Crystal-system classification
Accuracy (%)63.60Filessimxrd-ol
ATOM3D PSR
Protein structure ranking
Spearman (%)35.36Filesatom3d-psr
Metrics differ across rows

MAD/MAE is a ratio where higher is better. MPBind uses the assembly-1 reconstructed evaluation set and mean per-protein F1; PSR uses mean Spearman. These scores do not describe a jointly trained model.

Each task page lists the scientific encoder, the expected scientific input, and the training step. The HF model card and each checkpoint’s configuration identify the released components.

2.1 - Crystal formation energy (JARVIS-DFT)

JARVIS-DFT · Formation energy prediction
Crystal formation energy (JARVIS-DFT)

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/cif/jarvis
Scientific encoderCHGNet 0.3.0
Scientific inputA 64-dim state per atom, plus per-atom position indices. The repository example reads a tensor of shape [num_atoms, 64] in atom order.
MetricMAD/MAE, higher is better
Score15.03
Training step2822
CheckpointFiles on Hugging Face · Configuration

This is the task used in the Get started check and in the vLLM crystal example. Its projector has 4,314,304 parameters and an output dimension of 4096.

Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.2 - Protein interface sites (MPBind)

MPBind · PPI interface sites
Protein interface sites (MPBind)

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/protein-seq/mpbind
Scientific encoderESM-2 states plus a task-adapted ESMC readout
Scientific inputA 1,280-dim state per residue, 2-dim side features, and residue counts.
MetricPer-protein F1 (%)
Score61.12
Training step100
CheckpointFiles on Hugging Face · Configuration

The score uses the assembly-1 reconstructed evaluation set and mean per-protein F1. The adapted scientific weights for this task are not included in the release.

Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.3 - Molecular structure identification (QM9S)

QM9S · Molecular structure identification
Molecular structure identification (QM9S)

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/spectra/qm9s
Scientific encoderA DiffSpectra-style log10(x + 1) transform with patch geometry
Scientific input50-dim spectral patches, their positions, and a 3-way spectrum-type index for IR, Raman and UV–Vis.
MetricAcc@1 (%)
Score49.75
Training step8037
CheckpointFiles on Hugging Face · Configuration
Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.4 - ECG classification (SciTS PHU01)

SciTS PHU01 · ECG classification

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/ecg/phu01
Scientific encoderAn ECG encoder and cache pipeline; the component index names no encoder version
Scientific input768-dim cached position features.
MetricMacro-F1 (%)
Score71.53
Training step1068
CheckpointFiles on Hugging Face · Configuration

The feature extraction runner for this task is not included in the release.

Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.5 - Splice-site classification (GUE splice)

GUE splice · Splice-site classification

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/dna/splice
Scientific encoderA task-adapted DNABERT-2
Scientific inputOne 3-dim probability readout.
MetricMCC (%)
Score87.87
Training step50
CheckpointFiles on Hugging Face · Configuration

The adapted scientific weights for this task are not included in the release.

Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.6 - Sleep staging (SciTS NEU06)

SciTS NEU06 · Sleep staging

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/eeg/neu06
Scientific encoderREVE-base, with position and tail-window handling declared in the configuration
Scientific input512-dim patch states with matching electrode and time positions.
MetricMacro-F1 (%)
Score72.01
Training step4688
CheckpointFiles on Hugging Face · Configuration

This is the first task with a published end-to-end guide: see Evaluation and the NEU06 example, which also covers feature extraction from raw EEG; EvalKit now registers all nine published tasks. It is also the first TrainKit recipe; TrainKit now trains every published projector modality.

Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.7 - RNA family classification (BEACON ncRNA)

BEACON ncRNA · RNA family classification
RNA family classification (BEACON ncRNA)

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/rna/ncrna
Scientific encoderRNA-FM plus a task-adapted RiNALMo ensemble readout
Scientific inputA 640-dim RNA-FM state per nucleotide and a 13-dim side input.
MetricAccuracy (%)
Score97.35
Training step200
CheckpointFiles on Hugging Face · Configuration

The adapted scientific weights for this task are not included in the release.

Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.8 - Crystal-system classification (SimXRD OL)

SimXRD OL · Crystal-system classification

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/xrd/simxrd
Scientific encoderA legacy XRD CNN
Scientific input110 convolutional states of 512 dimensions each, from a normalized 3,501-point square-root input pipeline.
MetricAccuracy (%)
Score63.60
Training step500
CheckpointFiles on Hugging Face · Configuration
Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

2.9 - Protein structure ranking (ATOM3D PSR)

ATOM3D PSR · Protein structure ranking

A task-specific projector maps this task’s scientific representation into the language model’s embedding space.

FieldValue
Task IDglm-5.3-flash/protein-struct/psr
Scientific encoderProteinMPNN v48-020
Scientific inputA 384-dim state per residue or bin: three encoder layers concatenated, then at most 256 contiguous mean bins.
MetricSpearman (%)
Score35.36
Training step200
CheckpointFiles on Hugging Face · Configuration

The score is a mean Spearman correlation.

Note

The checkpoint’s config.json declares the architecture, output dimension, scientific inputs, prompt, backbone revision, and training step.

3 - Guides

Run inference through vLLM, train a projector, and score saved predictions.
  • Inference with vLLM — Send projected scientific vectors to a language-model service.
  • Training a projector — Train one projector with XTuner while the encoder and the language model stay frozen.
  • Evaluation — Score saved predictions on CPU with EvalKit.

3.1 - Inference with vLLM

Insert projected scientific vectors into prompt embeddings and generate with vLLM.

The serving path inserts projected scientific vectors into a language model’s full templated prompt embeddings and sends them to vLLM through prompt_embeds at /v1/completions. Scientific features and projection are prepared in the client; the language-model service generates the answer.

Start the language-model service

Install vLLM in a compatible inference environment. Run it on suitable GPUs and set tensor parallelism for that model and hardware. This command shows an eight-way deployment example:

vllm serve /path/to/matching-base-model \
  --served-model-name sage-sciperception \
  --enable-prompt-embeds \
  --tensor-parallel-size 8 \
  --generation-config vllm \
  --max-model-len 8192 \
  --host 127.0.0.1 --port 8000
Use the exact snapshot the checkpoint declares

Serve the language-model snapshot named in the selected checkpoint’s config.json. A different snapshot changes the embedding table the client reads from.

Generate from prepared crystal features

The crystal client renders the checkpoint’s native chat template, looks up text embeddings, inserts scientific vectors, and sends the completed prompt embeddings to the server.

Prepare cif_features.pt as a tensor of shape [num_atoms, 64], containing the real CHGNet 0.3.0 atom states specified in cif/jarvis, in atom order. Once the server is ready, run:

python -m pip install --upgrade transformers
python examples/vllm_cif.py \
  --component ./checkpoints/projectors/glm-5.3-flash/cif/jarvis \
  --base-model /path/to/matching-base-model \
  --features /path/to/cif_features.pt \
  --api-base http://127.0.0.1:8000/v1 \
  --model sage-sciperception

The local language-model directory supplies the tokenizer, configuration, and sharded input embedding table used by the server. The client reads the needed text embedding rows without loading the full language model.

Other tasks

Scientific feature extraction and task-adapted scientific models are separate dependencies; some adapted scientific weights are not yet included in the release. Match each task’s scientific_inputs before preparing predictions. The crystal example starts from prepared features, while other tasks require their corresponding input preparation and prompt assembly.

For a second worked path, including feature extraction from raw signals, see the NEU06 example.

References

3.2 - Training a projector

Train one task-specific projector with XTuner while the encoder and the language model stay frozen.

TrainKit trains a scientific projector with XTuner. XTuner owns the trainer, FSDP, packing, the scheduler, the losses and the optimizer; TrainKit adds the projector, the prompt and supervision mask, payload injection into the packed sequence, and an export that the inference example and EvalKit read unchanged.

TrainKit covers all nine published atom projector modalities through scip-train preflight (neu06-preflight remains available as a backward-compatible alias) and recipes/projector_sft.py, which support optional discrete, side, readout, task_head, output_scale and depth components as well as multi-object and atom_numbering prompts. recipes/neu06_projector.py remains available for strict NEU06 validation.

The worked example below is SciTS NEU06 sleep staging, the first published recipe. Training samples are published at internlm/Sage-SciPerception-Training.

Data preparation is out of scope

Training reads a prepared sage-training-data-v1 export — a manifest, the rows of a split, and the frozen encoder states a row’s array_index names. Data preparation, signal processing and feature encoding are not part of the repository.

Training data

Training splits are curated from each task’s public scientific dataset and kept strictly disjoint from EvalKit’s held-out evaluation sets by subject, protein target, crystal geometry or composition, or year. Rather than feeding raw signals or biological sequences into training, each export stores frozen scientific encoder outputs or spectral representations paired with multi-turn instruction rows; language supervision loss is applied only to assistant response tokens while projected scientific payload positions are masked out.

Runnable two-row exports for all nine verified modalities are published at internlm/Sage-SciPerception-Training using the sage-training-data-v1 layout:

<export>/
  dataset.json          # split index and manifest metadata
  train.jsonl           # conversations plus array_index pointers (no raw signals/sequences)
  features/
    features.json       # feature width, dtype, and frozen encoder metadata
    index.jsonl         # per-object metadata
    offsets.npy         # slice boundaries per object
    nodes.npy           # frozen encoder states or spectral patch arrays
    modality.npy        # optional discrete channel (3-way index for spectra/qm9s)
    side.npy            # optional scientific readout channel (rna/ncrna, protein-seq/mpbind)
Modality / taskSample path & HF configUpstream datasetRepresentation (nodes.npy / extra)
DNA (dna/splice)samples/dna/splice (splice)MAGICS-LAB DNABERT-2 GUE (splice/reconstructed)[2, 3] DNABERT-2 splice readout
RNA (rna/ncrna)samples/rna/ncrna (ncrna)BEACON (NoncodingRNAFamily)[238, 640] RNA-FM states + side.npy ([2, 13])
EEG (eeg/neu06)samples/eeg/neu06 (neu06)PhysioNet Sleep-EDF (sleep-cassette)[68, 512] REVE-Base patch states
Crystal (cif/jarvis)samples/cif/jarvis (jarvis)JARVIS-DFT (jdft-3d-20221212)[22, 64] CHGNet 0.3.0 atom states
ECG (ecg/phu01)samples/ecg/phu01 (phu01)PTB-XL (1.0.3)[720, 768] ST-MEM patch states
Spectra (spectra/qm9s)samples/spectra/qm9s (qm9s)QM9S (DiffSpectra)[694, 50] IR/Raman/UV patches + modality.npy
Protein Struct (protein-struct/psr)samples/protein-struct/psr (psr)ATOM3D PSR (PSR-split-by-year)[451, 384] ProteinMPNN v48-020 states
Protein Seq (protein-seq/mpbind)samples/protein-seq/mpbind (mpbind)MPBind BA1[136, 1280] ESM-2 states + side.npy ([136, 2])
XRD (xrd/simxrd)samples/xrd/simxrd (simxrd)SimXRD-4M (OLtrain/OLval)[220, 512] SimXRD residual CNN states

Each two-row slice preserves real array_index and remapped offsets so you can run scip-train preflight end to end before preparing or requesting a full split (see Full training data or open an issue).

Install

Python 3.12. XTuner is pinned to a commit and loaded from a source checkout, so the recipe does not depend on which XTuner is installed:

WORK=/path/to/work
XTUNER=$WORK/xtuner
git clone https://github.com/InternLM/xtuner.git "$XTUNER"
git -C "$XTUNER" checkout 79b9615c53e1b23e11d4dc37fd7eb66bbcefb3df

Install XTuner’s own training dependencies at the same commit, following its installation guide. The recipe trains a frozen MoE base with tilewise FP8, so that guide’s Install GroupedGEMM and Install AdaptiveGEMM steps both apply, as does its flash-attn recommendation. Then add this repository’s packages:

python -m pip install ./evalkit ./trainkit

CPU-only tests need neither XTuner nor GPUs:

uv run --no-project --with pytest --with ./evalkit --with ./trainkit --python 3.12 pytest trainkit/tests -q

Inputs

The default run reads no projector weights: only the component’s config.json, for the architecture, the output width and the prompt layout.

WORK=/path/to/work
GLM=$WORK/GLM-5.3-Flash-BF16
PROJECTOR=$WORK/component/projectors/glm-5.3-flash/eeg/neu06
DATA=$WORK/training-samples/samples/eeg/neu06

hf download zai-org/GLM-5.3-Flash-BF16 \
  --revision f9fed3bbc82291073373d67452e9f25317ef7577 --local-dir "$GLM"
hf download internlm/Sage-SciPerception projectors/glm-5.3-flash/eeg/neu06/config.json \
  --revision 7c228fc03394027fed19bda1ff26388394b0031a --local-dir "$WORK/component"
hf download internlm/Sage-SciPerception-Training --repo-type dataset \
  --include "samples/eeg/neu06/*" --local-dir "$WORK/training-samples"

Replace $DATA with your own export to train on your own data.

Preflight

The preflight takes the recipe’s own DataloaderConfig and asks XTuner for the dataset, the sampler and the collator, so its numbers describe the configuration the run will use. It needs no GPUs:

RUN=${RUN:-$WORK/runs/trial}
SCIP_PACK_MAX_LENGTH=${SCIP_PACK_MAX_LENGTH:-2048}
SCIP_GLOBAL_BATCH_SIZE=${SCIP_GLOBAL_BATCH_SIZE:-2}
SCIP_PACK_CHUNK_SIZE=${SCIP_PACK_CHUNK_SIZE:-1}
SCIP_TOTAL_EPOCH=${SCIP_TOTAL_EPOCH:-1}
PYTHONPATH="$XTUNER" scip-train preflight \
  --manifest "$DATA/dataset.json" --model "$GLM" \
  --projector-config "$PROJECTOR/config.json" --work-dir "$RUN/preflight" \
  --pack-max-length "$SCIP_PACK_MAX_LENGTH" --global-batch-size "$SCIP_GLOBAL_BATCH_SIZE" \
  --total-epoch "$SCIP_TOTAL_EPOCH" --sp-size 8 --pack-chunk-size "$SCIP_PACK_CHUNK_SIZE"

sizing reports the pack count, the steps per epoch, the total steps, the warmup steps and the dropped tail packs; the full report is written to $RUN/preflight/preflight.json. scip-train neu06-preflight is kept as an alias of scip-train preflight and takes the same arguments.

Sizing constraints

global_batch_size must be divisible by the data-parallel size, which is world_size / sp_size — sixteen GPUs at SP8 give DP2, so the global batch must be even and 2 is its minimum. pack_max_length must be divisible by sp_size. round_up=False drops the tail pack instead of padding, so each epoch consumes packs // global_batch_size packs: a split that packs into fewer packs than the global batch reaches zero steps.

Packing works on chunks of rows independently. The sample sets --pack-chunk-size 1 so its two rows form two packs and fill one global batch. The full recipe uses a chunk size of 100000.

Train

The full recipe was run on two eight-GPU nodes. The public sample was checked with XTuner’s CPU preflight. Run the command once per node, with the same input paths and the preflight report available at $RUN on both nodes.

REPO=/path/to/Sage-SciPerception
RUN=${RUN:-$WORK/runs/trial}
export PYTHONPATH="$XTUNER"

export SCIP_MODEL_PATH="$GLM"
export SCIP_MANIFEST="$DATA/dataset.json"
export SCIP_PROJECTOR="$PROJECTOR"
export SCIP_PROJECTOR_SEED=20261129
read -r SCIP_PACK_MAX_LENGTH SCIP_GLOBAL_BATCH_SIZE SCIP_PACK_CHUNK_SIZE \
  SCIP_TOTAL_EPOCH SCIP_SP_SIZE SCIP_HF_INTERVAL < <(
  python -c 'import json,sys; s=json.load(open(sys.argv[1]))["sizing"]; print(*(s[k] for k in sys.argv[2:]))' \
    "$RUN/preflight/preflight.json" pack_max_length global_batch_size pack_chunk_size total_epoch sp_size steps_per_epoch
)
export SCIP_PACK_MAX_LENGTH SCIP_GLOBAL_BATCH_SIZE SCIP_PACK_CHUNK_SIZE SCIP_TOTAL_EPOCH SCIP_SP_SIZE SCIP_HF_INTERVAL
export SCIP_EXPERIMENT=${SCIP_EXPERIMENT:-neu06-projector-trial}
export XTUNER_WORK_DIR="$RUN/work_dir"

python -m torch.distributed.run \
  --nnodes 2 --nproc_per_node 8 \
  --node_rank "${NODE_RANK:?set by your launcher}" \
  --master_addr "${MASTER_ADDR:?set to the rank-0 host}" \
  --master_port "${MASTER_PORT:?pick one free port, the same on both replicas}" \
  "$XTUNER/xtuner/v1/train/cli/sft.py" \
  --config "$REPO/trainkit/recipes/projector_sft.py"

recipes/projector_sft.py is the general recipe and serves every published modality; use recipes/neu06_projector.py instead when you want the strict NEU06 checks.

For the full data, set these values in your training shell, then rerun the preflight and train commands above:

DATA=/path/to/training-export
RUN=$WORK/runs/full
SCIP_PACK_MAX_LENGTH=16384
SCIP_GLOBAL_BATCH_SIZE=2
SCIP_PACK_CHUNK_SIZE=100000
SCIP_EXPERIMENT=neu06-projector-muon-8e-6

The recipe is scaled from a GLM multimodal SFT setup: SP8/EP8 with the deepep dispatcher, tilewise FP8 GEMM, torch.compile, the NoPE-MLA backends, chunked main CE (1024, token reduction), seven shared MTP depths at 0.1, Muon (lr 8e-6, weight_decay 0.1, swap_optimizer), constant LR after a 10% warmup, one epoch. The pack length and global batch come from the preflight. SCIP_LR is the only intended sweep knob and is written into every export.

Export and warm start

Each saved step writes projector.safetensors and a config.json whose training block records the learning rate, the sizing, the initialization and its seed, the manifest revision, the dataset.json and features.json the run read, and the encoder versions those files carry. Score an export with the evaluation guide.

To continue from a published projector instead of a fresh initialization, download its weights next to the config.json above and name the mode:

hf download internlm/Sage-SciPerception projectors/glm-5.3-flash/eeg/neu06/projector.safetensors \
  --revision 7c228fc03394027fed19bda1ff26388394b0031a --local-dir "$WORK/component"

export SCIP_PROJECTOR_INIT=warm-start
export SCIP_PROJECTOR_SHA256=3abbf3868cc6977b4a062bdd8938c045b65182a1b094e9cb3a2029394cf00f7e
unset SCIP_PROJECTOR_SEED

SCIP_PROJECTOR_SHA256 is optional and is checked against the file about to be loaded; the value above is the one the component lists on Hugging Face.

3.3 - Evaluation

Score saved predictions on CPU with EvalKit.

EvalKit maintains versioned evaluation protocols, scoring, and the prediction generation loop. Scoring runs on CPU and needs neither torch, transformers, nor network access — only Python 3.12 and uv.

EvalKit registers all nine published task protocols, with SciTS NEU06 as the worked end-to-end example below.

Registered datasets

Dataset IDTaskProtocolOptional runtime extras
scits-neu06SciTS NEU06scits-neu06-v1none (stdlib)
scits-phu01SciTS PHU01scits-classification-text-3dp-ecg100hz-v1none (stdlib)
llm4mat-jarvisJARVIS-DFTllm4mat-jarvis-formation-energy-cif-v1none (stdlib)
qm9s-allspectraQM9Sdiffspectra-compute-metrics-v1rdkit, myopic-mces, pulp (for molecular scoring)
atom3d-psrATOM3D PSRatom3d-psr-year-backbone-text-gdt-ts-v2scipy (lmdb only for raw LMDB input extraction)
gue-spliceGUE splicegue-splice-reconstructed-mcc-v1none (stdlib)
beacon-ncrnaBEACON ncRNAbeacon-rna-bioinstructions-v1none (stdlib)
mpbind-ba1MPBindmpbind-ppi-reconstructed-ba1-sequence-sites-v1none (stdlib)
simxrd-olSimXRD OLsimxrd-ol-crystal7-text-maxbin0.1deg-v1none (stdlib)

Score saved predictions

Run from the repository root:

SCITS=/path/to/SciTS      # OpenTSLab/SciTS at revision 6ce690e904898cc8fd9014ea2e5bebdfa749c1d2
RUN=/path/to/neu06-run    # holds responses.jsonl

uvx --from huggingface-hub hf download OpenTSLab/SciTS meta_data.jsonl --repo-type dataset \
  --revision 6ce690e904898cc8fd9014ea2e5bebdfa749c1d2 --local-dir "$SCITS"
uv run --project evalkit scip-eval score --task scits-neu06 \
  --references "$SCITS/meta_data.jsonl" --responses "$RUN/responses.jsonl" --out-dir "$RUN/score"

--dataset is accepted as an alias for --task, and --workers sets worker processes for datasets with parallel metrics such as qm9s-allspectra. The command prints a summary and writes summary.json and per-item scores.jsonl to --out-dir. The library entry point is evalkit.score.score_files(task, references, responses, *, only_responded=False, workers=1).

By default every frozen ID is scored, and an ID with no prediction counts as an empty answer. --only-responded scores only the IDs that have a prediction record, and marks the result as a subset.

Prediction file format

  • Each JSONL line is one attempt, with eval_id, content, and optionally status (ok, truncated, api_error). Other fields are ignored. For a repeated eval_id, the last line wins.
  • generation.run writes a run_id into every line and a <filename>.run.json next to it, recording the run identity: task, ordered inputs, model, service address and model name, decoding parameters. A run with the same identity can resume and skip the IDs already written; a different identity writing to the same file is refused.
  • Only one generation process may use a path at a time, enforced by <filename>.lock. A stale lock left by an abnormal exit must be removed by hand.
  • Older files without a run_id still score normally, but cannot be appended to; write the remaining items to a new file.

The scits-neu06-v1 protocol

ItemDefinition
Test setThe 1,024 rows of SciTS meta_data.jsonl whose task_id contains NEU06, with eval_id = "NEU06:" + id. Row count and the SHA-256 of [eval_id, label] are checked on load
ClassesWake, N1, N2, N3, REM, with support 324, 101, 365, 94, 140
Answer parsingTake the body after the last </think>; if <answer>…</answer> is present, take the last one; strip the outer code fence. A line equal to a class name predicts that class
ValidityValid when there is at least one line and every line is a class name. Validity is reported separately and does not clear the prediction: N2 plus a line unsure is invalid but still predicts N2
Missing and statusA missing ID scores as an empty answer; status is reported only and does not affect parsing
Macro-F1The mean F1 over the reference classes present in the scored rows; TP/FP/FN count label-set membership
AccuracyThe predicted label set equals the reference set

Parsing and scoring follow the rules used for the Sage-SciPerception v0.1.0 published scores.

Reproduce from raw EEG

The NEU06 example covers the full path: REVE-base feature extraction, generation against a vLLM server, and scoring. It lists every input with its source, revision, and license, and reports both the released run and a rerun:

RunMacro-F1 (%)Accuracy (%)
Released (v0.1.0)72.0176.46
Rerun71.8276.46

Both runs cover all 1,024 items. They are separate runs, and per-item predictions of the released run are not available.

Add a dataset or a model

ModuleResponsibility
datasets/base.pyThe small base class EvalDataset: name, protocol, load, metadata, score_items, score aligned by eval_id, and shared answer_span
datasets/<suite>.pyOne module (or package such as datasets/qm9s/) per upstream dataset or benchmark suite, holding references, questions, parsing and metrics; tasks within a suite register by task ID
datasets/__init__.pyThe DATASETS registry
contract.py, score.py, cli.pyPrediction file reading, score dispatch, result writing, and scip-eval score
generation.pyThe generation loop: concurrency, OpenAI-compatible /completions requests recording http_status, run-bound appends and resume
glm_prompt_embeds.pyThe vLLM prompt_embeds adapters (GlmProjectorPrompt and reusable variable-length GlmProjectorSession) for GLM plus a projector payload across the nine atom projector modalities, with multi-object support, atom_numbering/payload_labels and optional discrete/side/counts passthrough; needs torch, transformers and safetensors at run time

A new dataset or task: implement an EvalDataset subclass in a suite module, register it in datasets/__init__.py, and add fixtures under tests/. Dispatch and the CLI need no change.

A new model: a model called the same way needs only different weights, configuration and service name in the calling script. A different calling convention adds an adapter module that assembles the request and states the model identity, combined with generation.completion or your own transport into a generate(eval_id) passed to generation.run.

4 - Framework

How a task-specific projector connects a scientific representation to a language model.
Scientific inputs pass through scientific representations and trainable projectors into a language model.

Sage Sci Perception maps scientific encoder states, spectral patches, and scientific readouts into a language model’s input embeddings, enabling natural-language analysis and structured scientific answers.

A task-specific projector maps scientific representations into the language model’s embedding space. During language-mapping training, the scientific models and the language model remain frozen while the projector is trained. Some tasks use scientific models adapted beforehand, or combine encoder states with scientific readouts.

What a checkpoint contains

Each released checkpoint holds projector.safetensors and a config.json. The configuration declares the architecture, the output dimension, the scientific inputs, the prompt, the backbone revision, and the training step. Its top-level fields include format_version, component_type, task, weights, projector, output_dim, base_model, prompt, scientific_inputs, and training_step.

scientific_inputs is the field to read before preparing data: it names the encoder, the preprocessing, the representation, any scientific readout, and the side features per object. The nine released tasks are listed under Tasks.

Where each piece runs

PieceWhere it runsProvided here
Scientific feature extractionYour own environment, usually CPUNo, except the NEU06 example
ProjectorThe inference clientYes, as released checkpoints
Language modelA vLLM service on GPUsNo, downloaded from its upstream snapshot
ScoringCPUYes, as EvalKit

Scientific feature extraction and task-adapted scientific models are separate dependencies; some adapted scientific weights are not yet included in the release.

5 - Reference

Configuration schema, Python download/load API, evaluation CLI, license, and citation.

Technical references for the checkpoint configuration, Python loading helpers, CPU evaluation CLI, and release metadata.

  • config.json — Top-level checkpoint metadata, projector architecture fields, and scientific_inputs.
  • load_projector API — CLI and Python helpers for downloading and loading released checkpoints.
  • scip-eval CLI — Command-line flags, summary.json / scores.jsonl outputs, and Python scoring entry points.
  • License & citation — Apache License 2.0 terms, upstream notices, and BibTeX citation.

5.1 - config.json

Schema for released sage-projector-v1 checkpoint configurations and TrainKit exports.

Every released component directory contains projector.safetensors and a config.json following format_version: "sage-projector-v1".

Top-level fields

FieldDescription
format_versionSchema identifier, currently "sage-projector-v1".
component_typeComponent kind, "scientific_projector".
taskTask identifier matching the repository index (e.g., "cif/jarvis", "eeg/neu06").
weightsWeight filename in the same directory, "projector.safetensors".
projectorArchitecture specification read by modeling_projector.build (see below).
output_dimTarget language-model embedding width (e.g., 4096).
base_modelObject with repo_id, revision, dtype, and training_fingerprint.
promptPrompt rendering layout: system, names, template_kwargs, include_reasoning, and atom_numbering.
scientific_inputsArray of input specs with encoder, preprocessing, representation (feature_dim, modality, rows, maximum_tokens), scientific_readout, and side_features_per_object.
training_stepInteger training step of the exported checkpoint.
trainingOptional provenance block written by TrainKit exports (step, export, xtuner_revision, initialized_from, trainable_parameters, learning rate, sizing, manifest revision, and dataset.json / features.json provenance).

projector block fields

All nine currently released checkpoints use kind: "atom". Across the released checkpoints and modeling_projector.build, the following fields apply:

FieldScopeDescription
idCommon (atom)Architecture identifier (e.g., "scientific-cif-positions").
kindCommon"atom", "atom-set", or lead projector fallback when neither is set.
modalityCommon (atom)Modality identifier (e.g., "cif", "eeg", "spectra").
feature_dimCommonInput scientific feature dimension per token or atom.
tokensLead / atomnull for atom checkpoints; integer slot count for LeadProjector.
hidden_dimCommon (atom / Lead)Hidden width of the MLP stack.
index_dimCommon (atom / atom-set)Learned positional embedding width (atom_index).
max_atomsCommon (atom / atom-set)Maximum number of position slots in atom_index.
discrete_sizes, discrete_dimOptional (atom)Per-atom discrete embedding table sizes and embedding dimension (e.g., spectra/qm9s: [3], 16).
side_dim, side_hidden_dimOptional (atom)Per-object side-feature width and MLP hidden width (e.g., protein-seq/mpbind: 2 / 128; rna/ncrna: 13 / 128).
task_head_outputsOptionalAuxiliary head output width (protein-seq/mpbind and protein-struct/psr: 1).
readout_classes, readout_uses_sideOptional (atom)Pretrained scientific classification readout count and side-channel flag (protein-seq/mpbind: 1, false).
output_scale, depth, block_mult, block_exit_normOptionalOutput L2 norm scaling and residual MLP block options.
graph_layers, graph_hidden_dimOptional (atom)Bond-message residual layers over graph edges and bond types.
context_layers, context_dim, context_headsOptional (atom)Per-object Transformer context residual options.
model_dim, layers, heads, ffn_dimatom-setTransformer encoder parameters for AtomSetProjector.

Example (cif/jarvis/config.json)

{
  "format_version": "sage-projector-v1",
  "component_type": "scientific_projector",
  "task": "cif/jarvis",
  "weights": "projector.safetensors",
  "projector": {
    "hidden_dim": 1024,
    "id": "scientific-cif-positions",
    "kind": "atom",
    "modality": "cif",
    "feature_dim": 64,
    "tokens": null,
    "index_dim": 32,
    "max_atoms": 512
  },
  "output_dim": 4096,
  "base_model": {
    "repo_id": "zai-org/GLM-5.3-Flash-BF16",
    "revision": "f9fed3bbc82291073373d67452e9f25317ef7577",
    "dtype": "bfloat16",
    "training_fingerprint": "5113ec01897c403098c40c38c897d9abb67222ec5caca80a862129037b30e6ea"
  },
  "prompt": {
    "system": "You are reading one crystal. Answer from the supplied scientific payload. Give brief reasoning and then the requested answer format.",
    "names": [["crystal"], ["First crystal", "Second crystal"]],
    "template_kwargs": { "reasoning_effort": "low" },
    "include_reasoning": true,
    "atom_numbering": false
  },
  "scientific_inputs": [
    {
      "encoder": {
        "name": "chgnet-0.3.0",
        "checkpoint_sha256": "d14ab7c0f093efe64b60a7bcd540bca10e74fb7f46c86108a079af60524659d1",
        "states": "one 64-dimensional state per atom entering the energy MLP; 6/3 angstrom cutoffs"
      },
      "preprocessing": null,
      "representation": {
        "feature_dim": 64,
        "modality": "cif",
        "rows": 60698,
        "maximum_tokens": 140
      },
      "scientific_readout": null,
      "side_features_per_object": false
    }
  ],
  "training_step": 2822
}

5.2 - load_projector API

CLI and Python helpers in load_projector.py and modeling_projector.py.

load_projector.py and modeling_projector.py live at the root of the repository and provide both a CLI downloader and Python loading helpers.

CLI downloader

python load_projector.py <projector_id> [--repo-id REPO_ID] [--revision REVISION] [--local-dir PATH]
Argument / optionDefaultDescription
projector_id— (required)Component ID in backbone/modality/task form from the root HF config.json (e.g., glm-5.3-flash/cif/jarvis).
--repo-idinternlm/Sage-SciPerceptionHugging Face repository ID.
--revisionmainBranch, tag, or commit revision to resolve from.
--local-dirNoneOptional target directory where the root config.json and component files are materialized.

The command prints the resolved local component directory path to stdout.

Python functions (load_projector.py)

download_projector

download_projector(
    projector_id,
    repo_id="internlm/Sage-SciPerception",
    revision="main",
    local_dir=None,
    cache_dir=None,
) -> Path

Downloads the root config.json at revision, looks up index["projectors"][projector_id], and pins the subsequent config.json and weights downloads to the exact resolved snapshot (index_path.parent.name). When local_dir is provided, the root config.json is also written under local_dir. Returns the component directory Path.

load_projector

load_projector(directory, device="cpu") -> tuple[nn.Module, dict]

Reads config.json from directory, instantiates the module with modeling_projector.build(config["projector"], config["output_dim"]), loads config["weights"] via safetensors.torch.load_file(..., device="cpu") with strict=True, moves the module to device, sets .requires_grad_(False).eval(), and returns (model, config).

from load_projector import download_projector, load_projector

component_dir = download_projector("glm-5.3-flash/cif/jarvis", local_dir="./checkpoints")
projector, config = load_projector(component_dir, device="cpu")

Module helpers (modeling_projector.py)

HelperDescription
build(spec, output_dim, *, train_core=False, train_side_only=False) -> nn.ModuleInstantiates AtomProjector, AtomSetProjector, or LeadProjector from config["projector"] and attaches optional heads (task_head, readout, side, graph, context).
load_initial(model, state)Loads an initial non-auxiliary core state dict into an AtomProjector, verifying that any optional prefix (graph., task_head., side., context., readout.) is either completely present or completely absent.

5.3 - scip-eval CLI

Command-line flags, output schemas, and Python scoring entry points for EvalKit.

scip-eval is the console entry point of EvalKit. Scoring runs on CPU with Python 3.12+ and uv, and needs neither torch, transformers, nor network access.

Global usage

uv run --project evalkit scip-eval --version
uv run --project evalkit scip-eval score --task <TASK> --references <PATH> --responses <PATH> [--out-dir <PATH>] [--only-responded] [--workers <N>]

--dataset is accepted as an alias for --task. The current package version is 0.1.0.

scip-eval score options

OptionRequiredDescription
--task, --datasetYesRegistered dataset task ID from evalkit.datasets.DATASETS: atom3d-psr, beacon-ncrna, gue-splice, llm4mat-jarvis, mpbind-ba1, qm9s-allspectra, scits-neu06, scits-phu01, simxrd-ol. See Registered datasets.
--referencesYesPath to the frozen dataset reference file or directory (e.g., SciTS meta_data.jsonl).
--responsesYesPath to predictions JSONL containing eval_id, content, and optional status / run_id.
--out-dirNoDirectory where summary.json and scores.jsonl are written.
--only-respondedNoScore only frozen IDs that appear in --responses, marking scope as a subset. By default all frozen IDs are scored, with absent IDs treated as empty content.
--workersNoWorker processes for datasets with parallel metrics such as qm9s-allspectra (default: 1).

Most datasets require only the Python 3.12 standard library on CPU; optional runtime extras apply to atom3d-psr (scipy, with lmdb only for raw LMDB input extraction) and qm9s-allspectra (rdkit, myopic-mces, pulp). The command prints summary.json to stdout.

Output files

When --out-dir is given, evalkit.score.write_outputs writes two files. Envelope fields (task, dataset, protocol, source, references_sha256, scope, responses, run) are shared, while metric keys and per-item fields follow the selected dataset protocol (for scits-neu06, shown below):

  • summary.json: contains task, dataset, protocol, source, classes, references_sha256, rules, scope, responses (path, unique_ids, superseded_records, unexpected_ids), run (bound, run_id, unbound_records), rows, macro_f1, accuracy, correct, invalid, missing, statuses, and per_class.
  • scores.jsonl: one JSON object per scored item with eval_id, reference, prediction, valid, correct, and status.

Python API

from pathlib import Path
from evalkit.score import score_files, write_outputs

result = score_files(
    "scits-neu06",
    Path("/path/to/SciTS/meta_data.jsonl"),
    Path("/path/to/run/responses.jsonl"),
    only_responded=False,
    workers=1,
)
write_outputs(result, Path("/path/to/run/score"))

evalkit.contract.read_predictions enforces run consistency: if a JSONL file mixes records from multiple run_id values, or mixes bound and unbound records, scoring fails instead of aggregating across runs.

Training preflight CLI

TrainKit also exposes scip-train preflight for measuring token counts, XTuner packing, and collator alignment on CPU before training (scip-train neu06-preflight remains available as an alias). See the Training guide.

5.4 - License & citation

Apache License 2.0 terms, upstream notices, and BibTeX citation.

License

Sage-SciPerception is released under the Apache License 2.0 (Apache-2.0). See the full license text in LICENSE in the repository.

Upstream datasets, base language models, and scientific encoders remain governed by their own licenses — for example, OpenTSLab/SciTS (CC-BY-NC-SA-4.0) and brain-bzh/reve-base (REVE Responsible Use License v1.0).

Citation

If you use Sage-SciPerception in your work, please cite it using the metadata in CITATION.cff:

@misc{sage_sciperception,
  author       = {{InternLM}},
  title        = {{Sage-SciPerception}},
  version      = {0.1.0},
  note         = {GitHub repository},
  year         = {2026},
  url          = {https://github.com/InternLM/Sage-SciPerception}
}