Dedicated Endpoints

Run this model inference on single tenant GPU with unmatched speed and reliability at scale.

Learn more
Container

Run this model inference with full control and performance in your environment.

Learn more

Get help setting up a custom Dedicated Endpoints.

Talk with our engineer to get a quote for reserved GPU instances with discounts.

README

License: apache-2.0

Usage

python

from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "oscardean/smollm2-135m-text2cypher"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
messages = [
{
"role": "system",
"content": (
"You translate natural-language questions into Cypher queries. "
"Use only the supplied graph schema and return only the Cypher query."
),
},
{
"role": "user",
"content": (
"Graph schema:\n"
"Person {name: STRING}\n"
"Movie {title: STRING, year: INTEGER}\n"
"(Person)-[:DIRECTED]->(Movie)\n\n"
"Question:\n"
"Which movies did Christopher Nolan direct before 2010?"
),
},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
)
outputs = model.generate(
inputs,
max_new_tokens=192,
do_sample=False,
)
prediction = tokenizer.decode(
outputs[0, inputs.shape[1]:],
skip_special_tokens=True,
)
print(prediction)

Training

HyperparameterValue
Training samples1,000
Validation samples75
Epochs3
Learning rate5e-5
Batch size2
Gradient accumulation4
Effective batch size8
Weight decay0.01
Warmup ratio0.05
Maximum sequence length800
DecodingGreedy
Checkpoint selectionLowest validation loss

Evaluation

Evaluated on the 50-sample test split.

MetricBaseFine-tuned
Basic query structure2.00%100.00%
Token F112.35%55.20%
Node-label agreement0.00%58.00%
Component match rate29.20%49.60%
Normalized exact match0.00%0.00%

Limitations

  • May hallucinate labels, relationships, or properties.
  • May omit filters, constants, or return fields.
  • May repeat conditions.
  • May use incorrect relationship directions or operators.
  • May generate SQL-like syntax instead of valid Cypher.
  • Can produce structurally plausible but semantically incorrect queries.
  • Should be validated before execution.
  • Not intended for direct production use.

Model provider

oscardean

Model tree

Base

HuggingFaceTB/SmolLM2-135M-Instruct

Fine-tuned

this model

Modalities

Input

Text

Output

Text

Pricing

Dedicated Endpoints

View details

Supported Functionality

Model APIs

Dedicated Endpoints

Container

More information

Explore FriendliAI today