LatentGym
Collection
Models for LatentGym: a testbed for cross-task experiential learning with controllable latent structure. • 19 items • Updated
How to use namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full")
model = AutoModelForMultimodalLM.from_pretrained("namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full
How to use namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full with Docker Model Runner:
docker model run hf.co/namkoong-lab/LatentGym_Qwen3-8B_10episodes_4Envs_full
GRPO-fine-tuned Qwen3-8B for in-context meta-learning across 4 envs (N=10). Part of the LatentGym testbed.
| Env | Latents seen during training |
|---|---|
| hangman | vowel_count_4, ending_ABLE |
| wordladder | hub_word_3letter, hub_word_4letter, order_outside_in |
| secretary | inverse_order, fixed_position_2 |
| number_guessing | set_of_3, range_100 |
| Base model | Qwen/Qwen3-8B |
| Algorithm | GRPO |
| Optimizer | AdamW (β₁=0.9, β₂=0.999) |
| Learning rate | 5e-07 |
| LR schedule | constant_with_warmup |
| Weight decay | 0.01 |
| Max grad norm | 1.0 |
| KL coefficient β | 0.04 |
| Clip range ε | 0.2 |
| Train batch (prompts) | 32 |
| Mini-batch | 1 |
| Rollouts per prompt | 8 |
| Episodes per trajectory (N) | 10 |
| Reward Φ | Σᵢ Gᵢ (cumulative) |
| Epochs | 20 |
| Max generation length | 64 |
| Sampling (train) | T=0.8, top-p=0.95 |
| Seed | 263 |