Text Generation
Transformers
PyTorch
constrained-decoding
reachability
logit-processor
structured-generation
grammar-masking
dfa
fsm
Instructions to use uuugi/gclm-constrained-decoding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use uuugi/gclm-constrained-decoding with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="uuugi/gclm-constrained-decoding")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("uuugi/gclm-constrained-decoding", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use uuugi/gclm-constrained-decoding with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "uuugi/gclm-constrained-decoding" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "uuugi/gclm-constrained-decoding", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/uuugi/gclm-constrained-decoding
- SGLang
How to use uuugi/gclm-constrained-decoding 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 "uuugi/gclm-constrained-decoding" \ --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": "uuugi/gclm-constrained-decoding", "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 "uuugi/gclm-constrained-decoding" \ --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": "uuugi/gclm-constrained-decoding", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use uuugi/gclm-constrained-decoding with Docker Model Runner:
docker model run hf.co/uuugi/gclm-constrained-decoding
Add GitHub repo badges, clone options, and Paper PDF links
Browse files
README.md
CHANGED
|
@@ -15,14 +15,18 @@ pipeline_tag: text-generation
|
|
| 15 |
|
| 16 |
# Goal-Conditioned Reachability Logit Masker (GCLM)
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
[](https://www.python.org/downloads/)
|
| 19 |
[](https://pytorch.org/)
|
| 20 |
-
[](https://huggingface.co/docs/transformers)
|
| 21 |
[](LICENSE)
|
| 22 |
|
| 23 |
An ultra-fast, strictly **O(1)** runtime **Goal-Conditioned Reachability Logit Masking Engine** for Large Language Models.
|
| 24 |
GCLM mathematically guarantees that an LLM will strictly reach designated goal/accepting states within a fixed token budget (`T_max`), **fundamentally preventing dead-end traps and truncated syntax failures**.
|
| 25 |
|
|
|
|
|
|
|
| 26 |
---
|
| 27 |
|
| 28 |
## π‘ Key Differences: GCLM vs. Forward DFA Maskers (Outlines / SGLang)
|
|
@@ -155,13 +159,21 @@ gclm_project/
|
|
| 155 |
## π Quick Start
|
| 156 |
|
| 157 |
### 1. Installation
|
|
|
|
|
|
|
| 158 |
```bash
|
| 159 |
-
# Clone the repository from Hugging Face
|
| 160 |
git clone https://huggingface.co/uuugi/gclm-constrained-decoding
|
| 161 |
cd gclm-constrained-decoding
|
| 162 |
pip install -r requirements.txt
|
| 163 |
```
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
### 2. Basic Usage with Hugging Face Transformers
|
| 166 |
```python
|
| 167 |
import torch
|
|
@@ -226,7 +238,11 @@ python -m benchmarks.real_model_bench --model Qwen/Qwen2.5-0.5B
|
|
| 226 |
|
| 227 |
---
|
| 228 |
|
| 229 |
-
## π
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
| 231 |
```bibtex
|
| 232 |
@article{an2026gclm,
|
|
|
|
| 15 |
|
| 16 |
# Goal-Conditioned Reachability Logit Masker (GCLM)
|
| 17 |
|
| 18 |
+
[](https://github.com/uuuugi/Goal-Conditioned-Reachability-Logit-Masker)
|
| 19 |
+
[](paper.pdf)
|
| 20 |
+
[](https://huggingface.co/uuugi/gclm-constrained-decoding)
|
| 21 |
[](https://www.python.org/downloads/)
|
| 22 |
[](https://pytorch.org/)
|
|
|
|
| 23 |
[](LICENSE)
|
| 24 |
|
| 25 |
An ultra-fast, strictly **O(1)** runtime **Goal-Conditioned Reachability Logit Masking Engine** for Large Language Models.
|
| 26 |
GCLM mathematically guarantees that an LLM will strictly reach designated goal/accepting states within a fixed token budget (`T_max`), **fundamentally preventing dead-end traps and truncated syntax failures**.
|
| 27 |
|
| 28 |
+
π **Paper**: [**Read / Download `paper.pdf`**](paper.pdf) | π» **GitHub**: [**uuuugi/Goal-Conditioned-Reachability-Logit-Masker**](https://github.com/uuuugi/Goal-Conditioned-Reachability-Logit-Masker)
|
| 29 |
+
|
| 30 |
---
|
| 31 |
|
| 32 |
## π‘ Key Differences: GCLM vs. Forward DFA Maskers (Outlines / SGLang)
|
|
|
|
| 159 |
## π Quick Start
|
| 160 |
|
| 161 |
### 1. Installation
|
| 162 |
+
|
| 163 |
+
**From Hugging Face:**
|
| 164 |
```bash
|
|
|
|
| 165 |
git clone https://huggingface.co/uuugi/gclm-constrained-decoding
|
| 166 |
cd gclm-constrained-decoding
|
| 167 |
pip install -r requirements.txt
|
| 168 |
```
|
| 169 |
|
| 170 |
+
**From GitHub:**
|
| 171 |
+
```bash
|
| 172 |
+
git clone https://github.com/uuuugi/Goal-Conditioned-Reachability-Logit-Masker.git
|
| 173 |
+
cd Goal-Conditioned-Reachability-Logit-Masker
|
| 174 |
+
pip install -r requirements.txt
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
### 2. Basic Usage with Hugging Face Transformers
|
| 178 |
```python
|
| 179 |
import torch
|
|
|
|
| 238 |
|
| 239 |
---
|
| 240 |
|
| 241 |
+
## π Paper & Citation
|
| 242 |
+
|
| 243 |
+
π **Paper PDF**: [**Download `paper.pdf`**](paper.pdf)
|
| 244 |
+
π» **GitHub Repository**: [**uuuugi/Goal-Conditioned-Reachability-Logit-Masker**](https://github.com/uuuugi/Goal-Conditioned-Reachability-Logit-Masker)
|
| 245 |
+
π€ **Hugging Face Model**: [**uuugi/gclm-constrained-decoding**](https://huggingface.co/uuugi/gclm-constrained-decoding)
|
| 246 |
|
| 247 |
```bibtex
|
| 248 |
@article{an2026gclm,
|