# Cell2Sentence: teaching language models the language of single-cell data

> Cell2Sentence is a Python package and pretrained model family from the van Dijk Lab that converts single-cell expression vectors into rank-ordered sentences of gene names, so that a language model can treat scRNA-seq data as text. The judgement is that the representation change is the interesting idea, while the code release around it remains research code with a stale lint target and a single test release tag.

**vandijklab/cell2sentence** — Cell2Sentence: Teaching Large Language Models the Language of Biology

- Repository: https://github.com/vandijklab/cell2sentence
- Stars: 890 · Forks: 134
- Language: Jupyter Notebook
- License: Apache-2.0
- Published: 2026-10-20 · Updated: 2026-10-20 · Language: en
- Canonical page: https://hysenlabs.com/projects/vandijklab-cell2sentence

## An expression vector becomes a sentence

The core idea fits in one line, and the README states it plainly. C2S proposes a rank-ordering transformation of expression vectors into cell sentences, which are space-separated gene names ordered by descending expression, and that is what allows large language models to natively model scRNA-seq data using natural language. Nothing about the underlying measurement changes. What changes is the encoding, and with it the set of things a text-trained model can be asked to do, because a cell becomes a sentence that can be prefixed, continued, compared and questioned in the same vocabulary as any other prompt. The repository implements the framework described in Scaling Large Language Models for Next-Generation Single-Cell Analysis, the C2S-Scale framework, and it points back to the earlier paper that established the C2S methodology for the original formulation. Tutorial notebook 1 in the repository covers the rank transformation and its inverse, which tells you where the conceptual weight of the project sits.

## C2S-Scale extends the idea to 27B parameters

The newer generation of models is what the current codebase is built around. The C2S-Scale models scale to 27B parameters, unify transcriptomic and textual data, and enable a set of tasks that the earlier formulation did not cover, specifically perturbation prediction, dataset summarization, cluster captioning, and biological question answering. The architecture is not exotic. Models based on the Pythia architecture are available on Hugging Face, and the README states that models based on Gemma-2 will soon be made available, which it later did, with the C2S-Scale Gemma-2 2B and 27B pretrained models announced on 2025-10-15 in collaboration with Google Research and Google DeepMind, alongside a Google blog post. The point of using established language model backbones is that the fine-tuning starts from a model that already understands text, and the cell sentence is the part that has to be taught.

## A model family with a documented training history

The news section in the README is effectively a changelog with model releases attached, and it reads the way a research group's history should. The first model, pythia-160m-c2s, was made available in February 2024, trained on full cell sentences from the Pythia-160 base model, generating and predicting cell types from whole cells directly as text. In September 2024 the group released the new code base with the core functionality for common single-cell workflows, together with a suite of Pythia models for cell type prediction, cell type conditioned generation and a multi-cell multi-task model, trained on more than 57 million human and mouse cells from CellxGene and the Human Cell Atlas. The C2S-Scale preprint and the 1B model followed in April 2025, and the paper was accepted to ICML 2024. An earlier preprint in February 2024 also reported training on a multi-tissue dataset of 36 million cells. For a user, the practical implication is that there is a checkpoint for most budgets, from a 160M parameter model upwards.

## Installing with conda, make or pip

Three installation routes are documented, and the difference between them matters. The documented setup starts by pulling the repository and creating a Conda environment with Python 3.8:

```bash
git clone https://github.com/vandijklab/cell2sentence.git
```

```bash
conda create -n cell2sentence python=3.8
```

```bash
conda activate cell2sentence
```

Then the setup script runs, which the README says installs the latest development environment along with other package dependencies:

```bash
make install
```

If you only want the package itself, the README gives a pip install of a specific version, cell2sentence==1.1.0, and the resulting package covers inference with existing C2S models and finetuning your own models on your own datasets. There is also an optional speed path. Flash attention can be installed separately, and the README says it speeds up inference particularly for long sequences such as generating cells with more than a few hundred genes, with the command using no build isolation:

```bash
pip install flash-attn --no-build-isolation
```

The setup that flash attention requires, in particular a matching CUDA toolchain, is where most installs get stuck, and the README points at the flash-attention repository for the detailed instructions.

## The notebooks are the documentation

Rather than a long API reference, the project teaches through notebooks, and the table in the README is the map. Tutorial 0 covers data loading and preprocessing with an immune tissue dataset, which is the one to copy if your data is not already in the expected form. Tutorial 1 covers the rank transformation to cell sentences and the inverse transformation, which is the core concept and the one notebook worth reading in full. Tutorial 2 covers obtaining cell type embeddings with C2S models, and tutorial 3 covers finetuning on new datasets. The later notebooks add the features announced in December 2024, with tutorials 7 and 8 covering finetuning on custom prompt templates and multi-cell prompt formatting, and tutorial 5 covering cell generation, which is also where the flash attention 2 setup is demonstrated. The full API documentation is published separately on the project's readthedocs site, and the tutorials are explicitly framed as guides to common workflows rather than as an exhaustive reference.

## Research code, with the seams showing

Two things in the repository tell you what kind of project this is. The first is the release history, where the only tag is named tag-test with the release title Release test, dated 2024-09-03, which is not a versioning scheme you can pin against. The second is the Makefile, where the install target does a development install with python -m pip install -e ., the test target runs pytest against src/cell2sentence/tests, and the lint target runs pylint against a cell2sentence directory, a path that does not match the src/cell2sentence layout the test target uses. The rest of the targets are conventional, autopep8 for formatting, python -m build for the package, twine upload for distribution with a test repository variant, and a Sphinx build for the HTML documentation. The build configuration is minimal, with a setuptools backend requiring setuptools>=42. None of this is disqualifying, but it means the repository is a working lab environment that happens to be pip installable, and a team adopting it should expect to read the code rather than to consume a supported release.

## Licence, artefacts and where the project is heading

The code is published under the Apache 2.0 licence, with a LICENSE file and a NOTICE file at the root, and the project carries a DOI for the paper, 10.1101/2025.04.14.648850. That licence covers the code in this repository, and the pretrained checkpoints published on Hugging Face are separate artefacts whose terms you should read before shipping anything built on them. The repository is not archived, and the last push was on 2026-10-06, so the code is being worked on even though the release tags are not tracking that work. The documentation is built from a docs directory with Sphinx and published through readthedocs, the tutorials directory holds the notebooks, and the tree includes a pylintrc, a setup.cfg and a pyproject.toml. For a research group, the sensible reading of the whole picture is that the models and the representation are the contribution, the notebooks are the interface, and the packaging is a convenience that will keep changing as the group publishes new checkpoints.

## Conclusion

Cell2Sentence suits a computational biology group that wants to reuse published models for cell type prediction, cell embedding, generation and question answering, and that has a Hugging Face account and a GPU to run inference on, and it suits anyone who wants the rank transformation itself, which is small enough to reimplement and is described in tutorial notebook 1. It is the wrong choice for a production pipeline that needs a stable release cadence, since the repository publishes a single tag named test, and it is a poor fit for a machine learning engineer who wants a clean training framework, since the setup is a Makefile around a pip install and a set of notebooks. Before you build on it, read the rank transformation and inverse tutorial, check the licence of the specific pretrained checkpoint you plan to use on Hugging Face rather than the code licence, and confirm that your hardware can serve the 27B model or plan to use the smaller Pythia checkpoints.

## FAQ

### How do I install cell2sentence?

Clone the repository, create a Conda environment with conda create -n cell2sentence python=3.8, activate it, and run make install, which the README says installs the development environment with its dependencies. You can also install just the package with pip install cell2sentence==1.1.0.

### What is a cell sentence?

A cell sentence is the result of a rank-ordering transformation of an expression vector: the gene names are written out as space-separated names ordered by descending expression. That representation is what lets large language models work with scRNA-seq data as natural language, and the transformation and its inverse are demonstrated in tutorial notebook 1.

### Which Cell2Sentence models are available?

The README points to C2S-Scale models based on the Pythia architecture on Hugging Face, and the C2S-Scale Gemma-2 2B and 27B pretrained models were made available on 2025-10-15. Earlier releases include pythia-160m-c2s and a Pythia suite for cell type prediction, cell type conditioned generation and multi-cell multi-task work, trained on more than 57 million human and mouse cells from CellxGene and the Human Cell Atlas.

## Sources

- [Issues](https://github.com/vandijklab/cell2sentence/issues)
- [License: Apache-2.0](https://github.com/vandijklab/cell2sentence/blob/master/LICENSE)
- [README](https://github.com/vandijklab/cell2sentence/blob/master/README.md)
- [Releases](https://github.com/vandijklab/cell2sentence/releases)
- [vandijklab/cell2sentence on GitHub](https://github.com/vandijklab/cell2sentence)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/vandijklab-cell2sentence
