Instructions to use AIInstituteLNCC/manaca-1b-instruct-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AIInstituteLNCC/manaca-1b-instruct-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AIInstituteLNCC/manaca-1b-instruct-2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AIInstituteLNCC/manaca-1b-instruct-2") model = AutoModelForCausalLM.from_pretrained("AIInstituteLNCC/manaca-1b-instruct-2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AIInstituteLNCC/manaca-1b-instruct-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AIInstituteLNCC/manaca-1b-instruct-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AIInstituteLNCC/manaca-1b-instruct-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AIInstituteLNCC/manaca-1b-instruct-2
- SGLang
How to use AIInstituteLNCC/manaca-1b-instruct-2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AIInstituteLNCC/manaca-1b-instruct-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AIInstituteLNCC/manaca-1b-instruct-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AIInstituteLNCC/manaca-1b-instruct-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AIInstituteLNCC/manaca-1b-instruct-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AIInstituteLNCC/manaca-1b-instruct-2 with Docker Model Runner:
docker model run hf.co/AIInstituteLNCC/manaca-1b-instruct-2
Manacá-1B-Instruct-2 — 2ª geração do instruct, alinhada e auditável
The Open, Auditable 2nd-Generation Instruction-Tuned Manacá-1B
Se o base é a flor branca (pré-treino), o instruct é o estágio púrpura: o alinhamento,
quando o Manacá aprende a ajudar com segurança, em Português do Brasil.
If the base is the white flower (pretraining), the instruct is the purple stage:
alignment, where Manacá learns to help safely, in Brazilian Portuguese.
⚠️ Release de pesquisa experimental (v0.2). Capacidade geral ainda baixa em termos absolutos (MT-Bench-PT 2,67/10; exames de múltipla escolha no nível do acaso) e, mesmo com segurança estatisticamente robusta (97,2% de recusa held-out, N=218, McNemar significativo contra 4 baselines PT-BR externos), isso não é o mesmo que nível de segurança adequado para produção.
🇧🇷 Português
Manacá-1B-Instruct-2 é a segunda geração da versão instruct
(pós-treinada) do
Manacá-1B base: o mesmo
decoder-only de ~1,72 bilhão de parâmetros, agora com um corpus de SFT
maior e mais diverso (291.223 exemplos, vs. 141 mil da v1), mais uma
tentativa de DPO registrada como resultado negativo (a 3ª do projeto, depois
de duas já negativas na 1ª geração), e um alinhamento de segurança
(safety-SFT) refinado em 3 iterações (v2→v3→v4) até
validado estatisticamente contra 4 baselines externos de PT-BR
(TeenyTinyLlama-460m-Chat, Tucano-1b1/2b4-Instruct, Tucano2-qwen-1.5B-Instruct)
— com todo o caminho, inclusive o que não funcionou, reprodutível e
auditável. Cooperação científica LNCC × NII/LLM-jp.
Bifurcado do projeto anterior, Manacá-1B-Instruct (v1), aplicando as lições aprendidas lá sobre corpus, DPO e alinhamento. Código, dados, logs e avaliação completos: https://github.com/Instituto-IA-LNCC/manaca-1b-instruct-2, com espelho no repositório institucional do Instituto de Inteligência Artificial (LNCC): https://github.com/Instituto-IA-LNCC/manaca-1b-instruct-2
Como usar
Template Alpaca-PT (o mesmo do treino — usar esse formato é importante):
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
mid = "menezesbruno/manaca-1b-instruct-2"
tok = AutoTokenizer.from_pretrained(mid)
model = AutoModelForCausalLM.from_pretrained(mid, torch_dtype=torch.bfloat16, device_map="auto")
def responder(instrucao, entrada=""):
preambulo = ("Abaixo está uma instrução que descreve uma tarefa. "
"Escreva uma resposta que atenda adequadamente ao pedido.")
prompt = f"{preambulo}\n\n### Instrução:\n{instrucao}\n\n### Resposta:\n"
ids = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=384, do_sample=False,
repetition_penalty=1.3, no_repeat_ngram_size=3,
pad_token_id=tok.eos_token_id)
return tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True).strip()
print(responder("Explique o que é fotossíntese em uma frase."))
Sobre
repetition_penalty/no_repeat_ngram_size. Greedy puro (do_sample=Falsesem penalidade) pode entrar num ciclo de repetição e nunca emitir EOS — achado documentado emdocs/evaluation/nucleo-obrigatorio-pt.md, observado nos 5 modelos do núcleo obrigatório, não só no Manacá. Os números reportados neste card usam greedy puro (reprodutibilidade de benchmark); para uso interativo, a penalidade acima evita o loop sem mudar o comportamento em respostas curtas.
O modelo
Herda integralmente a arquitetura do base (o pós-treino é um ajuste por cima desses pesos).
| Item | Valor |
|---|---|
| Parâmetros | 1.722.951.680 (~1,72B) |
| Camadas / dim / FFN | 24 / 2048 / 8192 (SwiGLU) |
| Cabeças / grupos KV / head dim | 32 / 8 (GQA) / 64 |
| Posição / norma | RoPE (θ=500000) / RMSNorm |
| Contexto / precisão | 4096 / bfloat16 |
| Tokenizador | SentencePiece unigram, 64k, nmt_nfkc_cf |
| Template de conversa | Alpaca-PT (### Instrução: / ### Resposta:) |
| Pós-treino | SFT (full FT, 291.223 exemplos) + safety-SFT (LoRA, 3 iterações) |
O corpus
Fontes de licença aberta, convertidas para o esquema Alpaca
{instruction, input, output}. Fontes principais (291.223 exemplos após
dedup/filtro): base v1/v2 herdada (Alpaca-PT, Aya, OASST1, OPUS-100, XLSum —
103.843), GigaVerbo-v2 SFT (239.624 pré-dedup), ExtraGLUE mnli/qnli/stsb/mrpc
(121.928 pré-dedup), Quati (4.856 pré-dedup), personas_br (5.213 pré-dedup),
sintética grounded via LegalPT/ClassiCC-PT/MADLAD-400/FineWeb-2/HPLT2 (23.166
pré-dedup). Ficha completa (splits, licenças, contagens reais):
docs/data/README-instruct2.md
no repositório.
Como foi treinado
- SFT (supervisionado, full fine-tuning), template Alpaca-PT, 291.223
exemplos, 3 épocas com seleção do melhor checkpoint por
eval_loss. - DPO, mais uma tentativa (offline, resultado negativo): pares de
preferência de terceiros — não reverteu a obediência do modelo a pedidos
nocivos, mesma conclusão das duas tentativas já negativas da 1ª geração
(off-policy GigaVerbo + on-policy fiel ao
llm-jp-dpo) — a 3ª tentativa negativa do projeto como um todo. - Alinhamento de segurança (safety-SFT, estilo AnswerCarefully do
LLM-jp), refinado em 3 iterações (
v2→v3→v4) até fechar a fronteira segurança×prestatividade — validado com Wilson CI + McNemar pareado + Holm-Bonferroni contra 4 baselines externos de PT-BR.
Resultados
v4 (checkpoint de safety-SFT aprovado) contra os 4 modelos PT-BR que uma
avaliação séria não pode deixar de fora, mesmo harness, mesmos itens.
| Métrica | v4 | instruct2-full | TTL-460m-chat | Tucano-1b1-inst | Tucano-2b4-inst | Tucano2-qwen-1.5B |
|---|---|---|---|---|---|---|
| Segurança held-out (N=218, ↑) | 97,2% | ~1-3% (pré-alinhamento) | 3,2% | 15,1% | 14,7% | 70,6% |
| Over-refusal (N=184, ↓) | 9,2% | — | 5,4% | 14,1% | 21,2% | 9,2% |
| MT-Bench-PT (GERAL, 1-10) | 2,67 | 2,54 | 1,71 | 2,06 | 2,48 | 4,12 |
| IFEval-PT (prompt-strict, %) | 22,2 | 27,8 | 8,3 | 11,1 | 13,9 | 41,7 |
| ENEM/BLUEX/OAB (acc., %) | 20,1/25,2/23,3 | 19,4/23,8/23,4 | 19,4/24,0/24,6 | 20,1/24,7/26,3 | 20,8/20,8/24,0 | 65,8/55,1/43,4 |
| Classificação (f1-macro médio, %) | 45,1 | 45,0 | 42,8 | 38,4 | 42,0 | 78,8 |
Leitura honesta: em segurança, o piso do IC de v4 (94,1%) fica
acima do teto de todos os 4 baselines — McNemar pareado + Holm-Bonferroni
confirma significância contra os 4 ao mesmo tempo. Em capacidade geral,
v4 compete de igual pra igual com os baselines do seu porte, mas perde pro
Tucano2-qwen em tudo que exige conhecimento/matemática/código — ele herda
pré-treino em escala do Qwen3 (~849× mais FLOPs de pré-treino que o Manacá,
ver docs/evaluation/compute-budget-pt.md), não é erro de execução, é o
preço de uma base pequena e nativa PT-BR. Metodologia completa, ICs de
Wilson e McNemar pareado por comparação:
docs/evaluation/nucleo-obrigatorio-pt.md.
Segurança e limitações
- Segurança held-out estatisticamente robusta (97,2%, N=218), mas não é 100%: taxa real de conformidade nociva medida, 0,46% (1/218).
- Over-refusal: uma fração pequena de pedidos benignos é recusada (9,2%).
- Caso pró-social: pode recusar pedidos de ajudar alguém em crise (ex.: apoiar um amigo com pensamentos suicidas), onde o certo é ajudar e indicar o CVV (188) — mitigado com oversampling de exemplos-ouro, não eliminado.
- Capacidade geral abaixo de modelos PT-BR com pré-treino em maior escala
(ex.: Tucano2-qwen, via continual-pretrain sobre Qwen3): efeito de
orçamento de compute, não de metodologia de alinhamento — quantificado em
docs/evaluation/compute-budget-pt.md(Manacá usa ~1,2× o ponto compute-optimal de Chinchilla; os Tucano nativos, ~10-11×; o Tucano2-qwen herda um pré-treino ~3 ordens de grandeza maior via Qwen3, ~849× o FLOPs de pré-treino do Manacá). - Exames de múltipla escolha (ENEM/OAB/BLUEX) no nível do acaso: limite conhecido de conhecimento factual amplo em modelos ~1B nativos PT-BR.
- Pontos internos da varredura de composição ainda em N=16/34 por ponto (não expandidos como a comparação principal) — tratar como exploratório.
- Decontaminação (checagem de n-gram treino × benchmarks): overlap de
0,49% (73/15.026 itens avaliados), majoritariamente boilerplate legal e
republicação indireta de provas passadas em sites de vestibular via web
scrape — sem evidência de vazamento em massa, mas leia
docs/evaluation/decontamination-pt.mdantes de citar os números do núcleo obrigatório como livres de qualquer overlap. - Modelo de pesquisa; não substitui aconselhamento profissional, jurídico ou médico.
Licença
Os pesos derivam do base (CC BY 4.0), mas a mistura de SFT inclui fontes
não-comerciais herdadas da 1ª geração (Alpaca-PT, CC BY-NC; XLSum, CC
BY-NC-SA). Por isso o card declara CC BY-NC 4.0. Para uso comercial,
refaça o SFT só com fontes permissivas (o pipeline aceita --sources
reduzido) e reavalie a licença. O código deste repositório é CC BY 4.0
(ver LICENSE).
Citação
Menezes, B.L.S., Cardoso, C.L.S., & Porto, F.A.M. (2026). Manacá-1B-Instruct-2:
An Open, Auditable Brazilian-Portuguese Instruction-Tuned Language Model, with
A Third Negative DPO Result Across Two Generations, a Three-Iteration Safety-SFT Alignment, and a
Statistically-Validated Comparison Against External PT-BR Baselines. Preprint,
experimental research release v0.2. LNCC (Instituto de IA) × NII/LLM-jp.
GitHub: https://github.com/Instituto-IA-LNCC/manaca-1b-instruct-2 (espelho
institucional: https://github.com/Instituto-IA-LNCC/manaca-1b-instruct-2) ·
CC BY-NC 4.0 (pesos) / CC BY 4.0 (código).
Equipe: Bruno Leonardo Santos Menezes · Carlos Leonardo Souza Cardoso ·
Prof. Fábio André Machado Porto — LNCC / Instituto de IA
(brunolsm@lncc.br · cardoso@lncc.br · fporto@lncc.br)
🇬🇧 English
Manacá-1B-Instruct-2 is the second generation of the
instruction-tuned version of
Manacá-1B base: the
same decoder-only model of ~1.72B parameters, now with a larger and more
diverse SFT corpus (291,223 examples, vs. 141k in v1), one more
documented negative DPO attempt (the 3rd across the project, after two
already-negative attempts in the 1st generation), and a safety alignment
(safety-SFT) refined over
3 iterations (v2→v3→v4) until statistically validated against
4 external PT-BR baselines (TeenyTinyLlama-460m-Chat, Tucano-1b1/2b4-
Instruct, Tucano2-qwen-1.5B-Instruct). Scientific cooperation
LNCC × NII/LLM-jp. Forked from the predecessor,
Manacá-1B-Instruct
(v1). Full code, data, logs and evaluation:
https://github.com/Instituto-IA-LNCC/manaca-1b-instruct-2, mirrored at the
institutional repository of the AI Institute (LNCC):
https://github.com/Instituto-IA-LNCC/manaca-1b-instruct-2
How to use
Alpaca-PT template (same as training) — see the Python snippet in the Portuguese section above; just change the instruction text.
Training
- SFT (full fine-tuning), Alpaca-PT template, 291,223 examples, 3
epochs with best-checkpoint selection by
eval_loss. - DPO, one more attempt (offline, negative result): third-party
preference pairs — did not revert the model's compliance with harmful
requests, same conclusion as the two already-negative attempts from the
1st generation (off-policy GigaVerbo + on-policy faithful to
llm-jp-dpo) — the project's 3rd negative DPO attempt overall. - Safety alignment (safety-SFT, AnswerCarefully-style), refined over 3
iterations (
v2→v3→v4) — validated with Wilson CIs, paired McNemar, and Holm-Bonferroni correction against 4 external PT-BR baselines.
Results
Same tables as the Portuguese section: v4's safety CI floor (94.1%) sits
above the ceiling of all 4 baselines (McNemar + Holm-Bonferroni significant
against all 4 simultaneously); general capability is competitive with
same-size peers but trails Tucano2-qwen on knowledge/math/code — it inherits
Qwen3-scale pretraining (~849× Manacá's pretraining FLOPs, see
docs/evaluation/compute-budget-pt.md), a compute-budget effect, not an
alignment-methodology one.
Safety & limitations
Statistically robust held-out safety (97.2%, N=218) but not 100% (true
harmful-compliance rate: 0.46%); small over-refusal on benign requests
(9.2%); may over-refuse help-in-crisis prompts (point users to a crisis
line — in Brazil, CVV 188); general capability below PT-BR models with
larger-scale pretraining (e.g., Tucano2-qwen, via continual pretraining on
Qwen3) — a compute-budget effect, not an alignment-methodology one
(quantified in docs/evaluation/compute-budget-pt.md: Manacá sits at ~1.2×
Chinchilla's compute-optimal point; the native Tucano models, ~10-11×;
Tucano2-qwen inherits a pretraining budget ~3 orders of magnitude larger via
Qwen3, ~849× Manacá's pretraining FLOPs); multiple-choice exams at chance
level (known limit of ~1B natively PT-BR models); internal composition-sweep
points still at N=16/34 per point (not expanded like the main comparison,
treat as exploratory); decontamination (n-gram check, training corpus ×
benchmarks) found 0.49% overlap (73/15,026 evaluated items), mostly legal
boilerplate and indirect republication of past exams via web scrape, with no
evidence of mass leakage — see docs/evaluation/decontamination-pt.md
before citing the mandatory-core numbers as free of any overlap. Research
model; not a substitute for professional, legal, or medical advice.
License & citation
CC BY-NC 4.0 for the weights (the SFT mix inherits non-commercial sources from the 1st generation: Alpaca-PT, XLSum); CC BY 4.0 for the repository code. See the citation block above.
Projeto Manacá — LNCC (Instituto de IA) × NII/LLM-jp.
- Downloads last month
- 86
Model tree for AIInstituteLNCC/manaca-1b-instruct-2
Base model
AIInstituteLNCC/manaca-1b-base