NVIDIA-NeMo / NVIDIA-NeMo/Guardrails

[Performance] Rule Engine Evaluation Slow - No Caching of Results

Open
#1,980 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
843
Avg merge
3d 1h
Merged PRs (30d)
25

Description

Description

Safety rule evaluation takes 5+ seconds per request. No caching of identical rule evaluations.

Expected Behavior

Cache rule results. Use hash of input as cache key.

Actual Behavior

File: src/rules/engine.py
Re-evaluates rules each time: evaluate_rules(input)

GSSoC Points Estimate: Level 2 (Performance)

Suggested Labels

  • gssoc:approved
  • type:bug
  • severity:high
  • area:performance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/rules/engine.py at evaluate_rules(input) and trace how rule evaluations are performed for repeated inputs. Add result caching using a hash of the input as the cache key. Done means identical rule evaluations reuse cached results while preserving the expected evaluation behavior and reducing repeated request latency.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.