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.
Install
# 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]
Quick start
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)
JSON mode
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)
API
| 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 |
How these models are made
All this is part of this YouTube course by Neural Breakdown:
- Course Video 1 (CPT): https://youtu.be/B8Ur62D3J3U
- Course Video 2 (SFT): https://youtu.be/gvZIUEL6Ruc
- Course Video 3 (DPO): https://youtu.be/qQwg2nFtZ1Y
Other models in this family:
- HF SFT: paperbd/smollm_135M_neuraltxt_v1
- MLX SFT: paperbd/smollm_135M_neuraltxt_mlx_v1
- HF DPO: paperbd/smollm_135M_neuraltxt_dpo_v2
- MLX DPO: paperbd/smollm_135M_neuraltxt_mlx_dpo_v2
- Downloads last month
- 102
Safetensors
Model size
0.1B params
Tensor type
BF16
·
