PLDR-LLM-v51-110M-1 is a large language model from power law decoder representations with KV-cache and G-cache support, which is a new foundational language model architecture that utilizes power law graph attention to generate deductive and inductive outputs. This model has a parameter size of 110M. It refers to PLDRv51-110M-1 whose architecture and training details are provided in Table 1 of the research paper titled
PLDR-LLMs Learn A Generalizable Tensor Operator That Can Replace Its Own Deep Neural Net At Inference.
PLDR-LLM-v51-110M-1 was pretrained on the
RefinedWeb, a publicly available English web dataset with extensive filtering and deduplication.
This model was trained for ~8B tokens on RefinedWeb over 250k steps per rank. It was trained autoregressively with cross-entropy loss.
This model is intended to be used for research purposes. Given text as input prompt, it carries out next token prediction to generate continuation text. The context length for this model is 1024 tokens.
PLDR-LLM has custom model support for Huggingface Transformers library. PLDR-LLM with custom code is evaluated on Transformers 4.56.1 available at the time.
1from transformers import pipeline
2
3text_generator = pipeline(
4 task="text-generation",
5 model="fromthesky/PLDR-LLM-v51-110M-1",
6 device="cuda", # or "cpu"
7 trust_remote_code=True
8 )
9
10prompt="The quick brown fox jumps over the lazy dog."
11
12output=text_generator(prompt, top_p=0.6, top_k=0, temperature=1, do_sample=True,
13 tokenizer_encode_kwargs={"add_special_tokens":False},
14 use_cache=True, max_new_tokens=100)
15print(output[0]["generated_text"])
1from transformers import AutoModelForCausalLM, AutoTokenizer
2device="cuda" # or "cpu"
3model=AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path="fromthesky/PLDR-LLM-v51-110M-1",
4 device_map=device,
5 trust_remote_code=True
6 )
7tokenizer=AutoTokenizer.from_pretrained(pretrained_model_name_or_path="fromthesky/PLDR-LLM-v51-110M-1",
8 add_eos_token=False,
9 legacy=False,
10 trust_remote_code=True
11 )
12
13prompt="The quick brown fox jumps over the lazy dog."
14
15inputs = tokenizer([prompt], return_tensors="pt").to(device=device)
16generated_ids = model.generate(**inputs,
17 max_new_tokens=100,
18 top_p=0.6,
19 top_k=0,
20 temperature=1,
21 do_sample=True,
22 use_cache=True
23 )
24print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))
-
custom_G_type: None for learned G values during pretraining, 'identity' for LLM with SDPA equivalent, 'random' for G values from a random normal distribution, 'external' for custom G values that can be assigned after model initialization. This setting is more important for training purposes, for inference it is set in the model config.json file.
-
cache_first_G: For batched inference, if set to True, cache G values from the first sample prompt in batch for all samples. If set to False, cache G values separately for each sample prompts in batch. For contrastive generation with custom_G_value=None, this needs to be set to True.
-
reference_rope: If set to True, RoPE implementation implemented in the original paper is used. This is the case for model pretrained in this repo. If set to False, RoPE implementation from the Huggingface Transformers library is used.
-
output_pldr_attentions=True returns the deductive outputs and learnable parameters of power law graph attention module as tuple containing:
the output of the residual metric learner (metric tensor, A), output (ALM) after application of iSwiGLU on metric tensor, learned exponents of potential tensor, learned weights for energy-curvature tensor, learned bias for energy-curvature tensor, energy-curvature tensor (GLM), and attention weights.
See config.json for other model configuration details.
1 git clone https://github.com/burcgokden/transformers
2 cd transformers
3 git checkout add_PLDR_LLM
4 pip install -e ".[dev]"
Large Language Models may generate text that is profane, lewd, socially unacceptable or offensive based on the contents of the dataset it was pretrained. RefinedWeb is a dataset that is as toxic and biased as the Pile. Please see the papers for
RefinedWeb and
the Pile for more information. Moreover, large language models are also susceptible to hallucinations and may generate text that contains incorrect, irrelevant or misleading information. Since it is very hard to expect the contents of generated text ahead of time, the output of the large language models need to be heavily moderated and curated to avoid undesired content to appear without warning.
1@misc{gokden2025pldrllmkvgcache,
2 title={PLDR-LLMs Learn A Generalizable Tensor Operator That Can Replace Its Own Deep Neural Net At Inference},
3 author={Burc Gokden},
4 year={2025},
5 eprint={2502.13502},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2502.13502},
9}