{"id":13706086,"url":"https://github.com/synapsec-ai/llm-defender-subnet","last_synced_at":"2025-05-05T19:34:23.973Z","repository":{"id":210970570,"uuid":"718748677","full_name":"synapsec-ai/llm-defender-subnet","owner":"synapsec-ai","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-22T12:44:03.000Z","size":17851,"stargazers_count":13,"open_issues_count":2,"forks_count":12,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-22T17:18:34.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synapsec-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-14T18:10:35.000Z","updated_at":"2024-06-21T12:00:14.795Z","dependencies_parsed_at":"2024-02-28T16:50:13.168Z","dependency_job_id":"a356fe59-92d0-4a69-aa2d-59c66af4835b","html_url":"https://github.com/synapsec-ai/llm-defender-subnet","commit_stats":null,"previous_names":["ceterum1/llm-defender-subnet","synapsec-ai/llm-defender-subnet"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synapsec-ai%2Fllm-defender-subnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synapsec-ai%2Fllm-defender-subnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synapsec-ai%2Fllm-defender-subnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synapsec-ai%2Fllm-defender-subnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synapsec-ai","download_url":"https://codeload.github.com/synapsec-ai/llm-defender-subnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252563153,"owners_count":21768413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T22:00:51.983Z","updated_at":"2025-05-05T19:34:18.964Z","avatar_url":"https://github.com/synapsec-ai.png","language":"Python","funding_links":[],"categories":["Registered Subnets"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eLLM Defender Subnet (SN14)\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003e| \u003ca href=\"https://docs.synapsec.ai\"\u003eDocumentation\u003c/a\u003e | \u003c/h4\u003e\n\n# Introduction\nThis repository contains the source code for the LLM Defender subnet running on top of [Bittensor](https://github.com/opentensor/bittensor). The LLM Defender subnet provides Large Language Model (LLM) developers a way to decentralize the computing required to detect and prevent various attacks and exploits against LLM applications. \n\nCheck the separate \u003ca href=\"https://docs.synapsec.ai\"\u003edocumentation page\u003c/a\u003e for detailed information about the Subnet.\n\n## Summary\nThere are different and constantly evolving ways to attack LLMs, and to efficiently protect against such attacks, it is necessary to layer up several defensive methods to prevent the attacks from affecting the LLM or the application relying on the model.\n\nThe subnet is being built with the concept of defense-in-depth in mind. The subnet aims to provide several **analyzers** each consisting of multiple **engines** to create a modular and high-performing capability for detecting attacks against LLMs.\n\nThe ultimate goal is to enable LLM developers to harness the decentralized intelligence provided by the subnet and combine it with their local defensive capabilities to truly embrace the concept of defense-in-depth.\n\nThe subnet is working such that the engines are providing a **confidence** score depicting how confident they are that a given input is an attack against an LLM. The summarized confidence score is used to reach a verdict on whether a given prompt is an attack against LLM or not. \n\nDue to the nature of the Bittensor network, the confidence score is a result of combined intelligence of hundreds of different endpoints providing LLM developers with unprecedented potential to secure their applications and solutions.\n\n## Quickstart\nThis repository requires python3.10 or higher and Ubuntu 22.04/Debian 12. It is highly recommended to spin up a fresh Ubuntu 22.04 or Debian 12 machine for running the subnet neurons. Upgrading from python3.8 to python3.10 on Ubuntu 20.04 is known to cause issues with the installation of the python modules required by the miners.\n\n\u003e [!WARNING]  \n\u003e We are recommending to use python virtual environment (venv) when running either the validator or miner. Make sure the virtual environment is active prior to launching the pm2 instance.\n\nInstallation:\n```\n$ sudo apt update \u0026\u0026 sudo apt install jq \u0026\u0026 sudo apt install npm \\\n\u0026\u0026 sudo npm install pm2 -g \u0026\u0026 pm2 update \u0026\u0026 sudo apt install git\n$ git clone https://github.com/ceterum1/llm-defender-subnet\n$ cd llm-defender-subnet\n$ python -m venv .venv\n$ source .venv/bin/activate\n$ pip install bittensor\n```\n\n\u003e [!NOTE]  \n\u003e During installation you might get an error \"The virtual environment was not created successfully because ensurepip is not available\". In this case, install the python3.11-venv (or python3.10-venv) package following the instructions on screen. After this, re-execute the `python3 -m venv .venv` command.\n\nIf you are not familiar with Bittensor, you should first perform the following activities:\n- [Generate a new coldkey](https://docs.bittensor.com/getting-started/wallets#step-1-generate-a-coldkey)\n- [Generate a new hotkey under your new coldkey](https://docs.bittensor.com/getting-started/wallets#step-2-generate-a-hotkey)\n- [Register your new hotkey on our subnet 14](https://docs.bittensor.com/subnets/register-and-participate)\n\n\u003e [!NOTE]  \n\u003e Validators need to establish an internet connection with the miner. This requires ensuring that the port specified in --axon.port is reachable on the virtual machine via the internet. This involves either opening the port on the firewall or configuring port forwarding.\n\n## Running Miner/Validator\n\nRun the following to boot up a miner (if you run multiple miners, make sure the name and axon.port are unique):\n```\n$ cd llm-defender-subnet\n$ source .venv/bin/activate\n$ bash scripts/run_neuron.sh \\\n--name llm-defender-subnet-miner-0 \\\n--install_only 0 \\\n--max_memory_restart 10G \\\n--branch main \\\n--netuid 14 \\\n--profile miner \\\n--wallet.name YourColdkeyGoesHere \\\n--wallet.hotkey YourHotkeyGoesHere \\\n--axon.port 15000 \\\n```\n\nPlease reference our [docs](https://docs.synapsec.ai/Validating/running_validator/) for running a validator. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynapsec-ai%2Fllm-defender-subnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynapsec-ai%2Fllm-defender-subnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynapsec-ai%2Fllm-defender-subnet/lists"}