Skip to main content
Process large volumes of jobs by submitting them asynchronously and collecting results when ready.

Overview

Batch processing allows you to submit hundreds or thousands of jobs in seconds, then collect results at your own pace. Jobs are processed asynchronously by the daemon’s worker threads.

Basic Pattern

1

Submit jobs

Loop through your inputs and submit each as a job:
for img in photos/*.jpg; do
  wrk ./workspace "Caption this image" --image "$img" >> jobs.txt
done
Each wrk call returns immediately with a job ID, which you save for later.
2

Monitor progress

Check how many jobs have completed:
ls ./workspace/output/ | wc -l
3

Collect results

Retrieve results for all jobs:
for job in $(cat jobs.txt); do
  echo "=== $job ==="
  flw ./workspace $job
done

Fan-Out / Fan-In (Map-Reduce)

Break a large task into parallel subtasks, then synthesize the results:
# Fan-out: submit subtasks
job1=$(wrk ./workspace "Research: PostgreSQL scalability")
job2=$(wrk ./workspace "Research: PostgreSQL ecosystem")
job3=$(wrk ./workspace "Research: PostgreSQL vs MongoDB")

# Wait for all
result1=$(flw ./workspace $job1)
result2=$(flw ./workspace $job2)
result3=$(flw ./workspace $job3)

# Fan-in: synthesize
wrk ./workspace "Synthesize these findings into a recommendation:
$result1
$result2
$result3"
The flw command blocks until results are ready, making it easy to coordinate parallel work.

Performance Tuning

Control parallelism with worker threads:
export NRVNA_WORKERS=8
nrvnad model.gguf ./workspace
More workers = more parallelism, but diminishing returns past the number of CPU cores.

Memory Accumulation

Build up knowledge across multiple jobs:
# Save results to memory
flw ./workspace $job1 >> memory.txt
flw ./workspace $job2 >> memory.txt
flw ./workspace $job3 >> memory.txt

# Use memory as context
wrk ./workspace "Given this context:
$(cat memory.txt)

Answer: What's the best approach for a startup?"
Jobs are just directories. Inspect them with standard tools like ls, cat, and tree.

Build docs developers (and LLMs) love