Instructions to use cosmicishan/gemma-7b-PDDL-CoT-Detailed with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cosmicishan/gemma-7b-PDDL-CoT-Detailed with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cosmicishan/gemma-7b-PDDL-CoT-Detailed")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cosmicishan/gemma-7b-PDDL-CoT-Detailed") model = AutoModelForCausalLM.from_pretrained("cosmicishan/gemma-7b-PDDL-CoT-Detailed", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cosmicishan/gemma-7b-PDDL-CoT-Detailed 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-Detailed" # 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-Detailed", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cosmicishan/gemma-7b-PDDL-CoT-Detailed
- SGLang
How to use cosmicishan/gemma-7b-PDDL-CoT-Detailed 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-Detailed" \ --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-Detailed", "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-Detailed" \ --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-Detailed", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use cosmicishan/gemma-7b-PDDL-CoT-Detailed with Docker Model Runner:
docker model run hf.co/cosmicishan/gemma-7b-PDDL-CoT-Detailed
gemma-7b-PDDL-CoT-Detailed
Gemma-7B trained to solve classical planning problems written in PDDL: SFT, then post-training with step-level feedback from a simulator and an optimal planner. 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 nine models: Llama-3.1-8B, Gemma-7B and Qwen2.5-7B-Instruct, 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 |
|---|---|---|---|---|---|---|
| 76.4% (1,452) | 88.6% | 71.9% | 69.0% | 79.7% | 73.1% | 57.0% |
| blocksworld | ferry | grippers | logistics | miconic | openstacks | pathways | satellite | spanner | termes |
|---|---|---|---|---|---|---|---|---|---|
| 88.4 | 98.0 | 97.1 | 59.3 | 92.5 | 89.0 | 45.0 | 74.1 | 85.5 | 37.0 |
Compared with the SFT model it starts from (1,262 solved): 285 problems newly solved, 95 newly failed, net +190 (paired sign test p = 4e-23).
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 (Qwen2.5 defines none, so its prompt has no BOS). 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-Detailed"
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] if tok.bos_token_id is not None else []) + 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-Detailed", 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, chosen without using any test results. The model answered each problem once greedily and three times with
sampling (temperature 0.8).
Detailed feedback. The answers of the SFT model on the phase-2 problems were labelled at every step.
- The simulator replayed each answer.
- Fast Downward, an optimal planner, computed the remaining optimal plan length at every visited state, and the full set of optimal actions at every error state.
- 6,825 trajectory items use a set-valued loss. It raises the total probability of all optimal actions at each step, so any optimal action counts.
- 3,610 check-and-retry items teach the model to write
Check failed: <fact> is false. Cannot apply this action.at an illegal step, and then to retry with an optimal action. - In total: 10,435 items and 210,079 decisions.
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 217: 172/280, step 435: 204/280, step 652: 214/280. This
model is step 652.
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.
- Check-and-retry. 354 test answers contain a
Check failedline. 216 of them run out of tokens before writing the[PLAN]block, and 138 more have a[PLAN]block that VAL rejects, often because it still lists an action the model itself rejected. Rebuilding the plan from the steps the model kept in its trace would give 1,533 / 1,901 solved. That is a diagnostic only; the results above use the standard[PLAN]scoring.
License
Gemma is provided under and subject to the Gemma Terms of Use, including the Prohibited Use Policy.
- Downloads last month
- -