Skip to main content

Energy Language — program neural networks by shaping energy landscapes

Project description

Qriton HLM — Energy Language

Program neural networks by shaping energy landscapes.

The first tool that lets you directly program a neural network's behavior — not train, not fine-tune, not prompt-engineer. Program.

"Energy minima as a programming language — in a completely new fashion."John J. Hopfield, March 2026

$ qriton-hlm -c model.pt

hlm:model> capture 5 polite Thank you so much for your help
  Captured L5: "Thank you so much for your help"
  Energy: -12.34 | Basin: True (cos=0.97, 23 iters)
  -> Added to concept 'polite' (1 samples)

hlm:model> capture 5 polite I really appreciate your patience
  -> Added to concept 'polite' (2 samples)

hlm:model> inject-concept 5 polite 0.1
  Before: 200 basins, concept is basin: False
  After:  201 basins (+1), concept is basin: True
  >> Concept successfully injected!

hlm:model> apply 5
hlm:model> generate Tell me about the weather
  I'd be happy to share! The weather today is...

Install

pip install qriton-hlm

What is this?

Every AI framework today has one way to change model behavior: training. Qriton HLM adds a second: surgery.

This only works because HLM uses polynomial Hopfield dynamics that create multiple stable basins per layer. Transformers can't do this — their softmax attention collapses to a single attractor.

Transformer vs HLM comparison

Basin surgery operations

32 Operations — Complete Energy Language

Observe (read the landscape)

Command What it does
survey <layer> Map all basins in a layer
survey-all Survey every layer
verify <layer> <seed> Check if a point is a basin
energy <layer> <seed> Measure energy at a point
probe <layer> [basin_idx] What tokens does a basin activate? (reverse capture)
landscape <layer> Full energy map with population bars

Modify (change the landscape)

Command What it does
inject <layer> <seed> [str] Create a new attractor
remove <layer> <seed> [str] Destroy an attractor
move <layer> <seed> [str] Relocate an attractor
strengthen <layer> <seed> [f] Deepen an existing basin
weaken <layer> <seed> [f] Make a basin shallower

Concept (semantic operations)

Command What it does
capture <layer> <concept> <text> Extract what a concept looks like in the model
inject-concept <layer> <concept> [s] Program a captured concept as a new attractor
remove-concept <layer> <concept> [s] Remove a concept from the model
blend <a> <b> <new> [ratio] Mix two concepts (e.g. 70% polite + 30% formal)
concepts List all captured concepts
export-concept <name> <path> Save concept as portable file
import-concept <path> Load concept from file

Control (flow & persistence)

Command What it does
load <path> Load a checkpoint
apply <layer> Write modified W to live model
restore <layer> Undo modifications
restore-all Restore all layers
save <path> Save modified W matrices
status Show which layers are modified
set <param> <value> Set parameter (beta, strength, ...)
info Show model info

Verify (test & audit)

Command What it does
generate <prompt> Generate text with current model
diff <layer> Show W matrix change stats
benchmark Measure perplexity impact of surgery
guard <layer> [max_%] Prevent removing too many basins
history Show operation log

Scripts

Write .hlm scripts to chain operations:

# make_polite.hlm
load model.pt
capture 5 polite Thank you so much
capture 5 polite I really appreciate it
capture 5 polite That's very kind of you
inject-concept 5 polite 0.1
apply 5
benchmark
generate Tell me about the weather
restore 5

Run with: qriton-hlm --script make_polite.hlm

Python API

from qriton_hlm import BasinSurgeon

surgeon = BasinSurgeon.from_checkpoint("model.pt", device="cuda")

# Capture what a concept looks like in the model
surgeon.capture(layer=5, text="Thank you so much", concept_name="polite")
surgeon.capture(layer=5, text="I really appreciate it", concept_name="polite")

# Inject that concept as a new attractor
result = surgeon.inject_concept(layer=5, concept_name="polite", strength=0.1)
print(f"Concept injected: {result['exists_after']}")

# Blend two concepts
surgeon.blend("polite", "formal", "professional", ratio=0.6)

# Export concept for sharing
surgeon.export_concept("polite", "polite.concept")

# Transplant concept from another model
other = BasinSurgeon.from_checkpoint("other_model.pt")
surgeon.transplant(other, layer=5, concept_name="humor")

# Apply to live model and benchmark
surgeon.apply(layer=5)
result = surgeon.benchmark()
print(f"PPL after surgery: {result['perplexity']:.2f}")

# Probe: what does basin #3 represent?
probe = surgeon.probe(layer=5, basin_idx=3)
print(f"Top tokens: {probe['top_tokens']}")

# Compare basins between models
diff = surgeon.compare(other, layer=5)
print(f"Shared: {diff['shared']}, unique: {diff['only_self']}")

Compatibility

Works with any PyTorch checkpoint that contains hopfield.W parameters:

  • HLM2/HLM3 language models
  • HLM-Spatial (LIDAR, Medical3D, Industrial3D)
  • HLM-Audio (STT, TTS)
  • Any model using PolyHopfieldLayer

Requirements

  • Python >= 3.9
  • PyTorch >= 2.0
  • NumPy

License

Apache 2.0 — Qriton Technologies S.R.L.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qriton_hlm-0.7.2.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qriton_hlm-0.7.2-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file qriton_hlm-0.7.2.tar.gz.

File metadata

  • Download URL: qriton_hlm-0.7.2.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for qriton_hlm-0.7.2.tar.gz
Algorithm Hash digest
SHA256 f38cfc0ae49eece86f33912deda374402bdf7c18d23e4af88f2345719b4b3ac4
MD5 92f6192808f13f2744dc1d9d6ceb4151
BLAKE2b-256 af9c743d741623f1b987af02f8a82435115c98f90fcef4685db834a0b5b746d9

See more details on using hashes here.

File details

Details for the file qriton_hlm-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: qriton_hlm-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for qriton_hlm-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8aeabce0df7f789f0c5d99c8b63130f7d80df49167ae21b3a591d3b8c499cf76
MD5 b1a0a44ba608d784214373005a57cee7
BLAKE2b-256 f35927f9c2c237ee645a9eec8eed744fd6aead2c4aa2b7bb002c2a498652ab3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page