# zou-group/textgrad

TextGrad: Automatic ''Differentiation'' via Text -- using large language models to backpropagate textual gradients. Published in Nature.

Repository: https://github.com/zou-group/textgrad
Canonical: https://ross.abutalabs.com/products/textgrad
Homepage: http://textgrad.com/
Language: Python
License: MIT
License Family: permissive
Topics: large-language-models, prompt-optimization, compound-systems, textual-gradients, ai-optimization
Last push: 2025-07-25T14:30:39+00:00

## Health v2 (maintenance only)
Score: 29/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 33, release rhythm 8, longevity 58
- inputs: {"age_days": 814, "days_push": 404, "days_rel": 626, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3706, forks 293 (observed 2026-08-28T04:08:15.088818+00:00)

## What it is
TextGrad is a Python framework that implements automatic 'differentiation' via text, using LLM-generated natural language feedback as gradients to optimize prompts, solutions, and compound AI systems. Its API mirrors PyTorch, letting users define losses and backpropagate textual feedback through arbitrary pipelines of agents and tools.

## Use cases
- optimize llm prompts automatically
- improve gpt-4o solutions to hard coding problems
- refine answers to scientific questions at test time
- design new molecules with desired properties
- optimize multi-agent llm pipelines with text feedback
- boost reasoning benchmark scores via llm critique

## When to choose
- you want to optimize prompts or LLM outputs using natural-language feedback instead of numeric gradients
- you already know PyTorch and want a familiar API for text-based optimization
- your system contains black-box components like LLMs or tools that standard gradient descent cannot tune
- you want model-provider flexibility via litellm (OpenAI, Bedrock, Gemini, Together, etc.)

## When to avoid
- you need traditional numerical gradient-based training of neural network weights
- you cannot afford the LLM API costs of iterative critique-and-revise loops
- you need a fully stable API - the litellm-based engines are still experimental and old engines are being deprecated
- your optimization target is fully differentiable and standard autograd frameworks suffice

## Facets
- artifact type: library
- maturity: active
- function: llm-inference, prompt-engineering, agent-framework, machine-learning
- domain: large-language-models, artificial-intelligence
- platform: python, cross-platform
- tags: textual-gradients, autograd, prompt-optimization, llm-feedback, compound-ai-systems, pytorch-like-api, litellm, ai-agents, natural-language-processing

## Member repositories
- zou-group/textgrad (main) score 29

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:15.088818+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:30:58.772710+00:00, confidence not recorded.
  - readme: https://github.com/zou-group/textgrad (fetched 2026-08-28T04:08:15.088818+00:00, sha 94ec86c0c78e)
  - homepage: http://textgrad.com/ (fetched 2026-08-29T09:24:31.784996+00:00, sha 79593089abff)
  - registry_pypi: https://pypi.org/pypi/textgrad/json (fetched 2026-08-29T09:24:31.794181+00:00, sha 34410de6fb65)
- Data as of 2026-08-30T08:39:29.467469+00:00.
