Text Generation
Transformers
Safetensors
llama
chemistry
chain-of-thought
reasoning-faithfulness
grpo
conversational
text-generation-inference
Instructions to use phenixace/Chem-R-Faithful with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use phenixace/Chem-R-Faithful with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="phenixace/Chem-R-Faithful") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("phenixace/Chem-R-Faithful") model = AutoModelForCausalLM.from_pretrained("phenixace/Chem-R-Faithful", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use phenixace/Chem-R-Faithful with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "phenixace/Chem-R-Faithful" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "phenixace/Chem-R-Faithful", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/phenixace/Chem-R-Faithful
- SGLang
How to use phenixace/Chem-R-Faithful 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 "phenixace/Chem-R-Faithful" \ --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": "phenixace/Chem-R-Faithful", "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 "phenixace/Chem-R-Faithful" \ --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": "phenixace/Chem-R-Faithful", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use phenixace/Chem-R-Faithful with Docker Model Runner:
docker model run hf.co/phenixace/Chem-R-Faithful
Align model-card metrics with paper task-averaged results
Browse filesUse unweighted means over the twelve task variants from Diagnosis_model_task for performance, mean ER and clean-trace rate. Preserve the already task-averaged per-claim fabrication rate. Document the earlier response-weighted summaries and independent rounding to the paper's display precision. No checkpoint or evaluation record changes.
README.md
CHANGED
|
@@ -24,17 +24,39 @@ those two cases score differently.
|
|
| 24 |
|
| 25 |
Measured over twelve generative task variants (ChEBI-20 caption↔molecule, USPTO-50k
|
| 26 |
retrosynthesis, nine S²-Bench subtasks), against the Chem-R checkpoint it was trained from.
|
| 27 |
-
All four rows are
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
| | Chem-R | Chem-R-Faithful |
|
| 31 |
|---|---|---|
|
| 32 |
| per-claim fabrication rate | 22.56% | **4.35%** |
|
| 33 |
-
| mean ER (fabrication score, 0–100) | 10.
|
| 34 |
-
| clean-trace rate (ER = 0) |
|
| 35 |
-
| task performance |
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
slightly up rather than traded away.
|
| 39 |
|
| 40 |
## Usage
|
|
|
|
| 24 |
|
| 25 |
Measured over twelve generative task variants (ChEBI-20 caption↔molecule, USPTO-50k
|
| 26 |
retrosynthesis, nine S²-Bench subtasks), against the Chem-R checkpoint it was trained from.
|
| 27 |
+
All four rows below are **unweighted means over the twelve task variants** (each variant has
|
| 28 |
+
weight 1/12), calculated from the per-task values in sheet `Diagnosis_model_task` of the
|
| 29 |
+
repository's [Source Data](https://github.com/phenixace/MolReHallu/blob/0c951962d69f79c92b759b52c28d0144f6cb3ab3/data/source_data.xlsx).
|
| 30 |
+
This uses the same task-averaging convention as the paper's Fig. 1d and its mean ER across tasks;
|
| 31 |
+
the task sizes do not determine their weights in this table.
|
| 32 |
+
|
| 33 |
+
Specifically, task performance, mean ER and clean-trace rate average the `perf`, `ER` and
|
| 34 |
+
`pct_er0` columns, respectively. Per-claim fabrication rate averages `100 - cp` over tasks,
|
| 35 |
+
where `cp` is the percentage of verified claims among verified plus fabricated specific
|
| 36 |
+
functional-group claims within each task; the six generic group names excluded by the
|
| 37 |
+
evaluation code are excluded from both counts. These are means of per-task claim rates,
|
| 38 |
+
not a single claim rate pooled across tasks.
|
| 39 |
|
| 40 |
| | Chem-R | Chem-R-Faithful |
|
| 41 |
|---|---|---|
|
| 42 |
| per-claim fabrication rate | 22.56% | **4.35%** |
|
| 43 |
+
| mean ER (fabrication score, 0–100) | 10.63 | **2.39** |
|
| 44 |
+
| clean-trace rate (ER = 0) | 45.45% | **87.58%** |
|
| 45 |
+
| task performance (0–100) | 58.91 | **61.48** |
|
| 46 |
+
|
| 47 |
+
Values here are shown to two decimal places. Rounded directly from the underlying values to
|
| 48 |
+
the paper's display precision, performance is 59 / 61 (Fig. 1d), and Chem-R-Faithful has mean
|
| 49 |
+
ER 2.4 and per-claim fabrication rate 4.3%.
|
| 50 |
+
|
| 51 |
+
**Aggregation update:** Earlier versions of this card took performance, mean ER and
|
| 52 |
+
clean-trace rate from `R1_stage_ladder`, which weights these metrics by the number of responses
|
| 53 |
+
(16,107 per model: 3,300 for each ChEBI-20 task, 5,007 for retrosynthesis and 500 for each of
|
| 54 |
+
the nine S²-Bench subtasks). Those response-weighted summaries gave performance 50.09 / 51.45
|
| 55 |
+
and Chem-R-Faithful mean ER 1.73. The table above now uses equal task weights to align with the
|
| 56 |
+
paper; the model checkpoints, evaluation records and per-task results are unchanged.
|
| 57 |
+
Per-claim fabrication rate was already task-averaged and is unchanged.
|
| 58 |
+
|
| 59 |
+
Fabrication drops roughly five-fold and the clean-trace rate nearly doubles, with task performance
|
| 60 |
slightly up rather than traded away.
|
| 61 |
|
| 62 |
## Usage
|