Release SpTn-Model-only-1P v1.0
Browse filesFiles changed (5)
- README.md+85-38
- chat.py+115-40
- load_model.pyAdded+10
- save_model.pyAdded+27
- sp_tn_1p.npzAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263641 unmodified line6667686970717273747576777879---tags:- experimental- generative-model- one-parameter- research- toy-modellibrary_name: numpy---# SpTn-Model-only-1PSpTn-Model-only-1P is an experimental generative model designed to explore what can be achieved with exactly one trainable parameter.## Model DescriptionSpTn-Model-only-1P is a minimal research experiment rather than a general-purpose language model.The project investigates machine-learning behavior under an extreme parameter constraint: exactly one trainable parameter.The current implementation uses NumPy and contains experimental scripts for one-parameter learning, generation, character sampling, benchmarking, and an interactive chat demonstration.## Key Properties- Trainable parameters: 1- Framework: NumPy- Model type: Experimental one-parameter generative model- Status: Research / experimental- Language model capability: No## Intended UseThis project is intended for:- Educational experiments- Research into extremely low-parameter models- Exploring parameter capacity- Understanding simple optimization and generation- Experimenting with minimal machine-learning architectures## LimitationsThis is not a production language model.The interactive chat implementation is an experimental demonstration based on a single scalar parameter and random character sampling. It does not have the language understanding or generation capabilities of modern LLMs.Generated text may be meaningless or incoherent.Benchmark results in this repository measure experimental NumPy operations and should not be interpreted as LLM inference benchmarks.## Interactive ChatRun:python chat.pyType your message after `You:`.Type `exit` to quit.## RepositoryGitHub:https://github.com/parhamtaheri453-crypto/SpTn-Model-only-1P1 unmodified lineHugging Face:https://huggingface.co/KtiyaKK/SpTn-Model-only-1P## RoadmapFuture experiments may scale the parameter count:1P → 100P → 1K → 10K → 100K → 1M → 10MThe goal is to study how model capability changes as the number of trainable parameters increases.## DisclaimerSpTn-Model-only-1P is an experimental research project. Results should be interpreted within the limitations described above.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151 unmodified line117118119120121122123124125126---tags:- experimental- generative-model- one-parameter- research- toy-modellibrary_name: numpy---SpTn-Model-only-1PA minimal experimental generative model with exactly 1 trainable parameter.SpTn-Model-only-1P explores how much generative behavior can be produced under an extreme parameter constraint.Model- Trainable parameters: 1- Parameter type: float32- Framework: NumPy- Model file: "sp_tn_1p.npz"- Status: Experimental- Language understanding: NoDownloadHugging FaceDownload "sp_tn_1p.npz" directly from the Files and versions section.GitHubDownload the repository or the latest release from GitHub.No Git installation is required to download the files.InstallationInstall NumPy:pip install numpyQuick StartDownload these files:sp_tn_1p.npzchat.pyPlace them in the same directory.Run:python chat.pyExample:You: helloModel: rudezok sugerafiyo peyu dewipusaq sohiraThe generated text is intentionally meaningless and demonstrates synthetic text generation under a one-parameter constraint.Load the ModelTo verify and load the model:python load_model.pyExpected output:SpTn-Model-only-1PTrainable parameters: 1Parameter: 0.5Model loaded successfully.ArchitectureThe model contains exactly one trainable scalar parameter:wThe parameter is stored in:sp_tn_1p.npzThe remaining generation rules are fixed and are not trainable parameters.Important LimitationsSpTn-Model-only-1P is an experimental research project.It is not a general-purpose language model.The model does not understand natural language and does not generate meaningful answers.The generated output is word-like synthetic text created under an extreme one-parameter constraint.The project is intended to explore parameter efficiency and extremely low-parameter generative systems.RoadmapThe project will investigate progressively larger parameter counts:1P → 100P → 1K → 10K → 100K → 1M → 10MThe goal is to study how generative behavior changes as the number of trainable parameters increases.RepositoryGitHub:https://github.com/parhamtaheri453-crypto/SpTn-Model-only-1P1 unmodified lineHugging Face:https://huggingface.co/KtiyaKK/SpTn-Model-only-1PDisclaimerSpTn-Model-only-1P is an experimental project.It should not be compared directly with modern large language models.The project is intended for experimentation, education, and research into extremely low-parameter generative models.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import numpy as npnp.random.seed(42)# SpTn-Model-only-1P# Exactly ONE trainable parameterw = np.float32(0.5)chars = np.array(list("abcdefghijklmnopqrstuvwxyz "))print("================================")print("SpTn-Model-only-1P")print("Trainable parameters: 1")print("Type 'exit' to quit")print("================================")while True:text = input("\nYou: ")if text.lower() == "exit":print("Bye.")breakif not text:continuecodes = np.array([(ord(c) - 32) / 95.0for c in textif 32 <= ord(c) <= 126])if len(codes) == 0:print("Model: Please enter ASCII text.")continuetarget = np.mean(codes)# Train the single parameterfor _ in range(1000):error = w - targetgradient = 2 * errorw -= np.float32(0.05 * gradient)w = np.clip(w, 0.0, 1.0)output = ""for _ in range(100):value = np.random.random()index = int(np.clip(w * len(chars) + value * 3,0,len(chars) - 1))output += chars[index]print("Model:", output)print("Parameter:", float(w))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139import numpy as npMODEL_FILE = "sp_tn_1p.npz"model = np.load(MODEL_FILE)w = float(model["w"])# Fixed generation tables.# These are NOT trainable parameters.vowels = "aeiou"consonants = "bcdfghjklmnpqrstvwxyz"clusters = ["br", "cr", "dr", "fr", "gr", "kr", "pr", "tr","bl", "cl", "fl", "gl", "pl","sk", "sl", "sm", "sn", "sp", "st", "sw","vr", "zh"]endings = ["n", "r", "s", "t", "l", "m", "k","x", "d", "v"]punctuation = ["", "", "", ".", "!", "?", ","]print("================================")print("SpTn-Model-only-1P")print("Trainable parameters: 1")print("Model file:", MODEL_FILE)print("Parameter:", w)print("Type 'exit' to quit")print("================================")def choose_without_repeat(pool, used):available = [c for c in pool if c not in used]if not available:return Nonereturn available[int(np.random.random() * len(available))]def make_word():# Different word lengths.length = int(4 + np.random.random() * 7)used = set()word = ""# Sometimes start with a consonant cluster.if np.random.random() < 0.35:cluster = clusters[int(np.random.random() * len(clusters))]for c in cluster:if c not in used:word += cused.add(c)while len(word) < length:# Alternate consonant/vowel patterns.if len(word) % 2 == 0:c = choose_without_repeat(consonants, used)else:c = choose_without_repeat(vowels, used)if c is None:breakword += cused.add(c)# Optional final consonant.if len(word) < length and np.random.random() < 0.5:c = choose_without_repeat(endings, used)if c is not None:word += cused.add(c)return worddef generate_sentence(text):# The single trainable parameter affects generation.# Everything else is fixed generation logic.seed_shift = int(abs(w) * 1000)# Input affects the deterministic seed without becoming a parameter.text_value = sum(ord(c) for c in text)np.random.seed(seed_shift + text_value)# 7–13 unique words.word_count = int(7 + np.random.random() * 7)words = []seen = set()attempts = 0while len(words) < word_count and attempts < 100:word = make_word()attempts += 1if word and word not in seen:words.append(word)seen.add(word)# Random punctuation and capitalization.result = []for i, word in enumerate(words):if np.random.random() < 0.18:word = word.capitalize()result.append(word)sentence = " ".join(result)punctuation_mark = punctuation[int(np.random.random() * len(punctuation))]return sentence + punctuation_markwhile True:text = input("\nYou: ")if text.lower() == "exit":print("Bye.")breakif not text.strip():continueprint("Model:", generate_sentence(text))
12345678910import numpy as np
model = np.load("sp_tn_1p.npz")
w = model["w"]
print("SpTn-Model-only-1P")print("Trainable parameters: 1")print("Parameter:", float(w))print("Model loaded successfully.")123456789101112131415161718192021222324252627import numpy as np
# SpTn-Model-only-1P# Exactly ONE trainable parameter
# The single parameter represents the center of a character distribution.w = np.array(0.5, dtype=np.float32)
# Training data: normalized character positions.data = np.array([0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90], dtype=np.float32)
lr = 0.01
for _ in range(1000): error = w - np.mean(data) gradient = 2 * error w -= lr * gradient
np.savez( "sp_tn_1p.npz", w=w,)
print("Model saved.")print("Trainable parameters:", 1)print("Parameter:", float(w))README.md+85-38
chat.py+115-40
load_model.pyAdded+10
save_model.pyAdded+27
sp_tn_1p.npzAdded