﻿# Ankh protein features and a downstream classifier are separate trained artifacts

Distinguish Ankh pretrained feature extraction from downstream head construction, task-specific training weights, label maps, and compatible feature contracts.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-ankh-protein-features-downstream-head-weights/
Language: en

## An available classifier class is not a trained task solution

A protein-analysis notebook can load Ankh features and instantiate a downstream classification class from an example. The resulting object has the right interface, but architecture construction alone does not establish that it learned the target task. A runnable forward pass is a different milestone from a validated predictor.

The [Ankh workflow](https://raw.githubusercontent.com/agemagician/Ankh/main/README.md) presents pretrained loading and downstream-model examples separately. Preserve that distinction when converting a notebook into an inference service.

## Features identify their generating backbone

The [official base checkpoint](https://huggingface.co/ElnaggarLab/ankh-base) is a particular protein-model artifact. A downstream head must receive the feature width and semantics expected by its trained configuration, rather than whichever similarly named backbone is currently available.

Store backbone identity, tokenizer settings, extraction path, and sequence preprocessing with the head. Shape compatibility is necessary but not sufficient: another model can emit the same width while producing a different representation space.

## Head parameters and label maps complete the prediction

A task head needs its trained parameters, not only constructor arguments. The meaning of each output also depends on the task label map or regression target definition. A numeric output column without that mapping is not a complete result.

The [Ankh paper](https://arxiv.org/abs/2301.06568) places protein representations in the context of downstream evaluation. Do not transfer a reported benchmark outcome to a newly constructed head that has not undergone the same training and evaluation procedure.

## Token-level and sequence-level supervision differ

A residue annotation task needs output correspondence to actual residues. A sequence classification task instead needs an explicit aggregation and target for the full protein. Reusing a head across these tasks changes the learning problem even if a framework can reshape its tensors.

The [tensor-axis guide](/journal/tensor-axes-batch-sequence-hidden/) helps identify these boundaries. Specify special-token removal, padding treatment, and output masking as part of the trained feature contract, rather than adding them opportunistically after loading the head.

## Validate the assembled predictor

A useful deployment check loads the complete backbone/head/label bundle and verifies known held-out examples using the documented preprocessing. Compare predictions before and after serialization, then test padded batching separately.

The [artifact validation guide](/journal/safetensors-artifact-validation/) explains how to retain linked components. Successful assembly supports reproducible inference, but it does not establish performance on an unrelated biological task or prove a scientific property of an untested protein.
