Smaller
Collection
<50K β’ 2 items β’ Updated
ApproxDumb is an ultra-micro language model built with just 560 parameters.
It serves as a proof-of-concept for In-Context Learning (ICL) in micro-architectures, demonstrating how a model can infer underlying rules (such as dynamic addition patterns) on-the-fly from a single provided example.
Due to the extreme parameter budget, this model cannot process natural language text or complex multi-digit arithmetic. Please strictly adhere to the following input and output specifications.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9-><bos>, <eos>, <pad>"1 3 -> 4").[Example Input] [Example Output] -> [Query Input] (Total of 4 tokens).0β9).By providing a single "Example", the model infers the rule and predicts the answer for the "Query".
Prompt (input_text) |
Inferred Rule | Expected Prediction |
|---|---|---|
"1 2 -> 4" |
$+1$ rule | 5 |
"1 3 -> 4" |
$+2$ rule | 6 |
"1 4 -> 2" |
$+3$ rule | 5 |
"0 4 -> 1" |
$+4$ rule | 5 |
Make sure to pass trust_remote_code=True when loading the model and tokenizer.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model and tokenizer
model_id = "56m/ApproxDumb" # Replace with your Hugging Face repository
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
# Prepare prompt: Example "1 -> 3" (+2 rule), Query "4 -> ?"
prompt = "1 3 -> 4"
inputs = tokenizer(prompt, return_tensors="pt")
# Inference
model.eval()
with torch.no_grad():
outputs = model(**inputs)
# Extract the most probable next digit token from the final position
next_token_logits = outputs.logits[0, -1, :]
predicted_token_id = torch.argmax(next_token_logits).item()
predicted_symbol = tokenizer.decode([predicted_token_id])
print(f"Input: '{prompt}'")
print(f"Predicted Next Digit: {predicted_symbol}")