Running large promptfoo evals without running out of memory

Large promptfoo suites crash or stall when a run holds and writes more results than its host can handle. This page explains which output, field and batching controls reduce memory pressure, how to test each one, and what to confirm in your environment before relying on them.

On this page

Why large promptfoo evals run out of memory and what to change first

Memory pressure in a large promptfoo eval tends to rise with how much of each result the run keeps and writes, so the first fixes concern output format, stored fields, batching and the Node.js runtime. A suite that ran on a laptop often dies late in a bigger run or in a CI job because the work grows with every test case, prompt and provider combination, and each result carries the prompt, the response, the variables and the assertion details. When the run is large, those records can accumulate faster than the process releases them. The failure usually appears near the end, after most model calls have already been paid for, so the first question is where the memory goes.

promptfoo runs on the machine that calls the model. The documentation states that evals run on your machine and talk directly with the LLM, so the memory budget is the host or CI runner that executes the command. That matters for planning. A developer laptop, a shared build agent and a container with a fixed memory limit each have a different ceiling, and a container limit can end the process abruptly, with less detail than a JavaScript error. Confirm the memory limit on each runner with your platform team before you size a suite, and note which runner your largest suite will actually use.

Measure your own run before you change anything, because the exact behavior depends on suite size, output format and promptfoo version. Run the same suite twice with the same settings and record the peak memory of the Node.js process, the run time and the size of the output file. Then change one setting at a time, starting with the output format, then which fields are stored, then how many test cases run in each invocation. Splitting a suite across several runs means you will need a way to combine the outputs afterward. Check the Node.js version as well, since current promptfoo releases require Node.js 22.22.0 or newer, and treat an older runtime as a fault to fix before any tuning.

How a failing run moves to a stable one

The path starts at a failing run and records a baseline: suite size, output format, Node.js version and host memory. Next, the run switches to JSONL output with no table, and stored fields that reviewers do not need are stripped. The record count is then checked against the expected total. A matching count means the run is stable. A short count sends you back to strip fields again, and a run that still fails moves to batching. Batch outputs are then merged and totals are verified, and a mismatch sends you back to re-split the suite.

Failed checks loop back until the run finishes with every record.

Which memory control fits which symptom

This table compares the five main levers for reducing memory use in large promptfoo runs. Start from the symptom you see, then check each lever's trade-off before changing your CI job or run command. The heap limit is usually the last lever to change, after output and stored data have been reduced.

LeverWhen it fitsTrade-offWhat to confirm
JSONL outputOutput files or report generation fail on a large run, and you can process results line by line.You must aggregate the lines yourself, and no summary table is produced from the file.The flag that writes JSONL, whether rows are written during the run, and what passing cases contain.
--no-tableConsole table rendering adds memory or time on a large result set, and you read results from a file.The summary table is lost from the console, so you rely on the output file and exit status.That the flag still writes your output file, and whether it only skips the console table.
Strip stored fieldsStored responses or metadata make each result large, and the output file or database grows with them.Less evidence to debug failures, and passing cases lose the stored output you might review.Which fields can be omitted, whether assertions still grade correctly, and whether the web viewer needs them.
Split the suite across runsOne process holds too many results, and the suite divides cleanly by dataset, provider or category.More output files to merge, and cache and rate limit settings must hold across runs.How to filter tests per run, and the commands used to merge or view combined results.
Node.js heap limitThe process still hits the heap ceiling after output and stored data have been reduced.A higher ceiling delays failure if results keep growing, and the runner needs the memory.Node.js 22.22.0 or newer for promptfoo 0.124.1, the heap flag syntax, and runner memory.

Picking a fix by the failure you see

A run that dies after most cases have finished usually points to memory that grows with each stored result. Start with what the operating system reports, because a termination by the out-of-memory killer looks different from a promptfoo error message. Check the host's kernel log for the same time window before you change any setting.

  • Exit status: Record whether the process ended with an error from promptfoo or was terminated by a signal from the operating system.
  • Record count: Count the results written before the stop and compare that number with the cases in the suite. A stop point that moves when the suite grows suggests memory that accumulates per result.
  • Peak memory on the host: Sample the resident memory of the promptfoo process every few seconds and note the trend across the run.
  • First change to try: Write the output as JSONL so records go to the file line by line. Confirm with promptfoo eval --help which output options your version supports.
  • Cost in evidence: JSONL has no summary table, so pass and fail totals must be calculated from the records, and reviewers need a script or viewer to read them.

Confirm the exit status and the memory trend first, so you know whether the fix targets accumulation or one oversized case.

Reproducing and fixing a large run step by step

This sequence turns a suite that runs out of memory into smaller runs that you can check one at a time. Each step changes one thing and confirms its effect against a recorded baseline, so you can tell which change solved the failure. The output is a batched run plan with a manifest and a comparison against the original run.

  1. Record the baseline run

    Run the full suite once with its current config and record three numbers: the process exit code, the peak memory on the host during the run, and the count of result records written. Keep the exact command, the config file and the promptfoo version beside them, and note the Node.js version, since the 0.124.1 release requires Node.js 22.22.0 or newer. Confirm flag names and output fields against the promptfoo documentation for the version you run. Done when the baseline is written down, including where a failed run stopped.

  2. Reproduce the failure on a slice

    Pick a small slice of the suite, using a filter the version supports or a reduced copy of the config that keeps the same providers, prompts and settings, and run it. The goal is to see whether the failure reproduces at a smaller size, or whether memory rises in step with the number of cases. If the slice passes, split it into halves and repeat until you isolate the group of cases that triggers the failure. Done when the exit code and result count match the number of test cases in the slice, and you know whether the failing group is isolated.

  3. Switch output to JSONL

    Change the output to JSONL, turn off the console table with --no-table, and write results to a file. Confirm in the promptfoo documentation for your version that these options can be combined and that the output path and extension behave as you expect. Run the slice again. Done when the file holds one line per result, the line count matches the expected result count for your config (test cases multiplied by prompts and providers), and peak memory is recorded for comparison with the baseline.

  4. Remove stored fields reviewers skip

    Review a sample of records with the people who read the results, and list the fields they never use, such as full raw provider responses or long intermediate traces. Remove those fields from what is stored, using the option your version supports, and confirm the field names in the output documentation before you edit configs. Stored records often contain sensitive content, so fewer fields also means less data to protect. Done when a sample still shows every field reviewers rely on, and file size and peak memory have been measured again against the baseline.

  5. Split the suite into batches

    Divide the test cases into batches sized to the host, and write a manifest that lists each batch's config file, its test case selection and its output file name. Run each batch as a separate process, one after another, and capture the exit code for every batch. Done when the case counts in the manifest add up to the total in your baseline, and no test case appears in two batches or in none. Keep the manifest in version control so the split can be repeated later.

  6. Rerun and compare with the baseline

    Run every batch from the manifest, record the exit code and peak memory for each one, and merge the JSONL outputs into one file for review. Compare the total result record count with the expected number of test cases, then compare pass and fail counts with the baseline for the same cases. Any difference needs an explanation before you accept the new numbers, and a batch with a nonzero exit code must be investigated and rerun. Done when the counts match and each batch's peak memory stays within the host's available memory.

How to split a large suite across runs without losing coverage

Split the suite by a key that stays the same between runs, such as the source dataset file, a test category, or the red team plugin that generated each case. Then write a manifest that records every case identifier, the batch it belongs to and the source file it came from. The manifest is the control that keeps coverage intact. Before any batch runs, check that the batch counts add up to the full suite count and that no identifier appears twice. Batches assembled by hand from file names or by shuffling rows tend to drift when someone adds cases later, so regenerate the manifest from the source files each time and commit it next to your configs. A dropped case leaves no failure behind, only a missing identifier, so the count check matters more than the pass rate.

Run each batch with the same promptfoo version, the same config file and the same provider settings, and write each batch's output to its own file. Then merge the outputs for reporting by combining result rows on case identifier. Batches that run under different conditions produce results that are hard to compare. A config edit made between the first and last batch, a response cache that was warm for one batch and cold for another, or a provider rate limit that hit only the final batch can each shift pass rates or error counts without any change to the model under test. Record the promptfoo version, a hash of the config and the cache setting in each batch's output. Keep rate-limit responses in an error count that is reported separately from failed assertions, so a quota problem is not mistaken for a regression.

Before you rely on the split, confirm whether total provider calls and run time change. Splitting can add overhead, since each batch loads configuration and reconnects to the provider, and a cold cache can raise the number of calls. Ask the team to measure both on the full suite and on the split run, then decide whether the difference is acceptable for the schedule. To verify the merge, check that the merged case count equals the manifest total, that each identifier appears exactly once, and that the pass, fail and error totals for each assertion equal the sum of the batch totals. Where a full run is affordable, compare its outcomes with the merged set and investigate every case that changed. Put this check in the pipeline so it runs on every merge, not only when someone remembers to run it.

Handling sensitive data in large result files

Large result files are copies of your test data, so they carry the sensitivity of whatever went into the eval. The cards below cover where those files sit, how long they live, and what leaves the machine when they are shared. Check each one before you raise memory limits or split suites, because a smaller file still needs the same controls.

Prompts, outputs and variables

Each result row can hold the full prompt, the model's answer and every test variable, and variables often come from customer records, case notes or documents. Test variables may carry personal or regulated data even when the suite was meant to be synthetic. Before a run, list which datasets feed the variables and who classifies them. Confirm whether the output format you pick writes the variables back out in full.

CI artifacts outlive the job

Pipelines usually upload result files as job artifacts, so a JSON or JSONL file written during an eval can be downloaded by anyone who can open that pipeline run. The file also sits on the runner until the job ends, and a runner may be shared or reused. Check the artifact retention setting in your CI system and set it to the shortest period your reviewers need. Confirm who can view job logs and artifacts for each project.

promptfoo introduction

Exposure moves with the files

promptfoo runs on the machine that calls the model, so requests go from that machine directly to the provider. The exposure does not stop there: result files travel to wherever they are copied, including laptops, shared drives, chat threads and backup systems. Each copy inherits the sensitivity of the data inside it. Keep a list of where outputs are stored and who receives them, and treat that list as part of the eval's data inventory.

Sharing uploads data

Sharing a result to promptfoo cloud or to a self-hosted server uploads that run's prompts, outputs and variables to the destination. Confirm what each share sends before a team uses it on a suite with regulated data. The self-hosted server keeps data in a local SQLite database and is not recommended for production use, so check its storage and access arrangements before you point a team at it.

Self-hosting docs

Keep secrets out of outputs

API keys and tokens can reach result files through configuration values, environment variables or provider settings that echo into the output. A key written into a result file is a credential exposure that someone can reuse outside the eval. Keep keys in your secrets store and reference them by environment variable. Scan output files for key patterns before they leave the runner, and rotate any key that appears in an artifact.

Restrict access to output directories

Result directories should follow the same access rules as the data they hold: owner-only permissions on developer machines, and named groups on shared build hosts. Set the output path explicitly and choose the directory before the run, keeping it out of shared folders that many people sync. Confirm who can read, copy and delete outputs, and remove old result folders on a schedule your team has written down.

What fixing large promptfoo evals costs and who does the work

What drives the cost of fixing large promptfoo evals?

The main drivers are suite size, the number of output formats the run writes, how many stored fields each result keeps, the number of batches that must be merged into one report, the memory limits of your CI runners, and the size of the host that runs the eval. These interact. A large suite that writes several formats with full stored fields can exhaust memory on a host that handles a smaller run without trouble. One-time work covers profiling the failing run, changing output settings, removing fields you do not need, and splitting the suite with a merge step in CI. Recurring effort comes from keeping that split and merge logic current as the suite grows and as your runner pool changes. Ask for a quote that lists each driver separately and ties the work to the runners and hosts you actually use, so you can see which drivers apply to your environment.

Can an in-house engineer make these changes without outside help?

Often, yes. An engineer who already runs promptfoo in CI can usually make most of these changes. The work is mostly configuration: choosing output formats, stripping stored fields, splitting the suite and adding a merge step for partial results. The harder parts are finding which resource runs out first, which requires access to CI runner logs and host metrics, and making the split stable so that results from separate runs can be compared. Teams new to promptfoo's output structure usually need time to learn it and to test each change against a baseline. Outside help makes more sense when the team lacks spare time, when the failing suite is blocking a release, or when the fix must be documented for auditors. The deciding question is who owns the CI pipeline and who will maintain the split after the fix.

What does the work need from our team before it starts?

Expect to provide four things. First, access to the CI system where the eval runs, with permission to change pipeline configuration and read runner logs. Second, the datasets and eval configurations, or copies of them, so the failing suite can be reproduced. Third, provider keys that stay in your own environment, stored in your secrets manager or CI variables. Fourth, a baseline run: a complete run on the current setup with its outputs and resource use recorded, so every change can be checked against a known result. You should also name a contact who can approve pipeline changes and confirm which runners and hosts are in scope. Confirm in the written scope how data is handled during testing and where any working copies are kept.

How long does it take to fix a large promptfoo eval setup?

The duration depends on suite size, the number of pipelines involved and how quickly your environment can be accessed and tested. No standard duration applies, so the written scope is the source for any timeline. A useful scope lists the phases, such as profiling, output and field changes, suite splitting, CI integration, baseline comparison and handover, along with what each phase depends on from your team, such as access approvals and runner availability. Delays in inputs often move the end date more than the engineering work does. A slow access approval or a baseline run that waits for free runners can add more time than the fix itself. Ask for the timeline to be tied to named milestones and to the inputs you must provide, so each delay has a clear owner.

Does fixing promptfoo memory errors include changes to its source code?

Confirm this in the written scope before work starts. The fixes for large runs are mostly configuration and pipeline changes built on promptfoo's existing options: JSONL output, the --no-table option, stripping stored fields and splitting the suite across runs with a merge step. If a memory problem traces to a defect in promptfoo itself, the scope should state whether a source change, a patch you maintain or an upstream report is included. Ask for that line item to be named explicitly, with the promptfoo version it targets, and check that version against the current release notes. Also confirm whether any scripts needed for merging results are delivered as code, documented and handed over to your team at the end of the work.

How is the quote formed for a promptfoo scaling engagement?

A quote follows from a fixed written scope. DeployOpen does not publish a price list, so there is no rate card to apply. Most engagements are fixed-scope, meaning the scope, deliverables and timeline are agreed in writing before work starts. To get a comparable quote, prepare the inputs that set the size of the work: suite size, number of pipelines and runners, output formats in use, the number of batches to merge, host specifications, and whether retesting or handover documentation is needed. Ask for the quote to list the deliverables, the environments covered, what your team provides and what is excluded. Ongoing support, upgrades and continuous testing are available as retainers and are scoped and quoted separately from the one-time fix.

What to confirm before you rely on these fixes

These five checks decide whether the fixes in this guide hold for your suite. Each one covers a different risk: the tool version, the actual limit, the server storage, your hardware and the sizing you choose. Work through them in order before you move a large suite into scheduled or shared runs.

Confirm flag behavior per version

The flags for JSONL output, --no-table and stripping stored fields must behave as you expect in the version you actually install. Pin the version and test the flags on a small sample first. Check the output file fields, the exit code and whether a failed row still appears in the file. The current npm release, 0.124.1, requires Node.js 22.22.0 or newer, so confirm the Node version on every runner, container image and laptop that will execute the suite.

Promptfoo releases

Find the actual bottleneck

Memory may not be what limits your run. Provider rate limits, your own concurrency settings and the capacity of the application under test can slow or fail a suite in ways that look like memory pressure. Watch provider quota dashboards and target application logs during the run, and compare the timing of errors with memory growth. If requests time out while memory stays flat, fix throughput before you change batch sizes.

Plan around the SQLite limit

The self-hosted server keeps its data in a local SQLite database that cannot be shared across replicas, and the documentation does not recommend it for production use. A large run that depends on the server to store results therefore needs its own plan: a single instance with a persistent volume and tested backups, or writing results to files and uploading them after the run. Confirm the storage behavior for your version before you commit to either path.

Self-hosting docs

Measure memory on your hosts

Peak memory depends on the host, the size of the dataset, the plugins that generate or grade cases and the providers in use, so no single figure carries over between machines. Measure peak memory with your full suite on the hardware that runs it. Start with a sample, increase the case count in steps and record peak memory, run duration and failure count at each step. Repeat the measurement after any change to plugins, providers or the Node.js version.

Size batches from your data

Set batch sizes, split points and memory limits from your own measurements. Do not copy numbers from another team or a blog post. Keep headroom for garbage collection spikes and for the largest dataset you expect to run. Document the measured peak, the chosen batch size and the measurement date, so the next person can see why the limit exists and when to revisit it. Ask any vendor or partner for guidance in writing before you treat it as a supported baseline.

How DeployOpen scopes and supports promptfoo run tuning

DeployOpen scopes large promptfoo eval memory problems as written work in your environment. We review the suite, output settings and run layout, then agree the changes in writing before anything is altered. promptfoo runs locally and talks directly with your models, so the tuning happens where your evals already run.

How we scope

  • Written scope that names the suites, output formats and runners in your environment.
  • Baseline memory and run time on a representative suite, agreed with your team before changes.
  • Fixed-scope engagements are agreed in writing before any work on your suites starts.

How we build

  • Switch large runs to JSONL output and skip table rendering with --no-table where reports are not needed.
  • Strip stored fields that your reports do not read, and confirm results still match the baseline.
  • Split large suites across runs and merge outputs, checking that no test case is lost or duplicated.

How we hand over

  • A runbook with the chosen flags, the reason for each, and the memory baseline it was measured against.
  • Configuration committed to your repository, so CI and local runs use the same settings.
  • A walkthrough with your engineers, covering how to rerun the baseline when suites grow.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer.
  • Retainers can cover re-baselining after promptfoo upgrades and when suite sizes change.
  • Changes are confirmed against your own environment, and we tell you what to recheck after each release.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.