Gemma 4 Cรณdigo de Trabajo GGUF

This repository contains GGUF artifacts for a Gemma 4 31B instruction model fine-tuned on examples related to the Cรณdigo de Trabajo de Costa Rica.

The model is intended to run locally with GGUF-compatible tools such as Ollama, llama.cpp, and other local inference runtimes.

Model Summary

  • Model name: gemma-4-codigo-trabajo-gguf
  • Base model: unsloth/gemma-4-31B-it
  • Format: GGUF
  • Main quantization: Q4_K_M
  • Language: Spanish
  • Domain: Costa Rican labor law
  • Primary use case: Educational and informational answers about the Cรณdigo de Trabajo de Costa Rica
  • Fine-tuning method: LoRA with Unsloth
  • Local Ollama model name used during testing: codigo-trabajo-cr

Files

This repository includes:

gemma-4-31b-it.Q4_K_M.gguf
gemma-4-31b-it.BF16-mmproj.gguf
Modelfile

The main text model file is:

gemma-4-31b-it.Q4_K_M.gguf

The BF16-mmproj file is included because it was produced during the GGUF export workflow.

Intended Use

This model is intended for Spanish-language informational assistance about Costa Rican labor-law topics, including:

  • Rights and obligations of employers and workers
  • Employment contracts
  • Work schedules
  • Overtime
  • Rest periods
  • Salaries
  • Aguinaldo
  • Vacations
  • Dismissal causes
  • Severance-related concepts

Important Legal Disclaimer

This model is not a lawyer and does not provide legal advice.

Its outputs should be treated as educational and informational only. For real legal cases, disputes, employment decisions, litigation, or formal legal interpretation, consult a qualified Costa Rican labor lawyer or the relevant public authority.

How to Use with Ollama

You can run the GGUF directly from Hugging Face with Ollama:

ollama run hf.co/josoroma/gemma-4-codigo-trabajo-gguf:Q4_K_M

If you download the GGUF manually, create a local Modelfile like this:

FROM ./gemma-4-31b-it.Q4_K_M.gguf

PARAMETER temperature 0.2
PARAMETER top_p 0.95

SYSTEM "Eres un asistente especializado en el Cรณdigo de Trabajo de Costa Rica. Responde en espaรฑol."

Then create and run the local Ollama model:

ollama create codigo-trabajo-cr -f Modelfile
ollama run codigo-trabajo-cr

Training Data

The model was fine-tuned using a JSONL dataset built around the Cรณdigo de Trabajo de Costa Rica.

The training rows used fields such as:

instruction
input
output

Additional traceability fields were kept in the dataset, including:

source_quote
source_url
law_code
article
chunk_id
dataset_type

These traceability fields were useful for auditing the dataset, but they were not necessarily injected into every training prompt.

Training Procedure

The training workflow used:

  • Kaggle for the initial LoRA fine-tuning
  • Unsloth for loading and fine-tuning Gemma 4 31B
  • SFTTrainer for supervised fine-tuning
  • Response-only training with train_on_responses_only
  • RunPod A100 80GB for the merge and GGUF export
  • llama.cpp tooling through the Unsloth GGUF export path

The LoRA configuration used a text-only setup:

finetune_vision_layers     = False
finetune_language_layers   = True
finetune_attention_modules = True
finetune_mlp_modules       = True
r                          = 8
lora_alpha                 = 8
lora_dropout               = 0
bias                       = none

The trainer configuration included:

per_device_train_batch_size = 1
gradient_accumulation_steps = 4
warmup_steps                = 5
max_steps                   = 60
learning_rate               = 2e-4
optim                       = adamw_8bit
weight_decay                = 0.001
lr_scheduler_type           = linear
seed                        = 3407

Conversion and Export

The workflow produced:

gemma_4_lora/

Then the LoRA adapter was merged into a Hugging Face-format model on RunPod:

/workspace/gemma-4-codigo-trabajo-finetune/

Then the model was exported to GGUF:

/workspace/gemma-4-codigo-trabajo-gguf_gguf/gemma-4-31b-it.Q4_K_M.gguf

The final GGUF export was uploaded to this repository.

Local Test

The model was tested locally with Ollama on Apple Silicon.

The local test used:

ollama create codigo-trabajo-cr -f /tmp/Modelfile.gemma4
ollama run codigo-trabajo-cr

A first sanity check asked:

who are you?

The model responded in Spanish and identified itself as an assistant specialized in the Cรณdigo de Trabajo de Costa Rica.

Limitations

This model may:

  • Hallucinate legal details
  • Omit relevant exceptions
  • Misread or oversimplify Costa Rican labor-law provisions
  • Give outdated answers if the law changes
  • Fail to cite exact articles unless prompted or externally grounded
  • Produce answers that require verification against the official legal text

Do not use this model as the only source for legal decisions.

Recommended Evaluation

Before relying on this model, evaluate it against article-specific questions and compare outputs against the source law.

Recommended checks:

  • Article-level factual accuracy
  • Exact citation behavior
  • Hallucination rate
  • Handling of ambiguous labor-law questions
  • Ability to say when it does not know
  • Consistency across repeated prompts
  • Comparison against official Costa Rican legal sources

Out-of-Scope Use

This model is not intended for:

  • Formal legal advice
  • Court filings
  • Employment litigation strategy
  • Replacing a lawyer
  • Automated legal decision-making
  • High-stakes HR decisions without human legal review

Acknowledgements

This project used:

  • Gemma 4 31B instruction model
  • Unsloth
  • Kaggle
  • RunPod
  • llama.cpp
  • Ollama
  • Hugging Face Hub

Model Card Author

Created by josoroma.

Status

The model plumbing is complete: LoRA fine-tuning, merge, GGUF export, Hugging Face upload, Ollama import, and local inference all worked.

The next step is evaluation and dataset-quality improvement.

Downloads last month
15
GGUF
Model size
31B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for josoroma/gemma-4-codigo-trabajo-gguf

Quantized
(12)
this model