Instructions to use cosmicishan/gemma-7b-PDDL-CoT-binary with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cosmicishan/gemma-7b-PDDL-CoT-binary with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cosmicishan/gemma-7b-PDDL-CoT-binary")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cosmicishan/gemma-7b-PDDL-CoT-binary") model = AutoModelForCausalLM.from_pretrained("cosmicishan/gemma-7b-PDDL-CoT-binary", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cosmicishan/gemma-7b-PDDL-CoT-binary with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cosmicishan/gemma-7b-PDDL-CoT-binary" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cosmicishan/gemma-7b-PDDL-CoT-binary", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cosmicishan/gemma-7b-PDDL-CoT-binary
- SGLang
How to use cosmicishan/gemma-7b-PDDL-CoT-binary 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 "cosmicishan/gemma-7b-PDDL-CoT-binary" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cosmicishan/gemma-7b-PDDL-CoT-binary", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "cosmicishan/gemma-7b-PDDL-CoT-binary" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cosmicishan/gemma-7b-PDDL-CoT-binary", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use cosmicishan/gemma-7b-PDDL-CoT-binary with Docker Model Runner:
docker model run hf.co/cosmicishan/gemma-7b-PDDL-CoT-binary
gemma-7b-PDDL-CoT-binary
Gemma-7B trained to solve classical planning problems written in PDDL: SFT, then post-training on its own valid answers (outcome feedback). Given a domain and a problem, it writes a chain of thought that tracks the world state step by step, then a plan.
Part of a set of six models: Llama-3.1-8B and Gemma-7B, each as SFT, SFT + Binary feedback, and SFT + Detailed feedback. They share one dataset and one evaluation protocol.
Results
Test split of final_problems_plans_v2_cot_4levels: 1,901 problems, 10 domains, plain and obfuscated. One greedy answer per problem; a problem counts as solved when the VAL plan validator accepts the [PLAN] block.
| All | Easy (1β10 steps) | Medium (11β20) | Hard (21β30) | Plain | Obfuscated | Negative-precondition domains |
|---|---|---|---|---|---|---|
| 66.9% (1,272) | 80.9% | 63.6% | 55.8% | 70.6% | 63.2% | 45.8% |
| blocksworld | ferry | grippers | logistics | miconic | openstacks | pathways | satellite | spanner | termes |
|---|---|---|---|---|---|---|---|---|---|
| 59.9 | 100.0 | 96.5 | 40.1 | 84.0 | 76.5 | 38.0 | 74.6 | 76.5 | 23.0 |
Compared with the SFT model it starts from (1,262 solved): 144 problems newly solved, 134 newly failed, net +10 (paired sign test p = 0.59).
How to use
Prompt. Use the dataset's input column up to and including its [ASSISTANT] tag, followed by a newline. Encode it
without special tokens and put the tokenizer's BOS token in front. There is no chat template and no system prompt.
Decoding. Greedy, with prompt and answer together within 16,384 tokens (at most
16,384 new tokens). The reported
numbers compute the final logits in fp32 (vLLM's lm_head in fp32). This matters most for Gemma, whose large logits are
coarsely quantised in bf16.
Output. A [CHAIN OF THOUGHT]: the initial state and goal, then for each step the action, its preconditions,
effects and the state after. Then a [PLAN] block, one action per line. Validate that block with VAL.
Gemma activation. The config leaves hidden_activation unset. Transformers then uses the exact GELU the model was trained with (hidden_act: gelu); vLLM 0.10 would silently use the tanh approximation. With vLLM, pass hf_overrides={"hidden_activation": "gelu"} as below. The context is extended to 16,384 positions (NTK-aware RoPE base 20,109.5, already in the config).
import torch
from datasets import load_from_disk
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "cosmicishan/gemma-7b-PDDL-CoT-binary"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16, device_map="auto")
row = load_from_disk("/path/to/final_problems_plans_v2_cot_4levels")["test"][0] # the dataset is available from the authors on request
prompt = row["input"].partition("[ASSISTANT]")[0] + "[ASSISTANT]\n"
ids = [tok.bos_token_id] + tok.encode(prompt, add_special_tokens=False)
out = model.generate(torch.tensor([ids], device=model.device),
max_new_tokens=min(16384, 16384 - len(ids)), do_sample=False)
answer = tok.decode(out[0, len(ids):], skip_special_tokens=True)
plan = answer.split("[PLAN]", 1)[-1].strip()
With vLLM:
from vllm import LLM, SamplingParams
llm = LLM(model="cosmicishan/gemma-7b-PDDL-CoT-binary", dtype="bfloat16", max_model_len=16384, hf_overrides={"hidden_activation": "gelu"})
params = SamplingParams(temperature=0.0, max_tokens=min(16384, 16384 - len(ids)))
outputs = llm.generate([{"prompt_token_ids": ids}], params) # ids built as above
Training
Post-trained from cosmicishan/gemma-7b-PDDL-CoT-SFT, the SFT model, on 2,400 problems of the phase2
split. The model answered each problem once greedily and three times with sampling (temperature 0.8).
Binary feedback (outcome only).
- The SFT model's answers to the phase-2 problems were marked valid or invalid by VAL.
- The model was trained on its own shortest valid answers: rejection-sampling fine-tuning, 2,119 items from 1,515 problems with at least one valid answer.
- Invalid answers give no training signal.
Settings.
- Learning rate 2e-6, 16 items per update, 1 epoch.
- fp32 output logits; frozen embeddings and output head.
Checkpoint selection. On 280 held-out phase2 problems; the test set was never used. Candidates: step 44: 172/280, step 88: 180/280, step 132: 184/280. This
model is step 132.
Limitations
- The model is trained for this dataset's 10 domains and answer format. It is not a general-purpose planner or chat model.
- Termes is the weakest domain for every model and method.
- Research use only. No safety evaluation was done.
License
Gemma is provided under and subject to the Gemma Terms of Use, including the Prohibited Use Policy.
- Downloads last month
- -