paperbd/paper_instructions_300K-v1
Viewer • Updated • 288k • 342 • 10
How to use paperbd/neuraltxt-v1-135M with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir neuraltxt-v1-135M paperbd/neuraltxt-v1-135M
This SLM does narrow tasks related to AI research papers! Should be run using the neural-txt harness: https://github.com/avbiswas/neural-txt
Part of the Neural Breakdown youtube course.
# Base (no inference backend)
pip install neural-txt
# With HuggingFace backend (torch)
pip install neural-txt[hf]
# With MLX backend (Apple Silicon)
pip install neural-txt[mlx]
from neuraltxt import NeuralTxt
model = NeuralTxt(backend="mlx") # or backend="hf"
passage = """
Transformers have revolutionized NLP by introducing the self-attention
mechanism. Unlike RNNs, transformers process all tokens in parallel,
leading to significant training speedups.
"""
# Extract key points
bullets = model.extract_bullets(passage)
# Generate question-answer pairs
pairs = model.generate_qa_pairs(passage)
# Extract knowledge graph triplets
triplets = model.extract_triplets(passage)
Every method supports json=True for guaranteed structured output via outlines:
# Returns a BulletsOutput pydantic model
bullets = model.extract_bullets(passage, json=True)
print(bullets.bullets) # list[str]
# Returns a QAPairsOutput pydantic model
qa = model.generate_qa_pairs(passage, json=True)
for pair in qa.pairs:
print(pair.question, pair.answer)
# Returns a TripletsOutput pydantic model
triplets = model.extract_triplets(passage, json=True)
for t in triplets.triplets:
print(t.subject, t.relation, t.object)
| Method | Input | Output | JSON Output |
|---|---|---|---|
extract_bullets(passage) |
passage | list[str] |
BulletsOutput |
generate_qa_pairs(passage) |
passage | list[QAPair] |
QAPairsOutput |
generate_question(passage) |
passage | str |
QuestionOutput |
generate_questions_list(passage) |
passage | list[str] |
QuestionsListOutput |
extract_fact(passage) |
passage | str |
FactOutput |
answer(question, passage) |
question + passage | str |
AnswerOutput |
rephrase(passage) |
passage | str |
RephraseOutput |
continue_from(passage) |
passage start | str |
ContinuationOutput |
extract_triplets(passage) |
passage | list[Triplet] |
TripletsOutput |
compare(passage_a, passage_b) |
two passages | str |
ComparisonOutput |
find_relevant(question, passages) |
question + passage list | RetrievalResult |
RetrievalOutput |
On research paper QA and retrieval tasks, this model handsomely beats other edge LMs.
| Model | Overall | Faithful. | Correct. | Relev. | Complete |
|---|---|---|---|---|---|
| neuraltxt (135M) | 3.52 | 3.98 | 3.12 | 3.88 | 3.12 |
| Qwen3.5-0.8B (4-bit) | 3.35 | 3.75 | 2.98 | 3.85 | 2.81 |
| Qwen3.5-4B (4-bit) | 3.31 | 3.99 | 3.16 | 3.24 | 2.84 |
| Qwen3-0.6B | 3.31 | 3.64 | 3.04 | 3.74 | 2.83 |
| SmolLM2-135M-Instruct | 2.38 | 2.73 | 2.15 | 2.63 | 1.99 |
All this is part of this YouTube course by Neural Breakdown:
Quantized