Skip to main content

Contrastive Labs

Website API Playground Technical report Hugging Face: Nenya 1 License

Nenya 1 is a 500m active parameter model built on top of our Nenya base. It excels at tool calling, extraction and classification at a fraction of the cost and latency.

nenya-vllm runs the Nenya models natively on vLLM 0.33.0: Nenya 1 (chat, tool calls) and the Nenya base model. It's a vLLM plugin with fused Triton kernels for the decode path, plus vLLM's OpenAI compatible server w/ Nenya's chat format & tool parser. No vLLM fork. No --trust-remote-code.

Quickstart

# brings vLLM 0.33.0 (pinned exactly: the plugin uses vLLM internals) and flash-linear-attention 0.5.2
pip install nenya-vllm          # with uv: uv pip install nenya-vllm --torch-backend=auto

# vLLM's OpenAI-compatible server on port 8000, model name "nenya"
nenya-vllm serve contrastivelabs/Nenya-1
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
tools = [{"type": "function", "function": {
    "name": "get_weather", "description": "Get the current weather for a city.",
    "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}]
r = client.chat.completions.create(
    model="nenya", tools=tools,
    messages=[{"role": "user", "content": "What is the weather in Paris right now?"}])
print(r.choices[0].message.tool_calls[0].function)
# Function(arguments='{"city": "Paris"}', name='get_weather')
  • nenya-vllm serve MODEL takes a Hub id or a local folder and starts vllm serve with Nenya's settings (--dry-run prints the command). nenya-vllm serve --help lists its options; every option also reads an environment variable (PORT, SERVED_MODEL_NAME, ...), and arguments it doesn't know go to vllm serve unchanged. More in docs/serving.md.
  • Tool calls are greedy by default. The middleware carries a call guard: a request with tools that sets no sampling is decoded greedily, one without max_tokens is capped at 2,048 tokens, and a non-streamed reply whose call block doesn't parse is generated once more. Chat without tools keeps the model's sampling (temperature 0.9, top-k 20). --no-call-guard switches it off.
  • The first start is slow. vLLM compiles FlashInfer's kernels for your GPU on its first forward pass (20 minutes or more, once per machine), and the plugin's Triton kernels compile and autotune on their first use (a few minutes). Later starts take seconds.
  • The base model is a continuation model: serve contrastivelabs/Nenya-2.5B-A0.5B-Base the same way and use /v1/completions.

Without vLLM, on any device (transformers, the nenya pip package, or the Metal engine on a Mac): see the model cards of Nenya 1 and the base model.

Benchmarks

Nenya 1 against eight open models on tool calling (BFCL v4 single-turn), extraction and classification

Latency per call, cost per 1,000 calls and energy per call, Nenya 1 against eight open models

Latency, cost and energy are for one request at a time on one RTX 5090, with Nenya 1 served by this plugin. More benchmarks are on the model card.

Generation speed with version 1.0, in output tokens per second on one RTX 5090:

Requests at once Decoding Served over HTTP
1 642 500
16 4,945 3,844
64 11,442 7,393
256 21,147 10,001

Decoding is the rate of the generation steps (greedy, 512-token prompts, 256 new tokens per request). Served is end to end through vllm serve (1,024-token prompts, 256 output tokens). Measured with the base model, which has Nenya 1's architecture, on a server with two EPYC 7B12 CPUs.

Examples

Each example uses the client from the Quickstart. The comment under a call is what the model returned.

Extraction: recall notices

Turn a document into a record. Name the fields in the system message and send the document on its own as the user message.

fields = ('Extract these fields from the document as JSON: "company" (string), '
          '"product" (string), "units" (number), "reason" (string). '
          'Use null for a field the document does not state.')
notice = ("Acme Foods is recalling 12,400 jars of its Crunchy Peanut Butter because "
          "they may contain small pieces of glass.")

r = client.chat.completions.create(model="nenya", temperature=0, messages=[
    {"role": "system", "content": fields}, {"role": "user", "content": notice}])
r.choices[0].message.content
# '{"company": "Acme Foods", "product": "Crunchy Peanut Butter", "units": 12400,
#   "reason": "may contain small pieces of glass"}'

Classification: customer support intent

Route a message before a human sees it. Put the question, the text and your labels in one message, and ask for the label only.

question = """Which team should handle this message?

Message:
I was charged twice when my subscription renewed on April 15. Please refund one payment.

Options:
- order_status
- refund_request
- cancel_subscription
- login_problem
- shipping_delay

Answer with the label only."""

r = client.chat.completions.create(model="nenya", temperature=0, messages=[
    {"role": "user", "content": question}])
r.choices[0].message.content
# 'refund_request'

Accuracy with Nenya 1

Nenya 1 served by this plugin gives what training recorded for the same weights. Measured on the released files, on an RTX 5060 Ti (BFCL) and an RTX 5070 (the lm-eval tasks):

Check Recorded in training Through this plugin
BFCL v4, 13 single-turn categories, 3,641 entries (mean of the categories, %) 75.43 75.26
11 lm-eval tasks (mean, %) 57.00 57.03

More checks, and how each was measured: docs/benchmarks.md.

Limitations

  • vLLM 0.33.0 only. The plugin uses vLLM internals, so it is pinned to one vLLM version; a new vLLM version needs a new release of the plugin.
  • NVIDIA GPUs. Tested on RTX 50-series cards (5060 Ti, 5070, 5090) and the RTX PRO 6000 with CUDA 13 drivers.
  • Nenya 1 is a small model tuned for tool calls, extraction and classification. It is weaker than larger models on general knowledge and reasoning, and it can produce false, biased or unsafe content. The base model continues text and does not follow instructions.
  • Trained mostly on English web, educational, academic, code and maths data.
  • Quality past 16,384 tokens is untested. With no positional encoding there is no hard limit.

License

Apache 2.0: see LICENSE. NOTICE lists the third-party material:

  • nenya_vllm/ops/dilated_conv.py is copied from vLLM (Apache 2.0);
  • nenya_vllm/model_state.py is adapted from vLLM;
  • benchmarks/data/origin_of_species.txt is in the public domain.

The models' weights and tokenizers are licensed in their repositories (Nenya 1, base model).

  • Nenya 1 on Hugging Face: the model card, with all the benchmarks.
  • API docs: call Nenya 1 through our hosted, OpenAI-compatible API.
  • Cookbooks: worked examples of extraction, classification and tool calling.
  • Playground: try Nenya 1 in your browser.
  • nenya on PyPI: the pip package that runs Nenya on any device.
  • Metal 8-bit weights: the weight file of the Metal engine for Apple silicon.
  • Serving: what nenya-vllm serve runs, your own fine-tune, how the plugin loads.
  • Benchmarks in full: every table, the setup, and how to run them yourself.
  • Changelog: what changed since version 0.1.

Metadata

Release files for nenya-vllm 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nenya-vllm 1.0.0
File Size Uploaded Provenance Actions
nenya_vllm-1.0.0.tar.gz 205.1 kB Without provenance Details for nenya_vllm-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nenya-vllm 1.0.0
File Interpreter ABI Platform Actions
nenya_vllm-1.0.0-py3-none-any.whl Python 3 none any Details for nenya_vllm-1.0.0-py3-none-any.whl

Total release size: 387.1 kB

Release files / nenya_vllm-1.0.0.tar.gz

Download URL nenya_vllm-1.0.0.tar.gz
Size 205.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e8e13db047b07e37505f3157b29bdf3a34710bd6a104d9d834fcfa906d85a208
BLAKE2b-256 checksum
How to use checksums
0d4d928490bc447a49504134a19790f6fdf463914d28203f37c51655402b6acb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / nenya_vllm-1.0.0-py3-none-any.whl

Download URL nenya_vllm-1.0.0-py3-none-any.whl
Size 182.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c257c1611700f50d8e79b117e06c491fcfa317dc4eefaa50d8242112abde3e2
BLAKE2b-256 checksum
How to use checksums
fd65cc2ee79cc9673950d40790f40f28416beda8f39c811e6cbac29756524f07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for nenya-vllm 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page