Text Generation
Transformers
Safetensors
llama
math
combinatorics
permutations
algebraic-combinatorics
causal-lm
text-generation-inference
Run this model with HF Jobs
Run ACDRepo/PermuFormer on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/ACDRepo/PermuFormer. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ACDRepo/PermuFormer on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/ACDRepo/PermuFormer. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/ACDRepo/PermuFormer. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use ACDRepo/PermuFormer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ACDRepo/PermuFormer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ACDRepo/PermuFormer")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ACDRepo/PermuFormer") model = AutoModelForCausalLM.from_pretrained("ACDRepo/PermuFormer", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ACDRepo/PermuFormer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ACDRepo/PermuFormer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ACDRepo/PermuFormer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ACDRepo/PermuFormer
- SGLang
How to use ACDRepo/PermuFormer 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 "ACDRepo/PermuFormer" \ --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": "ACDRepo/PermuFormer", "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 "ACDRepo/PermuFormer" \ --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": "ACDRepo/PermuFormer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ACDRepo/PermuFormer with Docker Model Runner:
docker model run hf.co/ACDRepo/PermuFormer
Update README.md
Browse files123---license: cc-by-4.0---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135---license: cc-by-4.0pipeline_tag: text-generationtags:- math- combinatorics- permutations- algebraic-combinatorics- llama- causal-lm---# PermuFormerPermuFormer is a small Llama-style causal language model trained on symbolic permutation tasks from algebraic combinatorics. It is intended as a specialist base model for permutation representation, reasoning, and finetuning experiments rather than as a general natural-language assistant.The model operates on a compact whitespace-tokenized vocabulary for permutations. Prompts are formulaic equations: the left side specifies a permutation task and generation begins after the `=` token.## Model Details- **Architecture:** `LlamaForCausalLM`- **Parameters:** about 75.7M- **Layers:** 12- **Hidden size:** 768- **Attention heads:** 12 query heads, 4 key/value heads- **MLP intermediate size:** 2048- **Activation:** SiLU/SwiGLU- **Position encoding:** RoPE, theta 10000- **Vocabulary size:** 186- **Context length used by tokenizer:** 1000 tokens- **Checkpoint:** `step_2600000`## Training DataPermuFormer was trained autoregressively on synthetic permutation examples generated with exact combinatorial algorithms. The paper describes a dataset of 39.8M instances, approximately 2.66B tokens, over the symmetric groups `S_2` through `S_11`.Training tasks cover three broad families:- **Translation between encodings:** one-line notation, cycle notation, reduced Coxeter expressions, RSK tableaux, inversion vectors, and Lehmer codes.- **Permutation statistics and properties:** length, descents, fixed points, sign/parity, cycle type, RSK shape, pattern avoidance, longest increasing/decreasing subsequences, and related statistics.- **Algebraic operations and comparisons:** product/composition, inverse, powers, conjugation, commutator, relative products, multiplication by simple transpositions, complement, reverse, descent tests, and Bruhat order.Some targets include computational witnesses before the final answer, for example inversion lists before a length answer or pattern witnesses before an avoidance answer.## UsageUse deterministic decoding for most evaluation-style tasks. Make sure special token IDs come from the tokenizer.```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torchmodel_id = "YOUR_ORG/permuformer"tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id)model.eval()prompt = ("<|endoftext|> n3 ""1linebegin [ 3 , 1 , 2 ] 1lineend ""in cyclenotationmake =")inputs = tokenizer(prompt, return_tensors="pt")with torch.no_grad():output_ids = model.generate(**inputs,max_new_tokens=80,do_sample=False,eos_token_id=tokenizer.eos_token_id,pad_token_id=tokenizer.pad_token_id,)print(tokenizer.decode(output_ids[0], skip_special_tokens=False))```### Prompt FormatAll tokens are separated by spaces. Multi-digit integers, delimiters, and task names are individual tokens. A typical example starts with `<|endoftext|>`, then a size token such as `n7`, then the task expression, then `=`.Translation example:```text<|endoftext|> n3 1linebegin [ 3 , 1 , 2 ] 1lineend in cyclenotationmake =```Property example:```text<|endoftext|> n3 1linebegin [ 3 , 2 , 1 ] 1lineend property lengthmake =```Algebraic operation example:```text<|endoftext|> n3 1linebegin [ 2 , 1 , 3 ] 1lineend inversemake =```## Evaluation NotesThe training code evaluates by exact match on the generated right-hand side after `=`. The local training log for this repository reports, at step 2,522,000 on a 2,560-example stratified evaluation sample:- Overall exact match: **98.44%**- Translation: **97.78%**- Property/statistic tasks: **99.17%**- Algebraic tasks: **98.36%**These figures are from the local log and should be treated as checkpoint-adjacent repository metadata, not a full benchmark report for every downstream setting.The paper also reports that PermuFormer is substantially more accurate than frontier general-purpose LLMs on a small held-out sample from the model's symbolic test distribution, while noting that the comparison is imperfect because PermuFormer was trained directly in this syntax.## FinetuningPermuFormer is designed to be finetuned on specialized permutation tasks. Experiments in the paper include:- 231-avoidance and 2143-avoidance- mHeight- Schubert polynomial structure constants- Kazhdan-Lusztig polynomial degree predictionThe repository's finetuning scripts compare starting from this pretrained checkpoint with training the same architecture from scratch.## Limitations- This is a specialist symbolic model. It expects the exact whitespace-tokenized syntax used during training and is brittle to natural-language paraphrases or malformed prompts.- The model is trained on permutations of sizes represented in the training data, primarily `S_2` through `S_11`; behavior outside that regime is not guaranteed.- Exact-match accuracy depends on canonical output formatting. Some mathematical tasks may have multiple valid answers, but evaluation expects the chosen canonical form.- The model focuses on permutations. It does not natively handle broader combinatorial structures such as arbitrary graphs or partitions unless encoded through the supported task syntax.- Outputs should be verified by exact combinatorial software for research-critical use.## CitationIf you use this model, please cite the accompanying PermuFormer paper once citation details are available.
README.md+132