# Can I train an AI model on code from GitHub?

**Short answer:** MIT code: Needs review. GPL-3.0 code: Needs review.

Each repository's license decides; training is not named in most code licenses.

## MIT code — Needs review

License: [MIT License](https://opensource.org/license/mit) (`MIT`, curated)

- The license grants broad rights but attaches conditions (such as keeping notices) to copies and adaptations. Whether a trained model, or its output, is a copy or adaptation that carries those conditions is legally unsettled, and in some places training may fall under an exception such as fair use. A human reviewer should confirm this use for your case.

Duties: attribution, license_notice
## GPL-3.0 code — Needs review

License: [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html) (`GPL-3.0-only`, curated)

- The license grants broad rights but attaches conditions (such as keeping notices) to copies and adaptations. Whether a trained model, or its output, is a copy or adaptation that carries those conditions is legally unsettled, and in some places training may fall under an exception such as fair use. A human reviewer should confirm this use for your case.

Duties: attribution, license_notice, state_changes, share_alike, source_disclosure

## Context
- Whether a model trained on code is a derivative work is unsettled; Rightshold marks it for review where the license does not settle it.

## Sources
- [GitHub: Licensing a repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository)

## Check it yourself (free, no key)
```json
{
  "tool": "check_license",
  "arguments": {
    "license": "MIT",
    "intended_use": {
      "model_training": true
    }
  }
}
```
REST: POST https://www.rightshold.com/v1/licenses/check

_Computed from Rightshold's license profiles; not legal advice. Updated 2026-10-19. JSON: https://www.rightshold.com/answers/can-i-train-ai-on-github-code.json_