dejanseo / reverse-prompter

huggingface.co
Total runs: 32
24-hour runs: -1
7-day runs: -5
30-day runs: -102
Model's Last Updated: March 18 2026
text-generation

Introduction of reverse-prompter

Model Details of reverse-prompter

Reverse Prompter

A fine-tuned google/gemma-3-270m model that reconstructs the most likely prompt from an AI assistant's response.

Given an AI-generated text, the model generates candidate prompts that could have produced it.

How It Works

The model was trained on prompt-response pairs formatted as:

{response}\n###\n{prompt}

At inference time, you provide the response followed by the \n###\n separator, and the model generates the reconstructed prompt.

Usage
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("dejanseo/reverse-prompter", torch_dtype="bfloat16").cuda().eval()
tokenizer = AutoTokenizer.from_pretrained("dejanseo/reverse-prompter")

response_text = "Your AI-generated text here"
prompt = response_text.strip() + "\n###\n"

inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, penalty_alpha=0.3, top_k=4)

generated = outputs[0][inputs["input_ids"].shape[-1]:]
reconstructed_prompt = tokenizer.decode(generated, skip_special_tokens=True).strip()
print(reconstructed_prompt)

For best results, run generation across multiple contrastive search configurations and rank outputs by perplexity. See the companion Streamlit app for a full implementation.

Training Data

The training dataset was generated synthetically using Gemini 2.5 Flash via Vertex AI in a three-stage pipeline:

1. Prompt Generation

100,000 diverse prompts were generated across five categories (20 each per batch):

  • Mid-tail, search query style (single or multi-faceted)
  • Long-tail, search query style (multi-faceted)
  • Simple, prompt-like (single-faceted)
  • Typical, prompt-like (single or multi-faceted)
  • Detailed, prompt-like (multi-faceted)

Generation was parallelized with 100 concurrent API calls in batches of 100 prompts, with results stored in SQLite.

2. Response Generation

Each prompt was sent back to Gemini 2.5 Flash (with thinking disabled) to produce a corresponding AI assistant response. This was also parallelized at 100 concurrent calls.

3. Tokenization

Prompt-response pairs were formatted as {response}\n###\n{prompt}<eos> and tokenized using the Gemma 3 tokenizer. Labels were masked ( -100 ) over the response and separator tokens so the model only learns to predict the prompt portion. Tokenization was done in batches of 5,000 and concatenated into the final dataset.

Training Details
Parameter Value
Base model google/gemma-3-270m
Method Full fine-tune
Precision bfloat16
Epochs 1
Batch size 2
Gradient accumulation 8 (effective batch size 16)
Learning rate 5e-5
Warmup steps 100
Max sequence length 2048
Optimizer AdamW (torch fused)
Gradient checkpointing Enabled
Training time 4h 14m
GPU NVIDIA GeForce RTX 4090 (24 GB)
CPU AMD Ryzen 9 7950X3D 16-Core
RAM 128 GB
Training Loss

Training Loss

Inference Strategy

The companion app uses contrastive search with a sweep over configurations:

  • top_k : [2, 4, 6, 15]
  • penalty_alpha : [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]

This produces up to 24 candidate prompts per input. Candidates are deduplicated and ranked by perplexity (lower is better). Token-level probabilities provide a confidence signal for each word in the reconstruction.

Limitations
  • Prompt reconstruction is inherently probabilistic. The model returns plausible prompts, not necessarily the exact original.
  • Performance is best on responses typical of AI assistants. Non-standard or very short inputs may produce lower-quality reconstructions.
  • The model inherits the capabilities and limitations of the gemma-3-270m base model.
Author

Dejan AI

Runs of dejanseo reverse-prompter on huggingface.co

32
Total runs
-1
24-hour runs
-4
3-day runs
-5
7-day runs
-102
30-day runs

More Information About reverse-prompter huggingface.co Model

More reverse-prompter license Visit here:

https://choosealicense.com/licenses/link-attribution

reverse-prompter huggingface.co

reverse-prompter huggingface.co is an AI model on huggingface.co that provides reverse-prompter's model effect (), which can be used instantly with this dejanseo reverse-prompter model. huggingface.co supports a free trial of the reverse-prompter model, and also provides paid use of the reverse-prompter. Support call reverse-prompter model through api, including Node.js, Python, http.

reverse-prompter huggingface.co Url

https://huggingface.co/dejanseo/reverse-prompter

dejanseo reverse-prompter online free

reverse-prompter huggingface.co is an online trial and call api platform, which integrates reverse-prompter's modeling effects, including api services, and provides a free online trial of reverse-prompter, you can try reverse-prompter online for free by clicking the link below.

dejanseo reverse-prompter online free url in huggingface.co:

https://huggingface.co/dejanseo/reverse-prompter

reverse-prompter install

reverse-prompter is an open source model from GitHub that offers a free installation service, and any user can find reverse-prompter on GitHub to install. At the same time, huggingface.co provides the effect of reverse-prompter install, users can directly use reverse-prompter installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

reverse-prompter install url in huggingface.co:

https://huggingface.co/dejanseo/reverse-prompter

Url of reverse-prompter

reverse-prompter huggingface.co Url

Provider of reverse-prompter huggingface.co

dejanseo
ORGANIZATIONS

Other API from dejanseo

huggingface.co

Total runs: 398
Run Growth: 99
Growth Rate: 24.87%
Updated:November 20 2025
huggingface.co

Total runs: 66
Run Growth: 5
Growth Rate: 7.58%
Updated:August 15 2024
huggingface.co

Total runs: 46
Run Growth: 34
Growth Rate: 73.91%
Updated:August 15 2024
huggingface.co

Total runs: 36
Run Growth: 0
Growth Rate: 0.00%
Updated:July 10 2024
huggingface.co

Total runs: 32
Run Growth: -17
Growth Rate: -53.13%
Updated:November 20 2025
huggingface.co

Total runs: 30
Run Growth: 15
Growth Rate: 50.00%
Updated:April 25 2025
huggingface.co

Total runs: 30
Run Growth: 0
Growth Rate: 0.00%
Updated:July 09 2024
huggingface.co

Total runs: 25
Run Growth: 16
Growth Rate: 64.00%
Updated:September 04 2024
huggingface.co

Total runs: 24
Run Growth: 0
Growth Rate: 0.00%
Updated:July 17 2024
huggingface.co

Total runs: 21
Run Growth: 3
Growth Rate: 14.29%
Updated:April 22 2025
huggingface.co

Total runs: 17
Run Growth: -1
Growth Rate: -5.88%
Updated:July 05 2026
huggingface.co

Total runs: 13
Run Growth: 6
Growth Rate: 46.15%
Updated:April 17 2025
huggingface.co

Total runs: 12
Run Growth: -5
Growth Rate: -41.67%
Updated:August 15 2024
huggingface.co

Total runs: 12
Run Growth: 0
Growth Rate: 0.00%
Updated:July 26 2024
huggingface.co

Total runs: 10
Run Growth: 5
Growth Rate: 50.00%
Updated:June 14 2025
huggingface.co

Total runs: 10
Run Growth: 4
Growth Rate: 40.00%
Updated:April 09 2025
huggingface.co

Total runs: 6
Run Growth: 2
Growth Rate: 33.33%
Updated:April 17 2025
huggingface.co

Total runs: 5
Run Growth: 0
Growth Rate: 0.00%
Updated:May 10 2024
huggingface.co

Total runs: 3
Run Growth: 0
Growth Rate: 0.00%
Updated:June 29 2024
huggingface.co

Total runs: 3
Run Growth: -2
Growth Rate: -66.67%
Updated:September 17 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:March 17 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 17 2026