Instructions to use insilicomedicine/longevity-llm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use insilicomedicine/longevity-llm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="insilicomedicine/longevity-llm") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("insilicomedicine/longevity-llm") model = AutoModelForMultimodalLM.from_pretrained("insilicomedicine/longevity-llm", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use insilicomedicine/longevity-llm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "insilicomedicine/longevity-llm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "insilicomedicine/longevity-llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/insilicomedicine/longevity-llm
- SGLang
How to use insilicomedicine/longevity-llm with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "insilicomedicine/longevity-llm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "insilicomedicine/longevity-llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "insilicomedicine/longevity-llm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "insilicomedicine/longevity-llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use insilicomedicine/longevity-llm with Docker Model Runner:
docker model run hf.co/insilicomedicine/longevity-llm
[10-Aug-2026: Our paper has been accepted 🥳. Enjoy full access to our model.]
Longevity-LLM (L-LLM)
A domain-adapted Qwen3.5-9B for aging and longevity biology. L-LLM is the result of continued pretraining + supervised fine-tuning + a reasoning-augmented continuation pass on a multi-domain corpus spanning clinical aging, epigenomics, transcriptomics, proteomics, and genetics. The two trained LoRA adapters were concatenated into a single rank-64 LoRA and merged into the base weights to produce this standalone bf16 checkpoint.
Methods
L-LLM was built by LoRA fine-tuning Qwen3.5-9B, a 9B-parameter hybrid transformer that interleaves Gated DeltaNet linear-attention layers with standard self-attention in a 3:1 ratio. Training data was assembled across three main domains:
| Domain | Sources |
|---|---|
| Knowledge priors | UniProt protein/gene annotations, Gene Ontology, protein–protein interactions, pathway membership; published aging-clock formulas and CpG-site coefficients (Biolearn) |
| Clinical & epidemiology | NHANES (age, mortality) |
| Epigenomics | GEO DNA-methylation cohorts, CpG methylation profiles, aging-clock proxy tasks |
| Transcriptomics | GTEx (tissue age), TCGA (cancer survival), expression-profile generation |
| Proteomics | Olink plasma-proteomics panels, proteomic clock proxy tasks |
| Genetics & longevity | OpenGenes (expression directionality), SynergyAge (lifespan), CellAge (senescence), anti-aging target classification |
| Reasoning corpus | Prediction tasks augmented with frontier-model chain-of-thought traces |
Approximate scale across all domains: ≈10⁶ training prompts at the order of several billion tokens total. Exact composition, prompt counts, and token counts will be reported in the forthcoming preprint.
Training proceeded in three stages on Qwen3.5-9B:
- Continued pretraining — knowledge priors only, raw text packed into 4,096-token blocks. Rank-32 LoRA with rsLoRA scaling, LR 2 × 10⁻⁵, 3 epochs.
- Supervised fine-tuning — aging prediction tasks in conversation format. Rank-32 LoRA initialized from the phase-1 adapter, standard α/r scaling, LR 1 × 10⁻⁴, 3 epochs.
- Reasoning continuation — continued the SFT adapter on the reasoning corpus, LR 3 × 10⁻⁵, ≈1 epoch, context length 32,768 with example packing.
All adapters targeted the 12 linear projections including the GatedDeltaNet modules. After training, the CPT and continued-SFT adapters were concatenated into a single rank-64 LoRA and merged into the base weights to produce this checkpoint. DeepSpeed ZeRO-2 on 2× NVIDIA H100 NVL 94 GB, bf16, flash-attention 2 on self-attention layers. Full details in the forthcoming preprint.
Example usage
from transformers.models.qwen3_5 import Qwen3_5ForConditionalGeneration
from transformers import AutoProcessor
model = Qwen3_5ForConditionalGeneration.from_pretrained(
"insilicomedicine/longevity-llm",
torch_dtype="bfloat16",
trust_remote_code=True,
device_map="auto",
)
processor = AutoProcessor.from_pretrained(
"insilicomedicine/longevity-llm", trust_remote_code=True
)
messages = [
{"role": "system", "content":
"You are a helpful assistant with expertise in aging biology."},
{"role": "user", "content": "What are the hallmarks of aging?"},
]
# enable_thinking=False is REQUIRED to suppress reasoning — the template
# reasons by default when the argument is omitted. See "Thinking mode".
inputs = processor.apply_chat_template(
messages, return_tensors="pt", add_generation_prompt=True,
enable_thinking=False,
).to(model.device)
out = model.generate(inputs, max_new_tokens=400, do_sample=False)
print(processor.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
Local deployment (vLLM, OpenAI-compatible)
For serving, the recommended path is our production vLLM container, pointed at a local copy of these weights. This reproduces the behaviour of our hosted inference endpoint.
What you are deploying: ≈9 B parameters, bf16, ≈18.8 GB on disk
(4 safetensors shards). Served model name: longevity-llm. The API is
OpenAI-compatible (/v1/chat/completions, /v1/completions).
Hardware
L-LLM is a single-GPU model; the weights occupy ~18.8 GB of VRAM in bf16 and the remainder is used for the KV cache (context length × concurrency).
| GPU VRAM | Suggested settings |
|---|---|
| 80–141 GB (H100 80GB, H200, A100 80GB) | --max-model-len 28000 --max-num-seqs 64 --gpu-memory-utilization 0.92 |
| 40–48 GB (A100 40GB, L40S) | --max-model-len 16000 --max-num-seqs 16 --gpu-memory-utilization 0.90 |
| 24 GB (RTX 4090, A10G) | --max-model-len 8000 --max-num-seqs 4 --gpu-memory-utilization 0.95 |
Also required: recent NVIDIA driver + CUDA 12.x, and (for the container) the NVIDIA Container Toolkit.
Local deployment was tested with H100. The 40–48 GB and 24 GB rows are estimates and have not been run.
Validated configuration
The deployment path in this section was exercised end-to-end with these parameters/hardware:
| GPU | 1 × NVIDIA H100 NVL, 94 GB (shared; ~10 GB resident from other workloads) |
| Driver / CUDA | 580.126.09 / CUDA 13.0 |
| Host OS | Ubuntu 24.04 (x86-64) |
| Container runtime | Docker 29.0.2, NVIDIA Container Toolkit |
| Image | fgalkin/longevity-llm-vllm:0.1 (vLLM 0.20.2, V1 engine, --enforce-eager) |
| Model revision | e846d14efb25dbf0472eec2404ab13c329154a57 |
| Serving flags | --max-model-len 28000 --max-num-seqs 64 --gpu-memory-utilization 0.85 |
| Observed | ~90 s cold start to HTTP 200; 59.3 GiB KV cache (1.8 M tokens); 31–35 output tok/s per request at concurrency 3 |
Not exercised: multi-GPU parallelism, non-Linux hosts, GPUs <94 GB.
Disk: Budget ~55 GB total for the weights + container.
Download the weights
pipx install "huggingface_hub[cli]"
# or: python3 -m venv ~/.venvs/hf && ~/.venvs/hf/bin/pip install -U "huggingface_hub[cli]"
hf download insilicomedicine/longevity-llm --local-dir ./longevity-llm
Gated access
Depending on when you access this page, the model may still be behind gated access. All requests are autoapproved, so don't worry.
Click Request access, then authenticate before downloading — run hf auth login (paste an hf_... read token from your account settings) or pass --token hf_... to the download command. For the container, provide the same token as -e HUGGING_FACE_HUB_TOKEN=hf_... when pulling weights from the Hub.
Serve with the production container (recommended)
The serving image is on Docker Hub as fgalkin/longevity-llm-vllm. It bundles a vLLM build with Qwen3.5 support, so you do not have to match vllm/transformers versions yourself. Mount your download at /repository:
docker run --rm --gpus '"device=0"' -p 8000:8000 \
--entrypoint python3 \
-v "$(pwd)/longevity-llm:/repository:ro" \
-e VLLM_LOGGING_LEVEL=WARNING \
-e VLLM_WORKER_MULTIPROC_METHOD=spawn \
fgalkin/longevity-llm-vllm:0.1 \
-m vllm.entrypoints.openai.api_server \
--model /repository \
--served-model-name longevity-llm \
--trust-remote-code --dtype bfloat16 \
--max-model-len 28000 --max-num-seqs 64 \
--gpu-memory-utilization 0.92 --enforce-eager \
--no-enable-log-requests --host 0.0.0.0 --port 8000
--entrypoint python3is required. The image'sENTRYPOINTis["bash"], so appendingpython3 -m vllm...as the command producesbash python3 -m vllm...— bash tries to interpret the Python binary as a shell script and the container exits 126 with/usr/local/bin/python3: cannot execute binary file. Overriding the entrypoint and passing-m ...as the argument list avoids this. (This does not bite if you deploy on HF Inference Endpoints, which supply their own launch command)
To let the container pull from the Hub instead of mounting, replace
--model /repository with --model insilicomedicine/longevity-llm and mount a
cache volume (-v "$HOME/.cache/huggingface:/root/.cache/huggingface").
Native
pip install vllmmay not always recognize theqwen3_5architecture, which is why the container is the reliable route. If you serve natively, use a vLLM build with Qwen3.5 support. This checkpoint'sconfig.jsonrecordstransformers_version: 5.6.0.
Smoke test
curl -s http://localhost:8000/health && echo OK
curl -s http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "longevity-llm",
"messages": [
{"role": "system", "content": "You are a helpful assistant with expertise in aging biology."},
{"role": "user", "content": "What does the Horvath2013 epigenetic clock measure?"}
],
"temperature": 0.0, "max_tokens": 400,
"chat_template_kwargs": {"enable_thinking": false}
}'
By default thinking is on, so without enable_thinking: false the model reasons first and all 400 tokens will likely be consumed before any answer is emitted (finish_reason: "length", no answer).
Any OpenAI SDK works by setting base_url="http://localhost:8000/v1" and model="longevity-llm" (a local server needs no API key).
Thinking mode
Reasoning ("thinking") is controlled per request, not by a server flag. The chat template reasons by DEFAULT. To disable it you must explicitly pass enable_thinking: false.
"chat_template_kwargs": {"enable_thinking": false}
The template implements this as a soft switch: with enable_thinking=false it emits a pre-closed <think>\n\n</think> block, so the model proceeds straight to the answer; otherwise it opens a bare <think> and reasons.
Two things to be aware of:
- The argument must be nested inside
chat_template_kwargs. A top-level"enable_thinking": falseis accepted without error and silently ignored. - The container serves with no reasoning parser configured, so when reasoning is on the chain-of-thought arrives inside
message.contentrather than a separatereasoning_contentfield, and it is not wrapped in visible<think>tags (the opening tag is in the prompt, not the output).
Optimal inference settings
The settings below were selected empirically on this checkpoint.
Factual and production use (reasoning off) — reproducible, lowest latency:
{
"temperature": 0.0,
"top_p": 0.8,
"top_k": 20,
"repetition_penalty": 1.1,
"max_tokens": 700,
"chat_template_kwargs": {"enable_thinking": false}
}
Open-ended or high-stakes use (reasoning on) — roughly double the tokens, measurably fewer fabricated entities:
{
"temperature": 0.0,
"top_p": 0.8,
"top_k": 20,
"repetition_penalty": 1.1,
"max_tokens": 2200,
"chat_template_kwargs": {"enable_thinking": true}
}
Pair either profile with a grounding system prompt (see Prompting below).
Token budget
Reasoning traces on this checkpoint commonly run 200–1,100 tokens before the answer begins. Budget ≥1,500 tokens with reasoning on. A 400-token budget returns finish_reason: "length" and no answer at all. With reasoning off, 400–700 tokens is fine for most prompts.
Prompting
Adding an explicit grounding instruction eliminates confident fabrication on unrecognised identifiers in testing, with no parameter changes:
You are a helpful assistant with expertise in aging biology. Ground every
claim in established literature. If a gene symbol, CpG identifier, or finding
is not one you recognise from the literature, say so explicitly and do not
speculate about its function. Never invent effect sizes.
This mitigates unwanted behaviour — see Limitations.
Parsing reasoning output
vLLM is served here without a reasoning parser, so with reasoning enabled the chain-of-thought is prepended to message.content and terminated by a literal </think>. The opening tag does not appear in the output (it is supplied by the prompt). Just in case, retain this fallback:
content = resp.choices[0].message.content
answer = content.split("</think>")[-1].strip() if "</think>" in content else content
Throughput
Measured on a single H100 NVL at concurrency 3: 31–35 output tokens/s per request. The engine reported a 1.8 M-token KV cache and headroom for ~64 concurrent 28k-token requests, so this is a per-request latency figure rather than a capacity limit. Reasoning mode approximately doubles time-to-answer.
FAQ
What are we allowed to do with the model? Run and serve it as distributed, including commercially, with attribution. The fine-tuning additions are CC-BY-ND-4.0, so redistributing modified weights is not permitted. Please contact us if you want to fine-tune, merge, or make a quantized build of L-LLM.
Is it text-only? Yes. The base architecture carries vision/video machinery, but L-LLM is trained and intended for text; send text messages only.
Can we run it on multiple GPUs? Yes, add --tensor-parallel-size N to the serving command. A single ≥24 GB GPU is otherwise sufficient (see the hardware table). Validate TP on your hardware, as hybrid linear-attention models occasionally have TP constraints.
Can we get a smaller / quantized version? Only bf16 is released, and a quantized checkpoint would be an ND-restricted derivative.
CPU, Apple Silicon, or air-gapped hosts? No CPU/Metal path (bf16, CUDA amd64). For air-gapped hosts, mount local weights and transfer the image with docker save / docker load.
Which CUDA/driver do we need? CUDA 12.x with a recent NVIDIA driver and the NVIDIA Container Toolkit. (Verified on driver 580.126.09 / CUDA 13.0.)
Are outputs reproducible? With temperature=0 decoding is greedy, but results are not bit-identical across GPU types or vLLM versions.
How do we pin a fixed version? Pin both the container tag (0.1) and the model revision rather than tracking main.
First request is slow? Cold start loads ~18.8 GB into VRAM. Measured ~90 s to /health returning 200 on an H100 NVL with weights on local SSD. Give it 2–5 minutes.
Limitations
These behaviours were observed on this checkpoint during deployment testing and should inform how outputs are consumed.
Fabricated biomedical entities. The model may state confident false claims about identifiers it does not recognise, including invented effect sizes and invented citation markers. A grounding system prompt (see Optimal inference settings → Prompting) reduces such inaccuracies.
Enabling reasoning reduces this but does not eliminate it. Reasoning mode produces fewer fabricated entities on the same prompts, but still can assert incorrect claims.
Incorrect answers. Some CpG-to-gene mappings L-LLM produces are incorrect.
Treat every gene symbol, cg identifier, effect size and citation from this model as a lead requiring verification, not as a fact. Do not use it as a primary source for clinical, regulatory, or publication purposes.
Degenerate repetition. With repetition_penalty: 1.0 the model can loop on open-ended list prompts. Always set it above 1.0 (see Optimal inference settings).
Text only. The base architecture carries vision and video components, but the model is trained and intended for text; send text messages only.
License
The fine-tuning additions in this repository are released under CC-BY-ND-4.0. The underlying Qwen3.5-9B weights remain under their original Apache-2.0 license.
Citation
@misc{insilico_medicine_2026,
author = { Insilico Medicine },
title = { longevity-llm (Revision e846d14) },
year = 2026,
url = { https://huggingface.co/insilicomedicine/longevity-llm },
doi = { 10.57967/hf/8927 },
publisher = { Hugging Face }
}
- Downloads last month
- 199