File size: 2,400 Bytes
66eed34 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | ---
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
tags:
- babelbit
- bittensor
- utterance-prediction
---
# Babelbit Miner Model
A fine-tuned utterance prediction model for the Babelbit subnet (netuid 59) on the Bittensor network.
---
## What this model does
Given a partial utterance prefix and optional conversation context, the model predicts the most natural and complete continuation of the utterance.
The subnet evaluates predictions on:
- **Lexical similarity** — exact word overlap with the ground truth
- **Semantic similarity** — meaning-level match
- **Earliness** — how early in the utterance the prediction was correct
---
## Usage
### Direct inference
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.float16)
system = (
"You are a helpful assistant that completes the current utterance naturally and succinctly. "
"Return only the completed utterance text without quotes or extra commentary."
)
prefix = "Hi - how"
context = ""
if context:
user = f"Context:\n{context}\n\nContinue the utterance that begins with:\n{prefix}"
else:
user = f"Continue the utterance that begins with:\n{prefix}"
messages = [
{"role": "system", "content": system},
{"role": "user", "content": user},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
output = model.generate(**inputs, max_new_tokens=64, do_sample=False)
decoded = tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(decoded)
# → "Hi - how are you?"
```
### Validator API request format
Validators query the miner at `POST /predict`:
```json
{
"index": "<session-uuid>",
"step": 3,
"prefix": "Hi - how",
"context": "",
"done": false
}
```
Expected response:
```json
{
"prediction": "Hi - how are you?"
}
```
---
## Limitations
- Designed specifically for the Babelbit subnet utterance prediction task.
- Best results on conversational English; performance varies on other languages.
- Predictions are evaluated on partial prefixes — shorter prefixes are inherently harder.
|