Markov chain generator with rudimentary prompt response
Project description
Conversational Markov
LLMs don't normally sound like they're talking to you. The LLM in its most basic state simply continues the text it's given. LLMs sound like they're talking to you when they're set up to complete one side of a conversation.
Technically, there's nothing stopping you from making a Markov chain that does this, too. Train it on runs that have a prompt and a response, delineated by a sentinel token, and then, during inference, you can make the starting state any given prompt followed by the sentinel, and it will autocomplete something that sounds like a fitting response.
This project explores that.
Now, practically, there are reasons Markov chains are not typically used this
way: state size would increase linearly with every extra word you want to be
able to prompt with, and model size will correspondingly increase exponentially.
With just a handful of prompt words and a decent sized corpus, you'll be running
out of memory trying to load the whole thing.
But still, I wanted to try it, because LLM inference takes a lot of compute,
meanwhile Markov chain generators don't. What I can get away with on a €5 Hetzner
box?
This project is a naïve example of a framework around a Markov chain which sets it up to respond to prompts. It uses a state size of 3, enough to allow it to process just the first and last word of a prompt plus the sentinel token. When you prompt it with something it's seen before, it really does make more coherent-seeming responses than a conventional Markov chain does from a random state.
Avenues for improvement:
- Decouple token length of prompt from state size of response generation. I.e., allow a longer starting state to increase number of tokens that can be included in the prompt without also having to increase the state size used to generate the response. State size of 3 is already pretty large for making remotely original sounding responses, but at the same time, it's really small for ingesting a prompt. A Dynamic State Size Markov Chain?
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file conversational_markov-0.1.4.tar.gz.
File metadata
- Download URL: conversational_markov-0.1.4.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2a81312a25aca1a75d459bf1c7524c201d6d8f599311fba68e6bc3c11081e64
|
|
| MD5 |
c164b86fccd210c722176487cd807a11
|
|
| BLAKE2b-256 |
5592918b734e053e708a649139a5deacdf06bb3f1096b25263323ff386ef7d8a
|
Provenance
The following attestation bundles were made for conversational_markov-0.1.4.tar.gz:
Publisher:
python-publish.yml on nate-kean/conversational-markov
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conversational_markov-0.1.4.tar.gz -
Subject digest:
b2a81312a25aca1a75d459bf1c7524c201d6d8f599311fba68e6bc3c11081e64 - Sigstore transparency entry: 779615687
- Sigstore integration time:
-
Permalink:
nate-kean/conversational-markov@5e9fc4f5b710b01b5ec3255e647bc0dfb00cc88d -
Branch / Tag:
refs/tags/0.1.4a - Owner: https://github.com/nate-kean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5e9fc4f5b710b01b5ec3255e647bc0dfb00cc88d -
Trigger Event:
release
-
Statement type:
File details
Details for the file conversational_markov-0.1.4-py3-none-any.whl.
File metadata
- Download URL: conversational_markov-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d29a5ed30b38527cdc5a3de4af91642e0c9c3cc2f2709f77f0872ac5f726048
|
|
| MD5 |
76f645b64b4b611befbfdc21ab63dbe6
|
|
| BLAKE2b-256 |
db92311db260d1b600528a3bdff6d26464f60c4684c54e8f63ff0320ba1574c3
|
Provenance
The following attestation bundles were made for conversational_markov-0.1.4-py3-none-any.whl:
Publisher:
python-publish.yml on nate-kean/conversational-markov
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conversational_markov-0.1.4-py3-none-any.whl -
Subject digest:
0d29a5ed30b38527cdc5a3de4af91642e0c9c3cc2f2709f77f0872ac5f726048 - Sigstore transparency entry: 779615688
- Sigstore integration time:
-
Permalink:
nate-kean/conversational-markov@5e9fc4f5b710b01b5ec3255e647bc0dfb00cc88d -
Branch / Tag:
refs/tags/0.1.4a - Owner: https://github.com/nate-kean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5e9fc4f5b710b01b5ec3255e647bc0dfb00cc88d -
Trigger Event:
release
-
Statement type: