Settings

Theme

Runtime augmentation of Hugging Face without modifying source – CMPSBL Demo

github.com

2 points by promptfluid 2 months ago · 1 comment

Reader

promptfluidOP 2 months ago

I experimented with adding a deterministic runtime layer to an existing codebase without modifying its source.

As a test case, I used Transformers from Hugging Face Transformers and took modeling_utils.py (v5.5.0) directly from the repo.

Instead of changing the file, I wrapped it in a secondary runtime layer and dropped it back into the stack under the original filename. The original code remains intact and executes normally.

With that layer active, I was able to add:

• input validation / interception (e.g., basic SQL/XSS detection)

• persistent state across calls

• a simple adaptive loop (escalates after repeated bad inputs)

The underlying model loading and inference behavior remains unchanged.

Repo (full copy of the stack with the runtime layer applied):

https://github.com/SweetKenneth/transformers-ascended-verifi...

Short terminal demo:

https://youtu.be/n1hGDWLoEPw

I’m not claiming this is novel in isolation (it uses familiar techniques like wrapping and runtime injection), but I’m interested in whether a constrained, deterministic “second layer” like this could be a practical way to add governance/observability to existing systems without modifying their source.

Curious how others would approach or critique this.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection