Views
No views yet
ApproxDumb is an ultra-micro language model built with just 560 parameters.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).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 |
trust_remote_code=True when loading the model and tokenizer.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# Load model and tokenizer
5model_id = "56m/ApproxDumb" # Replace with your Hugging Face repository
6tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
8
9# Prepare prompt: Example "1 -> 3" (+2 rule), Query "4 -> ?"
10prompt = "1 3 -> 4"
11inputs = tokenizer(prompt, return_tensors="pt")
12
13# Inference
14model.eval()
15with torch.no_grad():
16 outputs = model(**inputs)
17
18# Extract the most probable next digit token from the final position
19next_token_logits = outputs.logits[0, -1, :]
20predicted_token_id = torch.argmax(next_token_logits).item()
21predicted_symbol = tokenizer.decode([predicted_token_id])
22
23print(f"Input: '{prompt}'")
24print(f"Predicted Next Digit: {predicted_symbol}")