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 (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 (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
Check it yourself (free, no key)
{
"tool": "check_license",
"arguments": {
"license": "MIT",
"intended_use": {
"model_training": true
}
}
}Computed from Rightshold's license profiles; not legal advice. Updated 2026-10-19. JSON · Markdown
