Skip to main content

Large Language Model Processing Unit

Project description

LLMPU

Large Language Model Processing Unit

Imagine a processing unit powered by LLM and infinite registers. Each register can store a string for prompts or codes. There is no fixed prompt. Instead, the contents of the first several registers are presented to the LLM. By generating code, the processing unit will be able to read and write any register, and directly execute the content of any register as Python code. Then the processing unit can be used as a general intelligent computing engine that potentially can improve itself by rewriting some of its own prompts or codes in registers.

The following instruction set is provided to the processing unit as Python functions:

  • read(r) returns content in register number r
  • write(r, content) store string content in register number r
  • run(r) execute the content in register number r as Python code

And their description is not hard coded, but stored in register 0, for example, as a "firmware".

Get Started

pip install llmpu
import llmpu
llmpu.init({ # default config here
    "api_key": "", # llm api key
    "VR": 16, # visibile register number
    "L": 10000, # hard character number limit for register
    "model": "gemini-3.5-flash-lite", # llm model
    "llm_config": {}, # llm config
    "EXEC": { # provided to execution environment, can be used by llm
        "read": llmpu.read, "write": llmpu.write, "run": llmpu._run
    }
})

Instruction set functions:

# use register 100 as an example
llmpu.write(100, "print('hello')") # truncate if exceed config["L"]
llmpu.read(100) # "print('hello')"
llmpu.run(100) # execute code in register 100
# llmpu.run also supports code string

Note: llmpu._run shares the caller's locals, while llmpu.run is isolated.

Control functions:

# main cycle: generate instructions
code = llmpu.cycle()
llmpu.run(code) # run the code

# core dump
llmpu.dump("dump.json") # dump state to a json file
llmpu.load("dump.json") # load state from a json file

Server and UI:

Network server uses srpc protocol. It only allows localhost traffic for security reason. Exposing the interface allows arbitrary code execution!

llmpu.serve(port=22222, browser=True)

Minimum Example

# using default config
firmware = """You are a self-improving processing unit with registers: r0-r15 visible, more available but hidden. Perform operations by generating Python code.

API:
- read(r: int) -> str: read register r.
- write(r: int, content: str): write content in r (truncated to 5000 chars).
- run(r: int): Run register r's content as Python code.
"""
llmpu.write(0, firmware)
llmpu.write(1, "load r10001 to r1")
llmpu.write(10000, "do nothing")
llmpu.write(10001, "print hello to the screen, then call r10010")
llmpu.write(10010, "print('hello again')\nwrite(1, read(10000))")

llmpu.run(llmpu.cycle()) # r10001 will be loaded to r1
llmpu.run(llmpu.cycle()) # print "hello", then call r10010, which will print "hello again" and write r10000 to r1
llmpu.run(llmpu.cycle()) # pass

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

llmpu-0.2.2.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

llmpu-0.2.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file llmpu-0.2.2.tar.gz.

File metadata

  • Download URL: llmpu-0.2.2.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llmpu-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e5b7f85385ccff2d49dbfcac3ca7147c89ebedc803988a465cda4f2fe5b632c6
MD5 771fa4a91378e54f8177ea01c47a3cc7
BLAKE2b-256 b83e4ae77538e3327ac4173e9c7dffc414fa3352250b398074b07d3388faf88b

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmpu-0.2.2.tar.gz:

Publisher: manual-publish-pypi.yml on yzITI/llmpu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llmpu-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: llmpu-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llmpu-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 121a8181289b59edfb1cef9f68f1f77575f6bf919170aa4198e9a3c441e58fa6
MD5 8f1f78986463a0ce94f4f625ece26eac
BLAKE2b-256 757a3ce0a8b5187b81d7de23056e8b1f123fb3f7e34ecf160fcef2b7152e60a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmpu-0.2.2-py3-none-any.whl:

Publisher: manual-publish-pypi.yml on yzITI/llmpu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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