Skip to content

stevenpeh-tw/prompt-fencing-experiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Prompt Fencing Experiment

This repo contains the code for experimental testing of the prompt fencing technique and paper. The experiment have only been tested with Clade Sonnet 4.5 and Gemini Pro 2.5

An overview of the technique, non-technical, is available at this blog post

Installation & Configuration

  • In the fencer folder, run:
    npm install
  • In the fence-testing folder, run:
    npm install
  • In the fence-testing folder, generate edDSA key pair, run:
    node generate-keypair.js
    • This will create a publicKey.pem and privateKey.pem in the folder. Move these to the secrets/ folder
  • In the fence-testing folder, create and add LLM API keys in the secrets folder, i.e.: secrets/claude-api.key or secrets/gemini-api.key

Running

  • In the fence-testing folder, run this command to invoke the experiment without fencing and no debug verbosity:
    node experiment-runner.js data/instructions.txt data/full-test-contents.txt secrets/privateKey.pem secrets/publicKey.pem claude-sonnet-4-5-20250929 secrets/claude-api.key false false data/fence-command.txt
  • Note, this uses claude-sonnet 4.5 and assumes the claude-api.key provided has access to it.
  • The first boolean flag denotes no fencing. To run with fencing, change it to true
  • The second boolean flag is for logging verbosity. Set to true to see verbose output
  • This codebase was tested on claude sonnet 4.5 and gemini pro 2.5.
  • To test on Gemini, create and configure the api key in the secrets folder and run the same command with the model parameter gemini-2.5-pro

Structure

  • fencer folder contains the fencing code.
  • fence-testing folder contains the experiment code and data
    • data folder contains the experiment data, instructions and sample fully combine prompts
    • secrets folder would be where we place our api keys and crypto keypairs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published