服务默认只接受 localhost 或 127.0.0.1 的请求,从其他机器访问需加 --host 0.0.0.0 --allowed-hosts 指定主机名;FAISS 需自行 pip install faiss-cpu,且与 PyTorch 共存会冲突;服务端 RAG 功能需额外安装 pip install chainforge[rag],浏览器端 RAG 首次使用需下载小模型。
ChainForge
ianarawjoMIT活跃维护可视化编程环境,用来对 LLM 提示词做压力测试和效果对比,方便快速验证不同提示方案的表现。
An open-source visual programming environment for battle-testing prompts to LLMs.
pip install chainforge
chainforge serveREADME 未说明显存或 GPU 要求;本地安装需 Python 3.10 或更高版本,也可通过 Ollama 查询本地运行的模型。
可视化编排的 LLM 提示词批量对比与评测环境,帮你快速选出最佳提示词和模型
可视化编程环境,用来对 LLM 提示词做压力测试和效果对比,方便快速验证不同提示方案的表现。
核心能力
- 对提示词模板输入变量取笛卡尔积,一次性发出上百条查询
- 同时查询多个模型与多组模型设置并横向对比响应质量
- 用 Python 脚本编写评测节点,对响应打分并接入可视化
- 用分组箱线图和直方图展示数值与布尔型评测指标
- 内置生成式 AI 功能,可合成数据表与评测起始代码
容易踩的坑
- v0.3.7v0.3.7: RAGForge 🔎, In-browser LLMs 🌐, Doc Uploads (PDF, etc), OpenRouter 🔀, Reasoning Tokens, Grid View最新正式版2026-09-16 · 2026-09-16 22:14 UTC
ChainForge 0.3.7 is our biggest update in a while: RAG pipelines, LLMs that run in your browser with no API key, OpenRouter and reasoning models, and a refreshed Response Inspector.
🔎 RAGForge: retrieval-augmented generation
New Upload, Chunk, Retrieval and Rerank nodes let you build RAG pipelines and compare them the way you already compare prompts, e.g., two chunkers against three retrievers, side by side.
- Runs entirely in the browser in a "lite" model, with nothing installed: PDF, DOCX and Markdown uploads, BM25 and semantic search, and cross-encoder reranking.
- Adds ability to upload Documents using the Upload Docs Node, which can be used as input to prompt nodes, outside of RAG itself.
- Running locally with
pip install chainforge[rag]adds more advanced RAG chunkers, retrievers, etc: server-side embeddings, LanceDB vector stores, TF-IDF, Chonkie chunkers and Cohere reranking. This is the recommended approach for developers---RAGForgeLite is just to let people get a taste on the web browser-only edition!
To get a sense of RAGForge, try the new Darwin's letters Q&A example (Example Flows → RAG Examples), which contains 60 public-domain letters from Charles Darwin.
💭 RAG Chat Node
Ask your pipeline questions in real time. The RAG Chat node runs each question through your flow's own nodes and shows one answer per configuration, labeled with what differs.
🌐 In-browser LLMs: no API key needed
Six small models now run entirely in your browser (via WebLLM): Gemma 3 1B, Llama 3.2 1B, Qwen2.5 0.5B, Qwen3.5 0.8B, SmolLM2 1.7B and Qwen3 1.7B. Each downloads once and is cached. Qwen2.5 0.5B is the new default model in Prompt Nodes. ChainForge also now supports Safari.
🔀 OpenRouter provider
- OpenRouter is a new provider: one API key for Claude, GPT, Gemini, Grok, DeepSeek, Qwen, Kimi and image models. Type in any model ID.
Reasoning tokens now appear!
- Reasoning is captured from Claude, Gemini, OpenAI, DeepSeek, OpenRouter and the in-browser Qwen models. It shows behind a 💭 toggle in the inspector, is available to evaluators as
reasoningin theresponse.metadict, and is sent back to the model in Chat Turns:
🔍 A refreshed Response Inspector
- Grid View lays responses out by any variables or by model, with filters, score badges and heatmap coloring. It stays fast with thousands of text or image responses.
- Table View and Grouped List use compact, model-colored response cards. Click one to read it in full.
🔗 See what's flowing along edges
Edges show how many values they carry. Hover over one to preview the first few values, their variables, and counts per model, without opening a node.
ALL Models and providers now UPDATED to 2026 editions!
- All models from OpenAI, Anthropic and Google, including GPT-5.x, Claude 5 and Gemini 3.x, and their image models (GPT Image 2.x, Ge
- v0.3.6v0.3.6: Add Media Node 📺 and Image Inputs2025-05-11 · 2025-05-11 19:44 UTC
查看更新说明
Image inputs to OpenAI, Anthropic, Google, and Ollama providers
You can now upload images to a new Media Node and query with image inputs:
This is currently only limited to OpenAI, Anthropic, Google, and Ollama. If you want more provider support, consider making a PR. The relevant calls to LLMs are in
utils.ts.Image outputs to image inputs
Also enables generating images with one model and then passing them through prompt chaining to another, e.g.,
...Lots of other internal changes
This update required making lots of changes to how ChainForge stores media.
Images take up a lot of space in the browser. To handle this, ChainForge does not store the images in the browser (anymore). Instead we keep unique IDs to each image, derive from their SHA-256 hash, which we use to query the backend and pull the image only when it's necessary (e.g., viewing images in Table Views).
When running locally, ChainForge now copies media your upload into a
mediadirectory stored in the same place it puts Saved Flows.As a consequence, ChainForge can now export and import
cfzipbundles which are compressed .cforge (JSON) files alongside the media file(s) used in the flow.(When running on the browser on chainforge.ai/play, ChainForge will continue to cache images in the front-end.)
These changes will make it easier to add data-heavy analysis pipelines, i.e. loading many documents and chunks into a RAG pipeline, in the near future.
If you encounter any problems with this release, please let us know.
Python 3.10+ are now the only versions supported by ChainForge.
We have deprecated support for 3.8 and 3.9 since the
markitdownpackage required 3.10. This is a forward-thinking change since many other RAG-related packages now require ~3.10.Developers
This update was initiated by the work of @loloMD and @RoyHEyono , who added the Media Node and image inputs to ChainForge's querying infrastructure. Thank you Roy and Loic! 🎉🙌📺
- v0.3.5v0.3.5: Favorites ♥️, Ollama List 🦙, Encryption 🔐, Persistent Settings ⚙️2025-04-15 · 2025-04-15 03:10 UTC
查看更新说明
This update adds four features for when ChainForge is running locally:
- You can now Favorite ♥️ your nodes and models (at their precise settings), to recreate them later.
- To favorite a node, just right-click it and hit "Favorite".
- To favorite a model, open the model's settings screen and click the Favorite button in the top-right.
- Favorites persist across sessions.
- Global Settings ⚙️ now persist across sessions, by storing a
settings.jsonfile to the same directory as Saved Flows. - If you are running Ollama 🦙 locally, the menu model list now autopopulates for easy access (refresh the page if it doesn't show up):
- You can now password-encrypt 🔐 the locally Saved Flows and settings config file, if you want. Just add the flag --secure when running
chainforge serve.Seechainforge serve --helpfor options. (The "Export" and "Import" UI buttons will continue to only serve unencrypted flows.)- This is useful if you want to store API keys on the front-end UI, using the new Global Settings storage, but are worried about saving such information in a text file. There's a 'settings' option that will only encrypt this settings file.
- The Nodes list in Add Nodes is a bit nicer and has a nested menu.
Pick your Favorites ♥️:
https://github.com/user-attachments/assets/8510c082-c8a3-4842-a9da-90700cfd30d1
and Encrypt your Flows 🔐:
This is part of an effort to make ChainForge more customizable and secure.
As a bonus, the update adds support for OpenAI GPT-4.1 and Google Gemini 2.5 Pro models.
This update required some rearranging to improve code quality. The
App.tsxfile now uses a customNestedMenu, and same with the models dropdown, since Mantine ContextMenu was too limited. The nodes menu inApp.tsxis also closer to a JSON spec rather than written as React elements.[!WARNING] This update introduced a significant number of changes to the codebase, including a number of refactorings. If you encounter any issues, please raise an Issue.
- You can now Favorite ♥️ your nodes and models (at their precise settings), to recreate them later.
- v0.3.4v0.3.4: Better Table View, Saved Flows sidebar, optimized string storage2025-02-28 · 2025-02-28 19:59 UTC
查看更新说明
This update brings three major quality-of-life changes:
- Strings throughout the application are now frequently interned in a global
StringLookuptable, to improve performance and reduce duplicate memory usage. This noticeably improves performance when the number of LLM responses start to exceed 1000, and also results in smaller memory footprint for exported .cforge files. - A Saved Flows sidebar to keep track of your flows when running ChainForge locally, and a Save button. This interacts with the Python backend and stores the data in the folder suggested by
platformdirs. The specific location appears in the footer of the sidebar (in case you want to manage it yourself). - Table View in Response Inspectors now uses Mantine React Table. This brings:
- Sort columns by value
- Selectively show/hide columns
- Filter within columns
- Sticky header when scrolling down the table
- Pagination to improve performance when rendering large tables
In addition, Response Inspectors now try to lazy-load and show a LoadingSpinner when first calculating the selected inspector view.
This change is a first-step towards moving the
StorageCacheinto the Python back-end when the memory footprint exceeds a MB threshold. This will enable a lighter and streamlined front-end when running large-scale experiments.Minor changes:
- Removed unnecessary dependencies on
anthropicandgooglepackages. The latter blocked forever when attempting to installgrcpioon my machine.
[!WARNING] This change touched many source code files in ChainForge and altered the way
cforgefiles are imported and exported. Although changes should be backwards-compatible and bug-free, this cannot be guaranteed. If performance breaks, revert to the previous version. - Strings throughout the application are now frequently interned in a global
- v0.3.2.5v0.3.2.5: Generate Tables2024-12-19 · 2024-12-19 20:51 UTC
查看更新说明
New ChainForge release ✨out now: Generate a table from a prompt, extend rows, add a column like magic!
https://github.com/user-attachments/assets/8c696a78-8a40-4896-854a-db6060762ad4
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
⛓️🛠️ ChainForge
An open-source visual environment for battle-testing prompts to LLMs.
ChainForge is a data flow prompt engineering environment for analyzing and evaluating LLM responses. It enables rapid-fire, quick-and-dirty comparison of prompts, models, and response quality that goes beyond ad-hoc chatting with individual LLMs. With ChainForge, you can:
- Query multiple LLMs at once to test prompt ideas and variations quickly and effectively.
- Compare response quality across prompt permutations, across models, and across model settings to choose the best prompt and model for your use case.
- Setup evaluation metrics (scoring function) and immediately visualize results across prompts, prompt parameters, models, and model settings.
- Use AI to streamline this entire process: Create synthetic tables and input examples with built-in genAI features, or supercharge writing evals by prompting a model to give you starter code.
Read the docs to learn more. ChainForge comes with a number of example evaluation flows to give you a sense of what's possible, including 188 example flows generated from benchmarks in OpenAI evals.
ChainForge is built on ReactFlow and Flask.
For user-curated resources and learning materials, check out the 🌟Awesome ChainForge repo!
Table of Contents
- 👉 Documentation 📖
- Installation
- Example Experiments
- Share with Others
- Features (see the docs for more comprehensive info)
- Development and How to Cite
Installation
You can install ChainForge locally, or try it out on the web at https://chainforge.ai/play/. The web version of ChainForge has a limited feature set. In a locally installed version you can load API keys automatically from environment variables, write Python code to evaluate LLM responses, or query locally-run models hosted via Ollama.
To install Chainforge on your machine, make sure you have Python 3.10 or higher, then run
pip install chainforge
Once installed, do
chainforge serve
Open localhost:8000 in a Google Chrome, Firefox, Microsoft Edge, or Brave browser.
Security: ChainForge can run Python code on your computer, so its server only accepts requests from ChainForge's own page. It refuses requests from other websites, and requests addressed to any name other than
localhostor127.0.0.1. If you reach ChainForge by another name or address (on a server, say, or from another machine), add it:chainforge serve --host 0.0.0.0 --allowed-hosts your.server.name.
Retrieval-augmented generation (RAG)
ChainForge's RAG nodes -- Upload, Chunk, Retrieval and Rerank -- work in the browser with no extra installation: documents, chunking, keyword retrieval, semantic search and reranking all run client-side on small models fetched the first time you use them.
For the server-side RAG stack as well -- hosted embedding providers, persistent LanceDB vector stores, TF-IDF and the larger rerankers -- install the extra:
pip install chainforge[rag]
A note on FAISS
The faiss_vector_store retrieval method works whenever faiss is importable,
but ChainForge deliberately does not install it for you. The FAISS pip wheels
bundle their own OpenMP runtime, which collides with any other library that
brings one: installed alongside PyTorch, the combination crashes the process
outright, and upstream has closed every report of this without a fix. If you
need FAISS, install it yourself:
pip install faiss-cpu
ChainForge will then limit OpenMP to a single thread at startup to keep the two
runtimes from killing each other, and say so when it does. That makes embedding
slower, which is why it only happens when FAISS is actually present. Set
OMP_NUM_THREADS yourself to override it.
You can set your API keys by clicking the Settings icon in the top-right corner. If you prefer to not worry about this everytime you open ChainForge, we highly recommend that save your OpenAI, Anthropic, Google, etc API keys and/or Amazon AWS credentials to your local environment. For more details, see the How to Install.
Run using Docker
Quick start with Docker Compose (recommended):
docker compose up -d
Access ChainForge at http://localhost:8000
To open it from another machine, tell ChainForge the name or IP address you use, e.g. -e CHAINFORGE_ALLOWED_HOSTS=your.server.name. Requests addressed to other names are refused.
For detailed Docker documentation including architecture support, environment variables, and CI/CD setup, see docker/README.md.
Supported providers
- OpenRouter (models from many providers, including image models, with one API key)
- OpenAI
- Anthropic
- Google Gemini
- DeepSeek
- HuggingFace (Inference Providers and dedicated Endpoints)
- Together.ai
- Ollama API (locally-hosted models)
- Microsoft Azure OpenAI Endpoints
- Amazon Bedrock-hosted on-demand inference, including Anthropic Claude 3
- ...and any other provider through custom provider scripts!
OpenAI-compatible gateways and control planes
ChainForge can also target OpenAI-compatible gateways and control planes instead
of calling the upstream provider directly. The local settings flow already
supports OPENAI_BASE_URL, so you can keep using the OpenAI provider in
ChainForge while pointing traffic at a different compatible endpoint.
For example, to route OpenAI-format traffic through Tuning Engines:
export OPENAI_BASE_URL=https://api.tuningengines.com/v1
export OPENAI_API_KEY=sk-te-your-inference-key
chainforge serve
Then select the normal OpenAI provider in ChainForge. This is useful when you want prompt and model comparisons to run through a governed endpoint that adds policy checks, usage tracking, model routing, or cost controls without changing the rest of your evaluation flow.
Example experiments
We've prepared many example flows to give you a sense of what's possible with Chainforge.
Click the "Example Flows" button on the top-right corner and select one. Here is a basic comparison example, plotting the length of responses across different models and arguments for the prompt parameter {game}:
You can also conduct ground truth evaluations using Tabular Data nodes. For instance, we can compare each LLM's ability to answer math problems by comparing each response to the expected answer:
Just import a dataset, hook it up to a template variable in a Prompt Node, and press run.
Compare responses across models and prompts
Compare across models and prompt variables with an interactive response inspector, including a formatted table and exportable data:
The key power of ChainForge lies in combinatorial power: ChainForge takes the cross product of inputs to prompt templates, meaning you can produce every combination of input values. This is incredibly effective at sending off hundreds of queries at once to verify model behavior more robustly than one-off prompting.
Here's a tutorial to get started comparing across prompt templates.
Share with others
The web version of ChainForge (https://chainforge.ai/play/) includes a Share button.
Simply click Share to generate a unique link for your flow and copy it to your clipboard:
For instance, here's a experiment I made that tries to get an LLM to reveal a secret key: https://chainforge.ai/play/?f=28puvwc788bog
Note To prevent abuse, you can only share up to 10 flows at a time, and each flow must be <5MB after compression. If you share more than 10 flows, the oldest link will break, so make sure to always Export important flows to
cforgefiles, and use Share to only pass data ephemerally.
For finer details about the features of specific nodes, check out the List of Nodes.
Features
A key goal of ChainForge is facilitating comparison and evaluation of prompts and models. Overall, you can:
- Compare across prompts and prompt parameters: Find the best set of prompts that maximizes your eval target metrics (e.g., lowest code error rate). Or, see how changing parameters in a prompt template affects the quality of responses.
- Compare across models: Compare responses for every prompt across models and different model settings, to find the best model for your use case.
The features that enable this area:
- Prompt permutations: Setup a prompt template and feed it variations of input variables. ChainForge will prompt all selected LLMs with all possible permutations of the input prompt, so that you can get a better sense of prompt quality. You can also chain prompt templates at arbitrary depth (e.g., to compare templates).
- Model settings: Change the settings of supported models, and compare across settings. For instance, you can measure the impact of a system message on ChatGPT by adding several ChatGPT models, changing individual settings, and nicknaming each one. ChainForge will send out queries to each version of the model.
- Evaluation nodes: Probe LLM responses in a chain and test them (classically) for some desired behavior. At a basic level, this is Python script based. We plan to add preset evaluator nodes for common use cases in the near future (e.g., name-entity recognition). Note that you can also chain LLM responses into prompt templates to help evaluate outputs cheaply before more extensive evaluation methods.
- Visualization nodes: Visualize evaluation results on plots like grouped box-and-whisker (for numeric metrics) and histograms (for boolean metrics). Currently we only support numeric and boolean metrics. We aim to provide users more control and options for plotting in the future.
- Chat turns: Go beyond prompts and template follow-up chat messages, just like prompts. You can test how the wording of the user's query might change an LLM's output, or compare quality of later responses across multiple chat models (or the same chat model with different settings!).
Alongside built-in gen AI features 🪄💫 like synthetic data generation, prompt engineering is accelerated: you can compare prompts and model performance sometimes without needing to write a single line of code, speeding up the process of iteration and discovery tenfold.
We've also found that some users simply want to use ChainForge to make tons of parametrized queries to LLMs (e.g., chaining prompt templates into prompt templates), possibly score them, and then output the results to a spreadsheet (Excel xlsx). To do this, attach an Inspect node to the output of a Prompt node and click Export Data.
For more specific details, see our documentation.
Development
ChainForge was created by Ian Arawjo, a postdoctoral scholar in Harvard HCI's Glassman Lab with support from the Harvard HCI community. Collaborators include PhD students Priyan Vaithilingam and Chelse Swoopes, Harvard undergraduate Sean Yang, and faculty members Elena Glassman and Martin Wattenberg. This 2023 edition of the project was partially funded by the NSF grants IIS-2107391, IIS-2040880, and IIS-1955699. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
Since release, ChainForge has had many more contributors. Additional collaborators include Shreya Shankar, Université de Montréal graduate students Cassandre Hamel and Jingyue Zhang, Roy Oyono, Loic Mandine, Gauransh Kumar, Derin Akay, Jerome Solis, Yacine Mkhinini, and Helen Chen. Additional creative contributions were made by Prof. Geoffrey Rockwell and his team at the University of Alberta.
The RAGForge features in ChainForge were led by Frédéric Dupont-Marillia at L'Autorité des marchés financiers (AMF) alongside Mila Masters student Mohamed Selim Rokbani.
We provide ongoing releases of this tool in the hopes that others find it useful for their projects. If you'd like to contribute, raise a PR!
Inspiration and Links
ChainForge is meant to be general-purpose, and is not developed for a specific API or LLM back-end. Our ultimate goal is integration into other tools for the systematic evaluation and auditing of LLMs. We hope to help others who are developing prompt-analysis flows in LLMs, or otherwise auditing LLM outputs. This project was inspired by own our use case, but also shares some comraderie with two related (closed-source) research projects, both led by Sherry Wu:
- "PromptChainer: Chaining Large Language Model Prompts through Visual Programming" (Wu et al., CHI ’22 LBW) Video
- "AI Chains: Transparent and Controllable Human-AI Interaction by Chaining Large Language Model Prompts" (Wu et al., CHI ’22)
Unlike these projects, we are focusing on supporting evaluation across prompts, prompt parameters, and models.
How to collaborate?
We welcome open-source collaborators. If you want to report a bug or request a feature, open an Issue. We also encourage users to implement the requested feature / bug fix and submit a Pull Request.
To work on ChainForge from a clone of this repository, install its Python dependencies (for example pip install -e ".[rag]"), then:
cd chainforge/react-server
npm install --legacy-peer-deps
npm run dev
npm run dev starts the Python server from your checkout and the React dev server together, at http://localhost:3000, with hot reloading. Ctrl+C stops both.
Cite Us
If you use ChainForge for research purposes, whether by building upon the source code or investigating LLM behavior using the tool, we ask that you cite our CHI research paper in any related publications. The BibTeX you can use is:
@inproceedings{arawjo2024chainforge,
title={ChainForge: A Visual Toolkit for Prompt Engineering and LLM Hypothesis Testing},
author={Arawjo, Ian and Swoopes, Chelse and Vaithilingam, Priyan and Wattenberg, Martin and Glassman, Elena L},
booktitle={Proceedings of the CHI Conference on Human Factors in Computing Systems},
pages={1--18},
year={2024}
}
License
ChainForge is released under the MIT License.