Skip to content

cam-cambridge/CIPHER

Repository files navigation

CIPHER : Control and Interpretation of Production via Hybrid Expertise and Reasoning

CIPHER controlling a 3-D printer
Figure 1 – CIPHER translates textual/visual prompts into printer commands, through physics- and geometry-informed reasoning.

Autonomous design and printing

AI desings and prints its own parts
Figure 2 – Send pics of your AI-generated printed parts at {cm2161@cam.ac.uk} to be featured in our project page!


Codebase structure

CIPHER/
├── requirements.txt          # install Python dependencies
├── src/                    
│   ├── config.py             # Configuration and hyperparameters
│   ├── model.py              # Main VLA model implementation
│   ├── vexpert.py            # Vision expert for process monitoring
│   ├── train.py              # Training loops and callbacks
│   ├── main.py               # Training loops and callbacks
│   └── utils
│       ├── data_utils.py   
│       ├── test_utils.py   
│       └── utils.py
├── scripts/
├── prompts/
└── assets/


Setup environment

Requirements and setup

  • cuda>=11
  • torch>=1.7
  • Python >= 3.11
git clone git@github.com:cam-cambridge/CIPHER.git
cd CIPHER
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export HF_TOKEN=hf_********************************

where ******************************** is your HF key (see https://huggingface.co/docs/hub/en/security-tokens)

Installation of all packages and token setup should take <10 minutes.

Train

bash scripts/train.sh

The pre-trained microsoft/ResNet-50 model and the pre-trained meta-llama/Llama-3.2-1B will be fetched from Hugging Face. The train dataset (subset) will be fetched from cemag/tl-caxton.

We train on 4 × NVIDIA A100 80GB in less than a day. LoRA models can be trained with significantly fewer resources.

Explicit Notes on Model Licensing & Commercial Use: While all code in this repository is released under an MIT License, our pretrained models may inherit restrictions from the underlying base models we use. Specifically, CIPHER is derived from Llama-3.2, and as such are subject to the Llama Community License.

Inference / Tests

We have prepared test scripts for the experiments as seen in the paper. Available scripts:

Script Details
ask.sh Ask a single question to the model
Args: --model_path, --question, --results_path
test_flowrate_predictions.sh Test flowrate predictions on test dataset
Args: --test_samples, --batch_size, --model_path, --data_path, --results_path
test_vanilla_control.sh Test vanilla control performance
Args: --model_path, --num_questions, --prompt_path, --results_path
test_domain_expertise.sh Test domain expertise with/without RAG
Args: --model_path, --questions_path, --rag, --results_path, --context
test_overfit.sh Test models catastrophic forgetting on SQUAD (language) and Flickr30 (image) datasets
Args: --test_samples, --model_path, --results_path

Each script has a help menu accessible via -h or --help flag. Scripts output .csv files saved under RESULTS_PATH (by default ="./results") in scripts.

Any of these experiments can run using

bash scripts/{script.sh}

Citation

⭐ If you find our code or models useful in your work, please cite our paper:

Christos Margadji & Sebastian W. Pattinson (2025). Hybrid Reasoning for Perception, Explanation, and Autonomous Action in Manufacturing. arXiv:2506.08462

@article{MargadjiPattinson2025HybridReasoning,
  title   = {Hybrid Reasoning for Perception, Explanation, and Autonomous Action in Manufacturing},
  author  = {Margadji, Christos and Pattinson, Sebastian W.},
  year    = {2025},
  note    = {arXiv:2506.08462},
  url     = {https://arxiv.org/abs/2506.08462}
}

About

Control and Interpretation of Production via Hybrid Expertise and Reasoning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published