mirror of
https://github.com/wassname/discovering_latent_knowledge.git
synced 2026-09-09 11:21:22 +08:00
3 vae experiments WIP
This commit is contained in:
+88
-1
@@ -1879,8 +1879,95 @@ ideas:
|
||||
- [x] aready tried neutral vs positive, like 80%, with good generalization, but I wonder if it's trivial?
|
||||
- [x] tried ranking vs mse. mse is still richer
|
||||
- [x] tried big vs small model, big seems to help
|
||||
- [x] Try a negative vs positve intervention - nope
|
||||
- [x] Try a negative vs positive intervention - nope
|
||||
- [x] try intervening on every layer = nope
|
||||
- [x] flip x0, x1... oh wait with ranking it doesn't know which is which anyway. If I try SL I will need to
|
||||
|
||||
I'm out of idea? it does overfit, so maybe only giving it later layers? That helps
|
||||
|
||||
|
||||
|
||||
# Brainstorm with Nick
|
||||
|
||||
|
||||
Styalized facts:
|
||||
- the pair of inferences need to be far apart
|
||||
- it's hard get the models to lie
|
||||
- using soft labels rather only truth direction helps a lot
|
||||
- yes/no have to be significant labels. or it's all junk
|
||||
|
||||
Things I've tried:
|
||||
- ranking loss, nll, binary, dice loss
|
||||
- lots of types of pairs
|
||||
- pair of interventions using gradient descent
|
||||
- mcdropout pairs: didn't help, not very far apart
|
||||
- find a linear weight modifcation (random, pca, could one that makes it lie) and get pair with a -ve and +ve intervention. This is hard and didn't work
|
||||
- Lots of way to get lies
|
||||
|
||||
Nicks ideas:
|
||||
- soft labels - tried with mse
|
||||
- clear lying, e.g. in a game like chess
|
||||
- try other internals states which are easier and more common. e.g. optimistic/pessimistic, cooprative, love, tired, grumpy, talkative,
|
||||
- maybe it doesn't have in innner state for lies, like no habits, no signifance on it. plus it's a goodie two shoes who never lies. so train one for lying
|
||||
- e.g. chess, it can chose to ask stockfish. e.g. it's caught 20% of the time, and forfits the game. so it would only do it when it has a chance of helping it win the game
|
||||
|
||||
|
||||
Maybe just lots of data > 7000
|
||||
|
||||
|
||||
My takeaway:
|
||||
- Maybe there's not enougth going in small models?
|
||||
- Maybe not enought data to decode internals?
|
||||
- Maybe need sparse VAE?
|
||||
- Maybe need a model that actually lies? So there are internal pathways
|
||||
- I have this tradoff between contrasting internal states vs plausible internal states. I want two realistic inferences which are differen't. States where I inject noise and get 90% of Yes, and 87%^of Yes are kind of useless and difficult to distinguish. On the other hand E.g. if I generate an in intervention to get a lie, it might rely in junk outputs like "No No No No No". That might be 99% No, but it's useless.
|
||||
|
||||
|
||||
# 2023-12-03 08:11:55
|
||||
|
||||
Ideas
|
||||
- Train QLoRa few shot liar (although I hope to find a method that works on all models)
|
||||
- N>10000 (slow)
|
||||
- Use the latest space of a VAE. Maybe one that predicts the next hidden states?
|
||||
|
||||
# 2023-12-07 14:29:00
|
||||
|
||||
Let's try VAE. How will it work?
|
||||
|
||||
|
||||
Right now I'm using pipelines that do an intervention.
|
||||
|
||||
|
||||
# Running
|
||||
|
||||
```sh
|
||||
python notebooks/make_dataset2.py --max_examples 1720 220 --datasets imdb glue:qnli super_glue:boolq
|
||||
|
||||
```
|
||||
an in intervene.py/create_cache_interventions we get the activations that are used to intervent and get a pair of hidden states
|
||||
- rep_reading_pipeline.get_directions which uses PCA to get an intervention
|
||||
|
||||
|
||||
|
||||
# 2023-12-08 07:06:05
|
||||
|
||||
bugs?:
|
||||
- does reversing the labels work with pca since it's directionless?
|
||||
- the pca intervention does a weird even - odd from the hidden states
|
||||
|
||||
modify PLConvProbeLinear to be like a world model? reconstruction and prediction loss...
|
||||
|
||||
right now we are using neut? (see https://vscode.dev/github/wassname/discovering_latent_knowledge/blob/pipelinesv2/src/repe/rep_control_pipeline_baukit.py#L94 )
|
||||
|
||||
wait each pipeline gets activations for *1 and *0. But we have a pos and neg...
|
||||
|
||||
|
||||
how to world models work?
|
||||
- they take in an image [64, 64, 3] and make it small e.g. [8], into a quantized space?
|
||||
- then reconstruct it they have a reconstruction loss
|
||||
- if they have another objective you can train both at once, or transitions/
|
||||
https://colab.research.google.com/drive/1rPy82rL3iZzy2_Rd3F82RwFhlVnnroIh?usp=sharing#scrollTo=2MD88v4Zvw-r
|
||||
- it's simple, the encoder is just a linear
|
||||
|
||||
|
||||
n_instances - remove this, another batch dim
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Generated
+31
-1
@@ -1151,6 +1151,21 @@ qtconsole = ["qtconsole"]
|
||||
test = ["pytest (<7.1)", "pytest-asyncio", "testpath"]
|
||||
test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.21)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"]
|
||||
|
||||
[[package]]
|
||||
name = "jaxtyping"
|
||||
version = "0.2.24"
|
||||
description = "Type annotations and runtime checking for shape and dtype of JAX arrays, and PyTrees."
|
||||
optional = false
|
||||
python-versions = "~=3.9"
|
||||
files = [
|
||||
{file = "jaxtyping-0.2.24-py3-none-any.whl", hash = "sha256:b0e90891bbee882d5d3487023d132227d45bdaca3e72937d491b74334f148826"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
numpy = ">=1.20.0"
|
||||
typeguard = ">=2.13.3,<3"
|
||||
typing-extensions = ">=3.7.4.1"
|
||||
|
||||
[[package]]
|
||||
name = "jedi"
|
||||
version = "0.19.1"
|
||||
@@ -3623,6 +3638,21 @@ build = ["cmake (>=3.18)", "lit"]
|
||||
tests = ["autopep8", "flake8", "isort", "numpy", "pytest", "scipy (>=1.7.1)"]
|
||||
tutorials = ["matplotlib", "pandas", "tabulate"]
|
||||
|
||||
[[package]]
|
||||
name = "typeguard"
|
||||
version = "2.13.3"
|
||||
description = "Run-time type checker for Python"
|
||||
optional = false
|
||||
python-versions = ">=3.5.3"
|
||||
files = [
|
||||
{file = "typeguard-2.13.3-py3-none-any.whl", hash = "sha256:5e3e3be01e887e7eafae5af63d1f36c849aaa94e3a0112097312aabfa16284f1"},
|
||||
{file = "typeguard-2.13.3.tar.gz", hash = "sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"]
|
||||
test = ["mypy", "pytest", "typing-extensions"]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.8.0"
|
||||
@@ -3894,4 +3924,4 @@ multidict = ">=4.0"
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = ">=3.10,<3.13"
|
||||
content-hash = "4241642e7d3858d84e2e6feb2f13ffc83c5704571cc702ab3777887ca38dc491"
|
||||
content-hash = "c7fc8303fe2dab22214f1850274eb8c57ccc5a0dccb6989d4fd449bbca0830fb"
|
||||
|
||||
@@ -28,6 +28,7 @@ scikit-learn = "^1.3.1"
|
||||
pytorch-optimizer = "^2.12.0"
|
||||
pathvalidate = "^3.2.0"
|
||||
torchinfo = "^1.8.0"
|
||||
jaxtyping = "^0.2.24"
|
||||
|
||||
[[tool.poetry.source]]
|
||||
name = "pytorch"
|
||||
|
||||
Reference in New Issue
Block a user